|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=887098 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Test for Bug 887098</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 <script type="application/javascript"> |
|
12 |
|
13 /** Test for Bug 887098 **/ |
|
14 SimpleTest.waitForExplicitFinish(); |
|
15 |
|
16 function loaded() { |
|
17 var iwin = $('ifr').contentWindow; |
|
18 var href = SpecialPowers.wrap(iwin).location.href; |
|
19 if (/file_empty/.test(href)) { |
|
20 window.evalRef = iwin.eval; |
|
21 window.installTriggerRef = iwin.InstallTrigger; // Force lazy instantiation. |
|
22 // about: is privileged, so we need to be privileged to load it. |
|
23 SpecialPowers.wrap(iwin).location.href = 'about:'; |
|
24 } else { |
|
25 is(href, 'about:', "Successfully navigated to about:"); |
|
26 try { |
|
27 evalRef('InstallTrigger.install({URL: "chrome://global/skin/global.css"});'); |
|
28 ok(false, "Should have thrown when trying to install restricted URI from InstallTrigger"); |
|
29 } catch (e) { |
|
30 //XXXgijs this test broke because of the switch to webidl. I'm told |
|
31 // it has to do with compartments and the fact that we eval in "about:". |
|
32 // Tracking in bug 1007671 |
|
33 todo(/permission/.test(e), "We should throw a security exception. Got: " + e); |
|
34 } |
|
35 SimpleTest.finish(); |
|
36 } |
|
37 } |
|
38 |
|
39 </script> |
|
40 </head> |
|
41 <body> |
|
42 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887098">Mozilla Bug 887098</a> |
|
43 <p id="display"></p> |
|
44 <div id="content" style="display: none"> |
|
45 |
|
46 </div> |
|
47 <iframe onload="loaded();" id="ifr" src="file_empty.html"></iframe> |
|
48 <pre id="test"> |
|
49 </pre> |
|
50 </body> |
|
51 </html> |