Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a layout test verifying AppCache resource fetches have the docume…
…nt's cookie in place. https://bugs.webkit.org/show_bug.cgi?id=183757 Reviewed by Alex Christensen. * http/tests/appcache/document-cookie-expected.txt: Added. * http/tests/appcache/document-cookie.php: Added. * http/tests/appcache/resources/cookie-protected-script.php: Added. * http/tests/appcache/resources/document-cookie.manifest: Added. Canonical link: https://commits.webkit.org/199391@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229733 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CONSOLE MESSAGE: line 1: ApplicationCache is deprecated. Please use ServiceWorkers instead. | ||
This tests that cookies set on the main document are used when accessing resources in the manifest. | ||
PASSED: Cookie is set to 'bar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
setcookie("foo", "bar", 0, "/"); | ||
?> | ||
<html manifest="resources/document-cookie.manifest"> | ||
|
||
<div>This tests that cookies set on the main document are used when accessing resources in the manifest.</div> | ||
<div id="result">Not run yet</div> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText() | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function dynamicScriptLoad() { | ||
var script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.src = "./resources/cookie-protected-script.php"; | ||
document.getElementsByTagName("head")[0].appendChild(script); | ||
} | ||
|
||
function cached() | ||
{ | ||
setTimeout("dynamicScriptLoad();", 0); | ||
} | ||
|
||
applicationCache.addEventListener('cached', cached, false); | ||
</script> | ||
</html> |
18 changes: 18 additions & 0 deletions
18
LayoutTests/http/tests/appcache/resources/cookie-protected-script.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
header("Content-type:application/javascript"); | ||
|
||
if (isset($_COOKIE["foo"])) { | ||
echo "var cookieVal = '" . $_COOKIE["foo"] . "';"; | ||
} else { | ||
echo "var cookieVal = '<null>';"; | ||
} | ||
|
||
?> | ||
|
||
if (cookieVal == "bar") | ||
document.getElementById("result").innerHTML = "PASSED: Cookie is set to 'bar'"; | ||
else | ||
document.getElementById("result").innerHTML = "FAILED: Cookie should be 'bar', is set to '" + cookieVal + "'"; | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); |
4 changes: 4 additions & 0 deletions
4
LayoutTests/http/tests/appcache/resources/document-cookie.manifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CACHE MANIFEST | ||
/appcache/resources/cookie-protected-script.php | ||
NETWORK: | ||
/favicon.ico |