Permalink
Browse files

Test files for issue #27

  • Loading branch information...
1 parent cce8165 commit 8536aaab281fa5f70d1437caf3785a855a6edd6c @victor-homyakov victor-homyakov committed Nov 8, 2011
Showing with 55 additions and 0 deletions.
  1. +29 −0 test/issues/27-1.html
  2. +26 −0 test/issues/27-2.html
View
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <title>Issue #27</title>
+ <script src="../../stacktrace.js"></script>
+ <script>
+ window.onerror = function(errorMsg, url, lineNumber) {
+ alert(errorMsg + "\nURL: " + url + "\nLine number: " + lineNumber);
+ // Previous line gets executed
+ var trace;
+ try {
+ // Firefox enters printStackTrace. Leaves silently somewhere in there
+ trace = printStackTrace().join('\n\n');
+ // Execution does not arrive here (as evidenced in debugger)
+ } catch (e) {
+ // nothing gets thrown/caught in Firefox
+ // error console empty (the original uncaught exception is logged)
+ }
+ // Execution does not arrive here
+ // (as evidenced in debugger and actual browser window)
+ alert(trace);
+ return true;
+ };
+
+ // Somewhere error gets thrown
+ throw 'An error occurred';
+ </script>
+ </head>
+ <body></body>
+</html>
View
@@ -0,0 +1,26 @@
+<html>
+ <head>
+ <title>Issue #27</title>
+ <script src="../../stacktrace.js"></script>
+ <script>
+ /*function printStackTraceOnError(msg, file, line) {
+ alert(printStackTrace().join('\n\n'));
+ }
+ if (window.addEventListener) {
+ window.addEventListener('error', printStackTraceOnError, false);
+ } else if (window.attachEvent) {
+ window.attachEvent('onerror', printStackTraceOnError);
+ } else {
+ window.onerror = printStackTraceOnError;
+ }*/
+ window.onerror = function(msg, file, line) {
+ alert(printStackTrace().join('\n\n'));
+ };
+
+ function test() {
+ x += 1;
+ }
+ </script>
+ </head>
+ <body onload="test();"></body>
+</html>

0 comments on commit 8536aaa

Please sign in to comment.