toolkit/mozapps/extensions/test/mochitest/test_bug887098.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial