js/xpconnect/tests/chrome/test_exnstack.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial