1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/ajax/offline/test_bug445544.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +<html manifest="445544.cacheManifest"> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=445544 1.7 +--> 1.8 + 1.9 +<head> 1.10 +<title>Test for Bug 445544</title> 1.11 + 1.12 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.14 +<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> 1.15 + 1.16 +<script type="text/javascript"> 1.17 + 1.18 +var gTestWin; 1.19 +var gTimeoutId; 1.20 + 1.21 +function finish() 1.22 +{ 1.23 + gTestWin.close(); 1.24 + OfflineTest.teardownAndFinish(); 1.25 +} 1.26 + 1.27 +function error() 1.28 +{ 1.29 + OfflineTest.ok(false, "Part 2 did not successfully load."); 1.30 + finish(); 1.31 +} 1.32 + 1.33 +function part2loaded() 1.34 +{ 1.35 + clearTimeout(gTimeoutId); 1.36 + OfflineTest.ok(true, "Part 2 successfully loaded."); 1.37 + finish(); 1.38 +} 1.39 + 1.40 +function part1loaded(appCacheStatus) 1.41 +{ 1.42 + OfflineTest.ok(appCacheStatus > 0, 1.43 + "Part 1 successfully loaded from the application cache."); 1.44 + 1.45 + // Loading part 2 (which is not part of that application 1.46 + // cache) should succeed... 1.47 + gTestWin.location = "445544_part2.html"; 1.48 + 1.49 + // We won't be notified if the page fails to load, fail this test 1.50 + // in 10 seconds. 1.51 + gTimeoutId = setTimeout(error, 10000); 1.52 +} 1.53 + 1.54 +function manifestUpdated() 1.55 +{ 1.56 + // Open a new window that will be associated with this application 1.57 + // cache. This will call part1loaded(). 1.58 + gTestWin = window.open("445544_part1.html"); 1.59 +} 1.60 + 1.61 +if (OfflineTest.setup()) { 1.62 + applicationCache.onerror = OfflineTest.failEvent; 1.63 + applicationCache.oncached = OfflineTest.priv(manifestUpdated); 1.64 +} 1.65 + 1.66 +SimpleTest.waitForExplicitFinish(); 1.67 + 1.68 +</script> 1.69 + 1.70 +</head> 1.71 + 1.72 +<body> 1.73 + 1.74 +</body> 1.75 +</html>