diff options
Diffstat (limited to 'LayoutTests/http/tests/appcache/resources')
70 files changed, 716 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/resources/.htaccess b/LayoutTests/http/tests/appcache/resources/.htaccess new file mode 100644 index 0000000..dfa433b --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/.htaccess @@ -0,0 +1,5 @@ +RewriteEngine on +RewriteRule ^UNKNOWN_SECTION: simple.txt [L,NS] +<Files wrong-content-type.manifest> +ForceType text/plain +</Files> diff --git a/LayoutTests/http/tests/appcache/resources/404-resource.manifest b/LayoutTests/http/tests/appcache/resources/404-resource.manifest new file mode 100644 index 0000000..b2c066d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/404-resource.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +does-not-exist.txt diff --git a/LayoutTests/http/tests/appcache/resources/abe.png b/LayoutTests/http/tests/appcache/resources/abe.png Binary files differnew file mode 100644 index 0000000..c932536 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/abe.png diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.html b/LayoutTests/http/tests/appcache/resources/access-via-redirect.html new file mode 100644 index 0000000..510f841 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/access-via-redirect.html @@ -0,0 +1,46 @@ +<html manifest="access-via-redirect.manifest"> + +<p>This tests that the start of redirect chain doesn't get into an application cache if the end of the chain has a manifest.</p> +<p id="result">FAILURE</p> + +<script> +if (window.layoutTestController) { + layoutTestController.dumpAsText() + layoutTestController.waitUntilDone(); +} + +function canLoad(url) +{ + try { + var req = new XMLHttpRequest(); + req.open("GET", url, false); + req.send(""); + return true; + } catch (e) { + return false; + } +} + +function cached() +{ + if (canLoad("/appcache/access-via-redirect.php")) { + document.getElementById('result').innerHTML = "FAILURE: Start of redirect chain is in cache." + return; + } + + if (!canLoad("access-via-redirect.html")) { + document.getElementById('result').innerHTML = "FAILURE: Could not load main resource from cache." + return; + } + + document.getElementById('result').innerHTML = "SUCCESS" + + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +applicationCache.addEventListener('cached', cached, false); +applicationCache.addEventListener('noupdate', cached, false); + +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest b/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/auth/iframe.php b/LayoutTests/http/tests/appcache/resources/auth/iframe.php new file mode 100644 index 0000000..7e5d30d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/auth/iframe.php @@ -0,0 +1,16 @@ +<?php + if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Authentication canceled'; + exit; + } else { + echo "<html manifest='manifest.php'>\n"; + echo "<p>Subframe, should disappear.</p>\n"; + echo "<script>\n"; + echo " applicationCache.oncached = parent.success;\n"; + echo " applicationCache.onnoupdate = parent.success;\n"; + echo "</script>\n"; + echo "</html>\n"; + } +?> diff --git a/LayoutTests/http/tests/appcache/resources/auth/manifest.php b/LayoutTests/http/tests/appcache/resources/auth/manifest.php new file mode 100644 index 0000000..ea09957 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/auth/manifest.php @@ -0,0 +1,12 @@ +<?php + if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Authentication canceled'; + exit; + } else { + header("Content-Type: text/cache-manifest"); + echo "CACHE MANIFEST\n"; + echo "subresource.php\n"; + } +?> diff --git a/LayoutTests/http/tests/appcache/resources/auth/setup.php b/LayoutTests/http/tests/appcache/resources/auth/setup.php new file mode 100644 index 0000000..c0f3965 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/auth/setup.php @@ -0,0 +1,10 @@ +<?php + if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Authentication canceled'; + exit; + } else { + echo "OK\n"; + } +?> diff --git a/LayoutTests/http/tests/appcache/resources/auth/subresource.php b/LayoutTests/http/tests/appcache/resources/auth/subresource.php new file mode 100644 index 0000000..0945d53 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/auth/subresource.php @@ -0,0 +1,10 @@ +<?php + if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Authentication canceled'; + exit; + } else { + echo "/* Empty subresource */"; + } +?> diff --git a/LayoutTests/http/tests/appcache/resources/counter.php b/LayoutTests/http/tests/appcache/resources/counter.php new file mode 100644 index 0000000..7926faf --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/counter.php @@ -0,0 +1,23 @@ +<?php +require_once '../../resources/portabilityLayer.php'; + +$tmpFile = sys_get_temp_dir() . "/" . "appcache_counter"; + +function stepCounter($file) +{ + if (!file_exists($file)) { + file_put_contents($file, "0"); + return "0"; + } + $value = file_get_contents($file); + file_put_contents($file, ++$value); + return $value; +} + +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header("Content-Type: text/plain"); + +print(stepCounter($tmpFile)); +?> diff --git a/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html new file mode 100644 index 0000000..28bbeb3 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html @@ -0,0 +1,22 @@ +<html manifest="crash-when-navigating-away-then-back.manifest"> +<script> + +function cached() +{ + window.close(); + window.opener.closedWindow(); +} + +function noupdate() +{ + window.opener.document.getElementById('result').innerHTML = 'SUCCESS'; + window.close(); + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +applicationCache.addEventListener('cached', cached, false); +applicationCache.addEventListener('noupdate', noupdate, false); + +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest new file mode 100644 index 0000000..a9fb276 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +crash-when-navigating-away-then-back.html diff --git a/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html b/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html new file mode 100644 index 0000000..a97c508 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html @@ -0,0 +1,28 @@ +<html manifest="cyrillic-uri.manifest"> +<head> +<meta charset="koi8-r"> +</head> +<body> +<form method=GET action="?"> +<input type=text name=i value="ðÒÏ×ÅÒËÁ"> +</form> +<script> +document.write(location); +function test() { + if (location.search == "") { + document.forms[0].submit(); + } else if (location.search == "?i=%F0%D2%CF%D7%C5%D2%CB%C1") { + document.forms[0].elements[0].value="ðÒÏ×ÅÒËÁ-2"; + document.forms[0].submit(); + } else if (location.search == "?i=%F0%D2%CF%D7%C5%D2%CB%C1-2") { + parent.postMessage("allDone", "*"); + } else { + alert("Unexpected URI: " + location); + parent.postMessage("allDone", "*"); + } +} +applicationCache.onnoupdate = function() { test() } +applicationCache.oncached = function() { test() } +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest b/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest new file mode 100644 index 0000000..574ab9e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest @@ -0,0 +1,10 @@ +CACHE MANIFEST +intercept/cached-Проверка +intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0 +cyrillic-uri-form.html +cyrillic-uri-form.html?i=Проверка +NETWORK: +intercept/network-Проверка +cyrillic-uri-form.html?i=Проверка-2 +FALLBACK: +does-not-exist-Проверка intercept/fallback-Проверка diff --git a/LayoutTests/http/tests/appcache/resources/different-scheme.manifest b/LayoutTests/http/tests/appcache/resources/different-scheme.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/different-scheme.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/empty.manifest b/LayoutTests/http/tests/appcache/resources/empty.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/empty.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/empty.txt b/LayoutTests/http/tests/appcache/resources/empty.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/empty.txt diff --git a/LayoutTests/http/tests/appcache/resources/fail-on-update.php b/LayoutTests/http/tests/appcache/resources/fail-on-update.php new file mode 100644 index 0000000..b66da78 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/fail-on-update.php @@ -0,0 +1,38 @@ +<?php +require_once '../../resources/portabilityLayer.php'; + +$tmpFile = sys_get_temp_dir() . "/" . "fail_on_update_state"; + +function setState($newState, $file) +{ + file_put_contents($file, $newState); +} + +function getState($file) +{ + if (!file_exists($file)) { + return "Uninitialized"; + } + return file_get_contents($file); +} + +$command = $_GET['command']; +$state = getState($tmpFile); + +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); + +if ($command == "reset") { + unlink($tmpFile); +} else if ($command == "delete") { + setState("Deleted", $tmpFile); +} else if ($state == "Uninitialized") { + header("Content-Type: text/cache-manifest"); + print("CACHE MANIFEST\n"); + print("NETWORK:\n"); + print("fail-on-update.php?command=\n"); +} else if ($state == "Deleted") { + header('HTTP/1.0 404 Not Found'); +} +?> diff --git a/LayoutTests/http/tests/appcache/resources/fallback-redirect.php b/LayoutTests/http/tests/appcache/resources/fallback-redirect.php new file mode 100644 index 0000000..deb101a --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/fallback-redirect.php @@ -0,0 +1,8 @@ +<?php + header('HTTP/1.1 307 Temporary Redirect'); + header('Location: http://localhost:8000/appcache/resources/simple.txt'); + + header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); +?> diff --git a/LayoutTests/http/tests/appcache/resources/fallback.manifest b/LayoutTests/http/tests/appcache/resources/fallback.manifest new file mode 100644 index 0000000..7375c7d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/fallback.manifest @@ -0,0 +1,5 @@ +CACHE MANIFEST +FALLBACK: +/resources/network-simulator.php? simple.txt +fallback-redirect simple.txt +does-not-exist simple.txt
\ No newline at end of file diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js b/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js new file mode 100644 index 0000000..01b2b2a --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js @@ -0,0 +1 @@ +parent.postMessage("allDone", "*"); diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe.html b/LayoutTests/http/tests/appcache/resources/foreign-iframe.html new file mode 100644 index 0000000..0b008bc --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe.html @@ -0,0 +1,4 @@ +<html manifest="foreign-iframe.manifest"> +<div>Subframe</div> +<script src="foreign-iframe-subresource.js"></script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest b/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest new file mode 100644 index 0000000..fc0c2f9 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest @@ -0,0 +1,4 @@ +CACHE MANIFEST +simple.txt +foreign-iframe.html +foreign-iframe-subresource.js diff --git a/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest b/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/intercept/.htaccess b/LayoutTests/http/tests/appcache/resources/intercept/.htaccess new file mode 100644 index 0000000..bfd3b30 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/intercept/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine on +RewriteRule ^.* /appcache/resources/print-uri.php [L,NS] diff --git a/LayoutTests/http/tests/appcache/resources/local-content.manifest b/LayoutTests/http/tests/appcache/resources/local-content.manifest new file mode 100644 index 0000000..d62c274 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/local-content.manifest @@ -0,0 +1,4 @@ +CACHE MANIFEST +/appcache/local-content.html +NETWORK: +file:/ # Should be ignored due to different URL scheme, but it doesn't hurt to try. diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html new file mode 100644 index 0000000..6fc1260 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html @@ -0,0 +1,27 @@ +<html manifest="/appcache/resources/main-resource-hash-frame.manifest#foo"> +<div id=result></div> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +applicationCache.onchecking = function() { log("checking"); } +applicationCache.ondownloading = function() { log("downloading") } +applicationCache.onprogress = function() { log("progress") } +applicationCache.onupdateready = function() { log("updateready") } +applicationCache.onobsolete = function() { log("obsolete") } +applicationCache.oncached = function() { log("cached"); loaded(); } +applicationCache.onnoupdate = function() { log("noupdate"); loaded(); } +applicationCache.onerror = function() { log("error"); loaded(); } + +var once = 1; +function loaded() +{ + if (once) { + once = 0; + parent.postMessage("loaded", "*"); + } +} +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest b/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest new file mode 100644 index 0000000..eb5c126 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +manifest-containing-itself.manifest diff --git a/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest b/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest new file mode 100644 index 0000000..db694ac --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest @@ -0,0 +1,6 @@ +CACHE MANIFEST ignored text + empty.txt + +simple.txt ignored text +UNKNOWN_SECTION: +not-in-cache.txt diff --git a/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php b/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php new file mode 100644 index 0000000..e3bc158 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php @@ -0,0 +1,7 @@ +<?php +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header('HTTP/1.1 307 Temporary Redirect'); +header('Location: manifest-redirect-2.php'); +?> diff --git a/LayoutTests/http/tests/appcache/resources/manifest-redirect.php b/LayoutTests/http/tests/appcache/resources/manifest-redirect.php new file mode 100644 index 0000000..e2f32eb --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/manifest-redirect.php @@ -0,0 +1,7 @@ +<?php +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header('HTTP/1.1 307 Temporary Redirect'); +header('Location: simple.manifest'); +?> diff --git a/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest b/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest new file mode 100644 index 0000000..aab054b --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +empty.txt diff --git a/LayoutTests/http/tests/appcache/resources/maxsize.manifest b/LayoutTests/http/tests/appcache/resources/maxsize.manifest new file mode 100644 index 0000000..934fa6c --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/maxsize.manifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +#v1 +abe.png diff --git a/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest b/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest new file mode 100644 index 0000000..10f6ddb --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +slow-resource.php diff --git a/LayoutTests/http/tests/appcache/resources/non-html.manifest b/LayoutTests/http/tests/appcache/resources/non-html.manifest new file mode 100644 index 0000000..dc8db7a --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/non-html.manifest @@ -0,0 +1,8 @@ +CACHE MANIFEST +/appcache/non-html.xhtml +/resources/network-simulator.php?path=/appcache/resources/simple.txt +/resources/network-simulator.php?path=/appcache/resources/abe.png +/resources/network-simulator.php?path=/appcache/resources/non-html.manifest +NETWORK: +/favicon.ico +/resources/network-simulator.php?command= diff --git a/LayoutTests/http/tests/appcache/resources/not-in-cache.txt b/LayoutTests/http/tests/appcache/resources/not-in-cache.txt new file mode 100644 index 0000000..a580081 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/not-in-cache.txt @@ -0,0 +1 @@ +This file is not in the cache and is thus not possible to load.
\ No newline at end of file diff --git a/LayoutTests/http/tests/appcache/resources/offline-access-frame.html b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html new file mode 100644 index 0000000..68ef274 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html @@ -0,0 +1,30 @@ +<html manifest="/resources/network-simulator.php?path=/appcache/resources/offline-access.manifest"> +<div id=result></div> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} +applicationCache.onchecking = function() { log("checking"); } +applicationCache.ondownloading = function() { log("downloading") } +applicationCache.onprogress = function() { log("progress") } +applicationCache.onupdateready = function() { log("updateready") } +applicationCache.onobsolete = function() { log("obsolete") } +</script> +<script src="/resources/network-simulator.php?path=/appcache/resources/offline-access.js"></script> +<script> + +applicationCache.oncached = function() { log("cached"); test() } +applicationCache.onnoupdate = function() { log("noupdate"); test() } +applicationCache.onerror = function() { log("error"); test() } + +if (applicationCache.status == applicationCache.IDLE) { + // Update finished while we were waiting for offline-access.js to load. + applicationCache.oncached = function() { log("cached") } + applicationCache.onnoupdate = function() { log("noupdate") } + applicationCache.onerror = function() { log("error") } + test(); +} + +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/offline-access.js b/LayoutTests/http/tests/appcache/resources/offline-access.js new file mode 100644 index 0000000..a69d73e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/offline-access.js @@ -0,0 +1,18 @@ +function test() +{ + applicationCache.oncached = function() { log("cached") } + applicationCache.onnoupdate = function() { log("noupdate") } + applicationCache.onerror = function() { log("error") } + + try { + var req = new XMLHttpRequest; + req.open("GET", "/resources/network-simulator.php?path=/appcache/resources/simple.txt", false); + req.send(null); + if (req.responseText == "Hello, World!") + parent.postMessage("done", "*"); + else + alert("FAIL, unexpected response: " + ex); + } catch (ex) { + alert("FAIL, unexpected error: " + ex); + } +} diff --git a/LayoutTests/http/tests/appcache/resources/offline-access.manifest b/LayoutTests/http/tests/appcache/resources/offline-access.manifest new file mode 100644 index 0000000..5142e38 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/offline-access.manifest @@ -0,0 +1,5 @@ +CACHE MANIFEST +/resources/network-simulator.php?path=/appcache/resources/offline-access-frame.html +/resources/network-simulator.php?path=/appcache/resources/offline-access.manifest +/resources/network-simulator.php?path=/appcache/resources/simple.txt +/resources/network-simulator.php?path=/appcache/resources/offline-access.js diff --git a/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest b/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest new file mode 100644 index 0000000..892bf8d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest @@ -0,0 +1,14 @@ +CACHE MANIFEST +counter.php?cached + +NETWORK: +# These are prefixes for requests we test, but they are not same origin, so they will be skipped. +http:// +http://127 +http://127.0.0.1:8 + +# This should be ignored, because explicit entries are checked before online whitelist +counter.php?cached + +# This should work normally. +counter.php?uncached
\ No newline at end of file diff --git a/LayoutTests/http/tests/appcache/resources/print-uri.php b/LayoutTests/http/tests/appcache/resources/print-uri.php new file mode 100644 index 0000000..23358f1 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/print-uri.php @@ -0,0 +1,7 @@ +<?php + header("Content-Type: text/javascript"); + header("Expires: Thu, 01 Dec 2003 16:00:00 GMT\n"); + header("Cache-Control: no-cache, must-revalidate\n"); + header("Pragma: no-cache\n"); + echo $_SERVER['REQUEST_URI']; +?> diff --git a/LayoutTests/http/tests/appcache/resources/reload-iframe.html b/LayoutTests/http/tests/appcache/resources/reload-iframe.html new file mode 100644 index 0000000..7575bab --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/reload-iframe.html @@ -0,0 +1,21 @@ +<html manifest="reload-iframe.manifest"> +<body> +<script> +function test() +{ + try { + var req = new XMLHttpRequest(); + req.open("GET", "resources/not-in-cache.txt", false); + req.send(""); + parent.postMessage("FAIL: Loading an uncached resource didn't raise an exception", "*"); + } catch (e) { + parent.postMessage("SUCCESS", "*"); + } +} + +applicationCache.onnoupdate = function() { parent.postMessage("Frame loaded", "*") } +applicationCache.oncached = function() { parent.postMessage("Frame loaded", "*") } + +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest b/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest new file mode 100644 index 0000000..668f974 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +/appcache/resources/simple.txt diff --git a/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html b/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html new file mode 100644 index 0000000..009a8b6 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html @@ -0,0 +1,37 @@ +<html manifest="fail-on-update.php"> +<body> +<div id=result></div> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +function test() +{ + log("cached") + log("status=" + applicationCache.status); + applicationCache.onnoupdate = null; + + // Associated to a cache, so loading should fail + try { + var req = new XMLHttpRequest; + req.open("GET", "empty.txt", false); + req.send(null); + alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception"); + } catch (ex) { + } + log("There should be no messages below."); + parent.postMessage("frameDone", "*"); +} + +applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected onupdateready event in frame") } +applicationCache.onerror = function() { log("error"); alert("Unexpected error event in frame") } +applicationCache.onnoupdate = function() { log("noupdate"); alert("Unexpected noupdate event in frame") } +applicationCache.onobsolete = function() { log("obsolete"); alert("Unexpected obsolete event in frame") } + +applicationCache.oncached = test; + +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html new file mode 100644 index 0000000..30e8553 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html @@ -0,0 +1,64 @@ +<html manifest="fail-on-update.php"> +<body> +<div id=result></div> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +function onObsolete() +{ + log("obsolete") + log("status=" + applicationCache.status + " (expected 5)"); + applicationCache.onobsolete = function() { log("obsolete") } + applicationCache.onupdateready = function() { log("updateready") } + applicationCache.onnoupdate = function() { log("noupdate") } + applicationCache.onnoupdate = function() { log("error") } + + // We still have a cache, so loading should fail + try { + var req = new XMLHttpRequest; + req.open("GET", "empty.txt", false); + req.send(null); + alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception"); + } catch (ex) { + } + log("There should be no messages below."); +} + +function onError() +{ + if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) { + timeoutId = setTimeout(onNoManifest, 100); + return; + } + + log("error"); + applicationCache.onobsolete = function() { log("obsolete") } + applicationCache.onupdateready = function() { log("updateready") } + applicationCache.onnoupdate = function() { log("noupdate") } + applicationCache.onnoupdate = function() { log("error") } + + // Ensure that we are not associated with a cache. + try { + var req = new XMLHttpRequest; + req.open("GET", "empty.txt", false); + req.send(null); + } catch (ex) { + alert("FAIL: XMLHttpRequest raised an exception, " + ex); + } + log("There should be no messages below."); + parent.postMessage("frameDone - timeout", "*"); +} + +applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected updateready event in frame") } +applicationCache.onnoupdate = function() { log("noupdate") } +applicationCache.oncached = function() { log("cached"); alert("Unexpected cached event in frame") } + +applicationCache.onobsolete = onObsolete; +applicationCache.onerror = onError; + +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest new file mode 100644 index 0000000..66cd3fe --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +resource-redirect-2.php diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php new file mode 100644 index 0000000..ac1e8f5 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php @@ -0,0 +1,7 @@ +<?php +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header('HTTP/1.1 307 Temporary Redirect'); +header('Location: resource-redirect-2.php'); +?> diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest b/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest new file mode 100644 index 0000000..e94651d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +resource-redirect.php diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect.php b/LayoutTests/http/tests/appcache/resources/resource-redirect.php new file mode 100644 index 0000000..07931fb --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/resource-redirect.php @@ -0,0 +1,7 @@ +<?php +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header('HTTP/1.1 307 Temporary Redirect'); +header('Location: simple.txt'); +?> diff --git a/LayoutTests/http/tests/appcache/resources/simple.manifest b/LayoutTests/http/tests/appcache/resources/simple.manifest new file mode 100644 index 0000000..3a210f3 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/simple.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +simple.txt diff --git a/LayoutTests/http/tests/appcache/resources/simple.txt b/LayoutTests/http/tests/appcache/resources/simple.txt new file mode 100644 index 0000000..b45ef6f --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/simple.txt @@ -0,0 +1 @@ +Hello, World!
\ No newline at end of file diff --git a/LayoutTests/http/tests/appcache/resources/slow-resource.php b/LayoutTests/http/tests/appcache/resources/slow-resource.php new file mode 100644 index 0000000..b720ba1 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/slow-resource.php @@ -0,0 +1,3 @@ +<?php +sleep(10); +?> diff --git a/LayoutTests/http/tests/appcache/resources/subframe-1.html b/LayoutTests/http/tests/appcache/resources/subframe-1.html new file mode 100644 index 0000000..629c030 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframe-1.html @@ -0,0 +1,7 @@ +<script> +var req = new XMLHttpRequest; +req.open("GET", "simple.txt", false); +req.send(null); +if (req.responseText.length > 0) + parent.postMessage("allDone", "*"); +</script> diff --git a/LayoutTests/http/tests/appcache/resources/subframe-2.html b/LayoutTests/http/tests/appcache/resources/subframe-2.html new file mode 100644 index 0000000..9fb6c0f --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframe-2.html @@ -0,0 +1,11 @@ +<script> +try { + var req = new XMLHttpRequest; + req.open("GET", "simple.txt", false); + req.send(null); + alert("FAIL, unexpected response: " + req.responseText); +} catch (ex) { + // Loading should fail, because simple.txt is not in cache manifest. + parent.postMessage("allDone", "*"); +} +</script> diff --git a/LayoutTests/http/tests/appcache/resources/subframe-3.html b/LayoutTests/http/tests/appcache/resources/subframe-3.html new file mode 100644 index 0000000..b708408 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframe-3.html @@ -0,0 +1,26 @@ +<html manifest="subframes-3.manifest"> +<script> +function test() +{ + applicationCache.onnoupdate = null; + + try { + var req = new XMLHttpRequest; + req.open("GET", "simple.txt", false); + req.send(null); + alert("FAIL, unexpected response: " + req.responseText); + } catch (ex) { + // Loading should fail, because simple.txt is not in cache manifest. + parent.postMessage("allDone", "*"); + } +} + +// The cache has been fully created before the iframe was inserted, and the manifest didn't change. +applicationCache.onnoupdate = test; + +applicationCache.onupdateready = function() { alert("Unexpected updateready event") } +applicationCache.oncached = function() { alert("Unexpected cached event") } +applicationCache.onerror = function() { alert("Unexpected error event") } + +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/subframe-4.html b/LayoutTests/http/tests/appcache/resources/subframe-4.html new file mode 100644 index 0000000..da03679 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframe-4.html @@ -0,0 +1,26 @@ +<html manifest="subframes-4.manifest"> +<script> +function test() +{ + applicationCache.onnoupdate = null; + + try { + var req = new XMLHttpRequest; + req.open("GET", "simple.txt", false); + req.send(null); + alert("FAIL, unexpected response: " + req.responseText); + } catch (ex) { + // Loading should fail, because simple.txt is not in cache manifest. + parent.postMessage("allDone", "*"); + } +} + +// The cache has been fully created before the iframe was inserted, and the manifest didn't change. +applicationCache.onnoupdate = test; + +applicationCache.onupdateready = function() { alert("Unexpected updateready event") } +applicationCache.oncached = function() { alert("Unexpected cached event") } +applicationCache.onerror = function() { alert("Unexpected error event") } + +</script> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/subframes-1.manifest b/LayoutTests/http/tests/appcache/resources/subframes-1.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframes-1.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/subframes-2.manifest b/LayoutTests/http/tests/appcache/resources/subframes-2.manifest new file mode 100644 index 0000000..645a34f --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframes-2.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +subframe-2.html diff --git a/LayoutTests/http/tests/appcache/resources/subframes-3.manifest b/LayoutTests/http/tests/appcache/resources/subframes-3.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframes-3.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/subframes-4.manifest b/LayoutTests/http/tests/appcache/resources/subframes-4.manifest new file mode 100644 index 0000000..f4e7937 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/subframes-4.manifest @@ -0,0 +1,2 @@ +CACHE MANIFEST +subframe-4.html diff --git a/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php b/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php new file mode 100644 index 0000000..ddfe07d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php @@ -0,0 +1,13 @@ +<?php +# This resource won't be cached by network layer, but will be cached by appcache. +header("Last-Modified: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, no-store"); +header("Pragma: no-cache"); +header("Content-Type: text/plain"); + +if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] || $_SERVER['HTTP_IF_NONE_MATCH']) + header("HTTP/1.1 304 Not Modified"); +else + print("Hello, world!\n"); +?> diff --git a/LayoutTests/http/tests/appcache/resources/versioned-manifest.php b/LayoutTests/http/tests/appcache/resources/versioned-manifest.php new file mode 100644 index 0000000..84a7a91 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/versioned-manifest.php @@ -0,0 +1,37 @@ +<?php +require_once '../../resources/portabilityLayer.php'; + +$tmpFile = sys_get_temp_dir() . "/" . "appcache_manifest_counter"; + +function getCount($file) +{ + if (!file_exists($file)) { + file_put_contents($file, "0"); + return "0"; + } + return file_get_contents($file); +} + +function stepCounter($file) +{ + if (file_exists($file)) { + $value = getCount($file); + file_put_contents($file, ++$value); + } +} + +header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); +header("Cache-Control: no-cache, must-revalidate"); +header("Pragma: no-cache"); +header("Content-Type: text/cache-manifest"); + +if ("step" == $_GET['command']) + stepCounter($tmpFile); + +print("CACHE MANIFEST\n"); +print("# version " . getCount($tmpFile) . "\n"); +print("counter.php\n"); +print("uncacheable-resource.php\n"); // with Cache-control: no-store +print("NETWORK:\n"); +print("versioned-manifest.php?command=\n"); +?> diff --git a/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest b/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest new file mode 100644 index 0000000..8f88a4a --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +NETWORK: +* diff --git a/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest b/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest b/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest new file mode 100644 index 0000000..d7d3f8d --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest @@ -0,0 +1 @@ +CACHE MANIFEST;V2 diff --git a/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest b/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest new file mode 100644 index 0000000..aab49be --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest @@ -0,0 +1 @@ +A CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest new file mode 100644 index 0000000..af16a0e --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest @@ -0,0 +1 @@ +CACHE MANIFEST diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html new file mode 100644 index 0000000..57093fa --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html @@ -0,0 +1,36 @@ +<html manifest="xhr-foreign-resource-2.manifest"> +<body> +<div id=result></div> +<script> +function log(message) +{ + document.getElementById("result").innerHTML += message + "<br>"; +} + +function cached() +{ + applicationCache.onnoupdate = null; + applicationCache.oncached = null; + + // simple.txt is only listed s a resource in main frame's manifest, so loading should fail. + try { + var req = new XMLHttpRequest; + req.open("GET", "simple.txt", false); + req.send(""); + log("FAIL"); + log("applicationCache.status = " + applicationCache.status); + parent.postMessage("FAIL", "*"); + } catch (ex) { + log("Frame OK"); + parent.postMessage("SUCCESS", "*"); + } +} + +applicationCache.onnoupdate = cached; +applicationCache.oncached = cached; + +applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") } +applicationCache.onerror = function() { log("FAIL: received unexpected error event") } +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest new file mode 100644 index 0000000..8cfe428 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest @@ -0,0 +1,3 @@ +CACHE MANIFEST +xhr-foreign-resource-frame.html +simple.txt |