2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=735544
7 <window title=
"Mozilla Bug 735544"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns=
"http://www.w3.org/1999/xhtml">
13 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=735544"
14 target=
"_blank">Mozilla Bug
735544</a>
15 <iframe id='ifr0'
onload=
"frameDone(0);" src=
"http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_exnstack.html" />
16 <iframe id='ifr1'
onload=
"frameDone(1);" src=
"http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_exnstack.html" />
19 <!-- test code goes here -->
20 <script type=
"application/javascript">
22 /** Test for Bug
735544 - Allow exception stacks to cross compartment boundaries **/
24 SimpleTest.waitForExplicitFinish();
26 var gFramesDone = [false, false];
27 function frameDone(idx) {
28 gFramesDone[idx] = true;
29 if (gFramesDone[
0] && gFramesDone[
1])
33 function throwAsChrome() {
35 // Grab the iframe content windows.
36 var cwin0 = document.getElementById('ifr0').contentWindow;
37 var cwin1 = document.getElementById('ifr1').contentWindow;
39 // Have cwin0 call a function on cwin1 that throws.
40 cwin0.wrappedJSObject.doThrow(cwin1);
43 function startTest() {
47 ok(false,
"should throw");
50 let stackFrames = e.stack.split(
"\n");
52 ok(/throwAsInner/.exec(stackFrames[
0]),
53 "The bottom frame should be thrown by the inner");
55 ok(/throwAsOuter/.exec(stackFrames[
2]),
56 "The 3rd-from-bottom frame should be thrown by the other");
58 ok(!/throwAsChrome/.exec(e.stack),
59 "The entire stack should not cross into chrome.");