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.

     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">
    13   /** Test for Bug 887098 **/
    14   SimpleTest.waitForExplicitFinish();
    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   }
    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">
    46 </div>
    47 <iframe onload="loaded();" id="ifr" src="file_empty.html"></iframe>
    48 <pre id="test">
    49 </pre>
    50 </body>
    51 </html>

mercurial