dom/tests/mochitest/webapps/cross_origin.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   <meta charset="utf-8">
     5   <title>Cross Origin Helper</title>
     6   <script type="application/javascript" src="head.js"></script>
     7 </head>
     8 <body>
     9 <script type="application/javascript">
    11 /**
    12  * Install an app, check that getSelf() works, and then tell the test page
    13  * to continue the tests.
    14  *
    15  * This page loads on a different origin than the one for the test page,
    16  * which enables that page to check the behavior of various API calls when apps
    17  * have been installed from multiple origins.
    18  */
    20 var parent = SpecialPowers.wrap(window).parent;
    22 confirmNextInstall();
    23 navigator.mozApps.install(parent.url2, null).onsuccess = function onInstall() {
    24   // Give the test page a reference to the installed app, so it can uninstall it
    25   // after it finishes the tests.
    26   parent.app2 = this.result;
    28   navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
    29     parent.ok(this.result == null, "getSelf() from app's origin returns null if called from a browser");
    31     // Tell the test page to continue the tests.
    32     parent.postMessage("next", "*");
    33   }
    34 }
    36 </script>
    37 </body>
    38 </html>

mercurial