Title: [190433] branches/safari-601.2.7-branch

Diff

Modified: branches/safari-601.2.7-branch/LayoutTests/ChangeLog (190432 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/ChangeLog	2015-10-01 21:37:23 UTC (rev 190432)
+++ branches/safari-601.2.7-branch/LayoutTests/ChangeLog	2015-10-01 21:40:24 UTC (rev 190433)
@@ -1,3 +1,22 @@
+2015-10-01  Babak Shafiei  <bshaf...@apple.com>
+
+        Merge r190418.
+
+    2015-10-01  Antti Koivisto  <an...@apple.com>
+
+            Network cache: Subresource referer header wrong after cached redirect
+            https://bugs.webkit.org/show_bug.cgi?id=149709
+            rdar://problem/22917174
+
+            Reviewed by Chris Dumez.
+
+            * http/tests/cache/redirect-referer-expected.html: Added.
+            * http/tests/cache/redirect-referer.html: Added.
+            * http/tests/cache/resources/load-and-check-referer.php: Added.
+            * http/tests/cache/resources/permanent-redirect.php: Added.
+            * http/tests/cache/resources/redirect-referer-iframe.html: Added.
+            * http/tests/cache/resources/redirect-referer-iframe-expected.html: Added.
+
 2015-09-12  Alexey Proskuryakov  <a...@apple.com>
 
         Re-add Mavericks result with the correct path.

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer-expected.html (from rev 190418, trunk/LayoutTests/http/tests/cache/redirect-referer-expected.html) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer-expected.html	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer-expected.html	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1,2 @@
+<iframe src=""
+<iframe src=""

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer.html (from rev 190418, trunk/LayoutTests/http/tests/cache/redirect-referer.html) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer.html	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/redirect-referer.html	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1,17 @@
+<body>
+<script>
+var rnd = Math.floor(Math.random() * 1000000000000000);
+var iframeSrc = "resources/permanent-redirect.php?location=redirect-referer-iframe.html&rnd=" + rnd;
+
+var iframe = document.createElement("iframe");
+iframe.src = ""
+iframe._onload_ = function () {
+    if (window.internals)
+        internals.clearMemoryCache();
+    var iframe = document.createElement("iframe");
+    iframe.src = ""
+    document.body.appendChild(iframe);
+}
+document.body.appendChild(iframe);
+
+</script>

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/load-and-check-referer.php (from rev 190418, trunk/LayoutTests/http/tests/cache/resources/load-and-check-referer.php) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/load-and-check-referer.php	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/load-and-check-referer.php	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1,40 @@
+<?
+function contentType($path)
+{
+    if (preg_match("/\.html$/", $path))
+        return "text/html";
+    if (preg_match("/\.manifest$/", $path))
+        return "text/cache-manifest";
+    if (preg_match("/\.js$/", $path))
+        return "text/_javascript_";
+    if (preg_match("/\.xml$/", $path))
+        return "application/xml";
+    if (preg_match("/\.xhtml$/", $path))
+        return "application/xhtml+xml";
+    if (preg_match("/\.svg$/", $path))
+        return "application/svg+xml";
+    if (preg_match("/\.xsl$/", $path))
+        return "application/xslt+xml";
+    if (preg_match("/\.gif$/", $path))
+        return "image/gif";
+    if (preg_match("/\.jpg$/", $path))
+        return "image/jpeg";
+    if (preg_match("/\.png$/", $path))
+        return "image/png";
+    return "text/plain";
+}
+
+$path = $_GET['path'];
+$expectedReferer = $_GET['expected-referer'];
+$referer = $_SERVER["HTTP_REFERER"];
+
+if ($expectedReferer == $referer && file_exists($path)) {
+    header('HTTP/1.1 200 OK');
+    header("Cache-control: no-store");
+    header("Content-Type: " . contentType($path));
+    print file_get_contents($path);
+} else {
+    header('HTTP/1.1 404 Not Found');
+}
+
+?>

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/permanent-redirect.php (from rev 190418, trunk/LayoutTests/http/tests/cache/resources/permanent-redirect.php) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/permanent-redirect.php	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/permanent-redirect.php	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1,6 @@
+<?
+$location = $_GET['location'];
+
+header('HTTP/1.1 301 Permanent Redirect');
+header('Location:' . $location);
+?>

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe-expected.html (from rev 190418, trunk/LayoutTests/http/tests/cache/resources/redirect-referer-iframe-expected.html) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe-expected.html	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe-expected.html	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1 @@
+<img src=""

Copied: branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe.html (from rev 190418, trunk/LayoutTests/http/tests/cache/resources/redirect-referer-iframe.html) (0 => 190433)


--- branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe.html	                        (rev 0)
+++ branches/safari-601.2.7-branch/LayoutTests/http/tests/cache/resources/redirect-referer-iframe.html	2015-10-01 21:40:24 UTC (rev 190433)
@@ -0,0 +1 @@
+<img src=""

Modified: branches/safari-601.2.7-branch/Source/WebKit2/ChangeLog (190432 => 190433)


--- branches/safari-601.2.7-branch/Source/WebKit2/ChangeLog	2015-10-01 21:37:23 UTC (rev 190432)
+++ branches/safari-601.2.7-branch/Source/WebKit2/ChangeLog	2015-10-01 21:40:24 UTC (rev 190433)
@@ -1,3 +1,24 @@
+2015-10-01  Babak Shafiei  <bshaf...@apple.com>
+
+        Merge r190418.
+
+    2015-10-01  Antti Koivisto  <an...@apple.com>
+
+            Network cache: Subresource referer header wrong after cached redirect
+            https://bugs.webkit.org/show_bug.cgi?id=149709
+            rdar://problem/22917174
+
+            Reviewed by Chris Dumez.
+
+            If a main resource is loaded from a cache entry that involved redirects the document
+            will end up setting the Referer-headers of the subresources to the request URL not the redirected URL
+
+            * NetworkProcess/NetworkResourceLoader.cpp:
+            (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
+
+                If a cache entry involved a redirect synthesize a minimal willSendRequest message so that WebCore side
+                runs through the same code paths as when receiving a redirect from network.
+
 2015-08-17  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r188365. rdar://problem/22254920

Modified: branches/safari-601.2.7-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (190432 => 190433)


--- branches/safari-601.2.7-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2015-10-01 21:37:23 UTC (rev 190432)
+++ branches/safari-601.2.7-branch/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2015-10-01 21:40:24 UTC (rev 190433)
@@ -554,6 +554,14 @@
         m_synchronousLoadData->response = entry->response();
         sendReplyToSynchronousRequest(*m_synchronousLoadData, entry->buffer());
     } else {
+        if (entry->response().url() != originalRequest().url()) {
+            // This is a cached redirect. Synthesize a minimal redirect so we get things like referer header right.
+            // FIXME: We should cache the actual redirects.
+            ResourceRequest syntheticRedirectRequest(entry->response().url());
+            ResourceResponse syntheticRedirectResponse(originalRequest().url(), { }, 0, { });
+            sendAbortingOnFailure(Messages::WebResourceLoader::WillSendRequest(syntheticRedirectRequest, syntheticRedirectResponse));
+        }
+
         bool needsContinueDidReceiveResponseMessage = originalRequest().requester() == ResourceRequest::Requester::Main;
         sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry->response(), needsContinueDidReceiveResponseMessage));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to