Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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=996069
6 -->
7 <window title="Mozilla Bug 996069"
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"/>
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=996069"
14 target="_blank">Mozilla Bug 996069</a>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
20 const Cu = Components.utils;
21 /** Test for Bug 996069 **/
22 SimpleTest.waitForExplicitFinish();
24 function loaded() {
25 var ifr = document.getElementById("ifr").contentWindow;
26 var sb = new Cu.Sandbox([ifr],
27 { sandboxPrototype: ifr });
29 ifr.wrappedJSObject.finishTest = function() {
30 // If we got here we did not hit the NS_ReleaseAssert...
31 ok(true, "nsExpandedPrincipal should not be inherited by content windows");
33 // But let's be sure that the new window does not have nsEP
34 newWin.wrappedJSObject.obj = Cu.evalInSandbox("var obj = { foo: 'bar' }; obj", sb);
35 try {
36 newWin.eval("obj.foo");
37 ok(false, "newWin should not have access to object from a scope with nsExpandedPrincipal");
38 } catch (e) {
39 ok(/Permission denied/.exec(e.message), "newWin should not have access to object from a scope with nsExpandedPrincipal");
40 }
41 newWin.close();
42 SimpleTest.finish();
43 };
45 var newWin = Cu.evalInSandbox(
46 "window.open('http://example.org/chrome/js/xpconnect/tests/chrome/file_bug996069.html');",
47 sb);
48 }
50 ]]>
51 </script>
52 <iframe id="ifr" onload="loaded();" type="content" src="http://example.org/chrome/js/xpconnect/tests/chrome/file_bug996069.html" />
53 </window>