|
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> |
|
4 |
|
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" /> |
|
8 |
|
9 <script class="testbody" type="text/javascript"> |
|
10 |
|
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 */ |
|
21 |
|
22 var win; |
|
23 |
|
24 function manifestUpdated() |
|
25 { |
|
26 var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"] |
|
27 .getService(SpecialPowers.Ci.nsIApplicationCacheService); |
|
28 |
|
29 foreign1cache = appCacheService.chooseApplicationCache( |
|
30 "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo()); |
|
31 |
|
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") |
|
34 |
|
35 win = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html"); |
|
36 } |
|
37 |
|
38 function onDone() // called by the open window after stuff is finished |
|
39 { |
|
40 win.close(); |
|
41 OfflineTest.teardownAndFinish(); |
|
42 } |
|
43 |
|
44 SimpleTest.waitForExplicitFinish(); |
|
45 |
|
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 } |
|
52 |
|
53 </script> |
|
54 |
|
55 </head> |
|
56 |
|
57 <body> |
|
58 </body> |
|
59 </html> |