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.

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

mercurial