File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > Issue #27</ title >
4+ < script src ="../../stacktrace.js "> </ script >
5+ < script >
6+ window . onerror = function ( errorMsg , url , lineNumber ) {
7+ alert ( errorMsg + "\nURL: " + url + "\nLine number: " + lineNumber ) ;
8+ // Previous line gets executed
9+ var trace ;
10+ try {
11+ // Firefox enters printStackTrace. Leaves silently somewhere in there
12+ trace = printStackTrace ( ) . join ( '\n\n' ) ;
13+ // Execution does not arrive here (as evidenced in debugger)
14+ } catch ( e ) {
15+ // nothing gets thrown/caught in Firefox
16+ // error console empty (the original uncaught exception is logged)
17+ }
18+ // Execution does not arrive here
19+ // (as evidenced in debugger and actual browser window)
20+ alert ( trace ) ;
21+ return true ;
22+ } ;
23+
24+ // Somewhere error gets thrown
25+ throw 'An error occurred' ;
26+ </ script >
27+ </ head >
28+ < body > </ body >
29+ </ html >
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > Issue #27</ title >
4+ < script src ="../../stacktrace.js "> </ script >
5+ < script >
6+ /*function printStackTraceOnError(msg, file, line) {
7+ alert(printStackTrace().join('\n\n'));
8+ }
9+ if (window.addEventListener) {
10+ window.addEventListener('error', printStackTraceOnError, false);
11+ } else if (window.attachEvent) {
12+ window.attachEvent('onerror', printStackTraceOnError);
13+ } else {
14+ window.onerror = printStackTraceOnError;
15+ }*/
16+ window . onerror = function ( msg , file , line ) {
17+ alert ( printStackTrace ( ) . join ( '\n\n' ) ) ;
18+ } ;
19+
20+ function test ( ) {
21+ x += 1 ;
22+ }
23+ </ script >
24+ </ head >
25+ < body onload ="test(); "> </ body >
26+ </ html >
You can’t perform that action at this time.
0 commit comments