dom/tests/mochitest/ajax/offline/test_foreign.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial