dom/tests/mochitest/general/file_showModalDialog.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4 <script>
     5   function go() {
     6     is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
     7     ok("returnValue" in window && "dialogArguments" in window, "We are modal");
     8     var iwin = document.getElementById('ifr').contentWindow;
     9     is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");
    11     if (location.origin != "http://mochi.test:8888") {
    12       is(window.dialogArguments, undefined,
    13         "dialogArguments should be undefined cross-origin: " + location.origin);
    14     }
    16     window.returnValue = "rv: " + window.dialogArguments;
    18     // Allow for testing navigations in series.
    19     if (location.search == "") {
    20       window.close();
    21     } else {
    22       var origins = location.search.split('?')[1].split(',');
    23       var newsearch = '?' + origins.splice(1).join(',');
    24       var newurl = location.toString().replace(location.origin, origins[0])
    25                                       .replace(location.search, newsearch);
    26       location = newurl;
    27     }
    29   }
    30 </script>
    31 </head>
    32 <body onload="opener.postMessage('dosetup', '*');">
    33 <iframe id="ifr"></iframe>
    34 </body>
    35 </html>

mercurial