Tue, 06 Jan 2015 21:39:09 +0100
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 <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest">
2 <head>
3 <title>Foreign test</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 <script class="testbody" type="text/javascript">
11 /**
12 * This test loads a manifest that contains as an explicit entry
13 * foreign2.html page. After manifest is cached and presence of the
14 * foreign2.html page is checked we redirect to foreign2.html
15 * page. Then the test continues inside that page as follows:
16 * On load of foreign2.html we check there is no associated cache
17 * because the foreign2.html page was marked as FOREIGN in foreign1 cache.
18 * After the foreign2 manifest is updated we check foreign2 cache is
19 * chosen by foreign.html page.
20 */
22 var win;
24 function manifestUpdated()
25 {
26 var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"]
27 .getService(SpecialPowers.Ci.nsIApplicationCacheService);
29 foreign1cache = appCacheService.chooseApplicationCache(
30 "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo());
32 OfflineTest.ok(foreign1cache, "foreign2.html chosen from foreign1 cache");
33 OfflineTest.is(foreign1cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest")
35 win = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html");
36 }
38 function onDone() // called by the open window after stuff is finished
39 {
40 win.close();
41 OfflineTest.teardownAndFinish();
42 }
44 SimpleTest.waitForExplicitFinish();
46 if (OfflineTest.setup()) {
47 applicationCache.onerror = OfflineTest.failEvent;
48 applicationCache.onupdateready = OfflineTest.failEvent;
49 applicationCache.onnoupdate = OfflineTest.failEvent;
50 applicationCache.oncached = OfflineTest.priv(manifestUpdated);
51 }
53 </script>
55 </head>
57 <body>
58 </body>
59 </html>