|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
|
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=735544 |
|
6 --> |
|
7 <window title="Mozilla Bug 735544" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
10 |
|
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" /> |
|
17 </body> |
|
18 |
|
19 <!-- test code goes here --> |
|
20 <script type="application/javascript"> |
|
21 <![CDATA[ |
|
22 /** Test for Bug 735544 - Allow exception stacks to cross compartment boundaries **/ |
|
23 |
|
24 SimpleTest.waitForExplicitFinish(); |
|
25 |
|
26 var gFramesDone = [false, false]; |
|
27 function frameDone(idx) { |
|
28 gFramesDone[idx] = true; |
|
29 if (gFramesDone[0] && gFramesDone[1]) |
|
30 startTest(); |
|
31 } |
|
32 |
|
33 function throwAsChrome() { |
|
34 |
|
35 // Grab the iframe content windows. |
|
36 var cwin0 = document.getElementById('ifr0').contentWindow; |
|
37 var cwin1 = document.getElementById('ifr1').contentWindow; |
|
38 |
|
39 // Have cwin0 call a function on cwin1 that throws. |
|
40 cwin0.wrappedJSObject.doThrow(cwin1); |
|
41 } |
|
42 |
|
43 function startTest() { |
|
44 |
|
45 try { |
|
46 throwAsChrome(); |
|
47 ok(false, "should throw"); |
|
48 } catch (e) { |
|
49 |
|
50 stackFrames = e.stack.split("\n"); |
|
51 |
|
52 ok(/throwAsInner/.exec(stackFrames[0]), |
|
53 "The bottom frame should be thrown by the inner"); |
|
54 |
|
55 ok(/throwAsOuter/.exec(stackFrames[2]), |
|
56 "The 3rd-from-bottom frame should be thrown by the other"); |
|
57 |
|
58 ok(!/throwAsChrome/.exec(e.stack), |
|
59 "The entire stack should not cross into chrome."); |
|
60 } |
|
61 |
|
62 SimpleTest.finish(); |
|
63 } |
|
64 |
|
65 ]]> |
|
66 </script> |
|
67 |
|
68 </window> |