Skip to content

Commit 1ce9d24

Browse files
author
homyakov
committed
Test page for issue stacktracejs#32 working in Chrome
1 parent 830dad6 commit 1ce9d24

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/issues/32.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
<script src="../../stacktrace.js"></script>
66
<script>
77
/*window.onload = function() {
8-
alert("window.onload");
9-
}*/
10-
8+
alert("window.onload");
9+
}*/
1110
window.onbeforeunload = function(e) {
1211
e = e || window.event;
13-
// currentTarget originalTarget target
12+
// FF: currentTarget originalTarget target
13+
// Chrome: currentTarget srcElement target
1414

15-
//alert("window.onbeforeunload");
1615
// capture stack trace
1716
// NOTE:
1817
// FF captures full stack,
1918
// IE captures stack but doesn't include 'onbeforeunload' function in stack,
20-
// CHROME doesn't show stack
21-
var trace = printStackTrace();
22-
alert('window.onbeforeunload stacktrace:\n\n' + trace.join('\n\n'));
19+
// CHROME doesn't show alert
20+
var trace = printStackTrace().join('\n\n');
21+
document.getElementById("stacktrace").value = trace;
22+
alert('window.onbeforeunload stacktrace:\n\n' + trace);
2323

24-
var msg = 'Do you want to continue window unload?';
24+
var msg = 'Stacktrace:\n\n' + trace;
2525
// For IE and Firefox prior to version 4
2626
if (e) {
2727
e.returnValue = msg;
@@ -50,5 +50,6 @@
5050
<li>Invoke the document.open method.</li>
5151
<li>Click the Back, Forward, Refresh, or Home button.</li>
5252
</ul>
53+
<textarea id="stacktrace" style="width:100%; height:10em;">stacktrace</textarea>
5354
</body>
5455
</html>

0 commit comments

Comments
 (0)