Title: [229733] trunk/LayoutTests
Revision
229733
Author
beid...@apple.com
Date
2018-03-19 19:27:57 -0700 (Mon, 19 Mar 2018)

Log Message

Add a layout test verifying AppCache resource fetches have the document'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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229732 => 229733)


--- trunk/LayoutTests/ChangeLog	2018-03-20 01:56:45 UTC (rev 229732)
+++ trunk/LayoutTests/ChangeLog	2018-03-20 02:27:57 UTC (rev 229733)
@@ -1,3 +1,15 @@
+2018-03-19  Brady Eidson  <beid...@apple.com>
+
+        Add a layout test verifying AppCache resource fetches have the document'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.
+
 2018-03-19  Chris Dumez  <cdu...@apple.com>
 
         Make policy decisions asynchronous

Added: trunk/LayoutTests/http/tests/appcache/document-cookie-expected.txt (0 => 229733)


--- trunk/LayoutTests/http/tests/appcache/document-cookie-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/document-cookie-expected.txt	2018-03-20 02:27:57 UTC (rev 229733)
@@ -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'

Added: trunk/LayoutTests/http/tests/appcache/document-cookie.php (0 => 229733)


--- trunk/LayoutTests/http/tests/appcache/document-cookie.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/document-cookie.php	2018-03-20 02:27:57 UTC (rev 229733)
@@ -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 = "" 
+	document.getElementsByTagName("head")[0].appendChild(script);
+}
+
+function cached()
+{
+	setTimeout("dynamicScriptLoad();", 0);
+}
+
+applicationCache.addEventListener('cached', cached, false);
+</script>
+</html>

Added: trunk/LayoutTests/http/tests/appcache/resources/cookie-protected-script.php (0 => 229733)


--- trunk/LayoutTests/http/tests/appcache/resources/cookie-protected-script.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/cookie-protected-script.php	2018-03-20 02:27:57 UTC (rev 229733)
@@ -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();

Added: trunk/LayoutTests/http/tests/appcache/resources/document-cookie.manifest (0 => 229733)


--- trunk/LayoutTests/http/tests/appcache/resources/document-cookie.manifest	                        (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/document-cookie.manifest	2018-03-20 02:27:57 UTC (rev 229733)
@@ -0,0 +1,4 @@
+CACHE MANIFEST
+/appcache/resources/cookie-protected-script.php
+NETWORK:
+/favicon.ico
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to