1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/ajax/offline/test_foreign.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"> 1.5 +<head> 1.6 +<title>Foreign test</title> 1.7 + 1.8 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 +<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> 1.10 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 + 1.12 +<script class="testbody" type="text/javascript"> 1.13 + 1.14 +/** 1.15 + * This test loads a manifest that contains as an explicit entry 1.16 + * foreign2.html page. After manifest is cached and presence of the 1.17 + * foreign2.html page is checked we redirect to foreign2.html 1.18 + * page. Then the test continues inside that page as follows: 1.19 + * On load of foreign2.html we check there is no associated cache 1.20 + * because the foreign2.html page was marked as FOREIGN in foreign1 cache. 1.21 + * After the foreign2 manifest is updated we check foreign2 cache is 1.22 + * chosen by foreign.html page. 1.23 + */ 1.24 + 1.25 +var win; 1.26 + 1.27 +function manifestUpdated() 1.28 +{ 1.29 + var appCacheService = SpecialPowers.Cc["@mozilla.org/network/application-cache-service;1"] 1.30 + .getService(SpecialPowers.Ci.nsIApplicationCacheService); 1.31 + 1.32 + foreign1cache = appCacheService.chooseApplicationCache( 1.33 + "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo()); 1.34 + 1.35 + OfflineTest.ok(foreign1cache, "foreign2.html chosen from foreign1 cache"); 1.36 + OfflineTest.is(foreign1cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest") 1.37 + 1.38 + win = window.open("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html"); 1.39 +} 1.40 + 1.41 +function onDone() // called by the open window after stuff is finished 1.42 +{ 1.43 + win.close(); 1.44 + OfflineTest.teardownAndFinish(); 1.45 +} 1.46 + 1.47 +SimpleTest.waitForExplicitFinish(); 1.48 + 1.49 +if (OfflineTest.setup()) { 1.50 + applicationCache.onerror = OfflineTest.failEvent; 1.51 + applicationCache.onupdateready = OfflineTest.failEvent; 1.52 + applicationCache.onnoupdate = OfflineTest.failEvent; 1.53 + applicationCache.oncached = OfflineTest.priv(manifestUpdated); 1.54 +} 1.55 + 1.56 +</script> 1.57 + 1.58 +</head> 1.59 + 1.60 +<body> 1.61 +</body> 1.62 +</html>