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.

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

mercurial