Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / chrome / test_exnstack.xhtml
blob48bcac524362b21bd55a4a5920abaec0051c3b5e
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 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" />
17 </body>
19 <!-- test code goes here -->
20 <script type="application/javascript">
21 <![CDATA[
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])
30 startTest();
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() {
45 try {
46 throwAsChrome();
47 ok(false, "should throw");
48 } catch (e) {
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.");
62 SimpleTest.finish();
65 ]]>
66 </script>
68 </window>