|
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"/> |
|
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=996069" |
|
14 target="_blank">Mozilla Bug 996069</a> |
|
15 </body> |
|
16 |
|
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(); |
|
23 |
|
24 function loaded() { |
|
25 var ifr = document.getElementById("ifr").contentWindow; |
|
26 var sb = new Cu.Sandbox([ifr], |
|
27 { sandboxPrototype: ifr }); |
|
28 |
|
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"); |
|
32 |
|
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 }; |
|
44 |
|
45 var newWin = Cu.evalInSandbox( |
|
46 "window.open('http://example.org/chrome/js/xpconnect/tests/chrome/file_bug996069.html');", |
|
47 sb); |
|
48 } |
|
49 |
|
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> |