Title: [197984] trunk
Revision
197984
Author
jiewen_...@apple.com
Date
2016-03-10 18:58:47 -0800 (Thu, 10 Mar 2016)

Log Message

WebKit should not be redirected to an invalid URL
https://bugs.webkit.org/show_bug.cgi?id=155263
<rdar://problem/22820172>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/navigation/redirect-to-invalid-url.html

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):

LayoutTests:

* http/tests/navigation/redirect-to-invalid-url-expected.txt: Added.
* http/tests/navigation/redirect-to-invalid-url.html: Added.
* http/tests/navigation/resources/redirect-to-invalid-url-frame.php: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197983 => 197984)


--- trunk/LayoutTests/ChangeLog	2016-03-11 02:46:03 UTC (rev 197983)
+++ trunk/LayoutTests/ChangeLog	2016-03-11 02:58:47 UTC (rev 197984)
@@ -1,3 +1,15 @@
+2016-03-10  Jiewen Tan  <jiewen_...@apple.com>
+
+        WebKit should not be redirected to an invalid URL
+        https://bugs.webkit.org/show_bug.cgi?id=155263
+        <rdar://problem/22820172>
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/navigation/redirect-to-invalid-url-expected.txt: Added.
+        * http/tests/navigation/redirect-to-invalid-url.html: Added.
+        * http/tests/navigation/resources/redirect-to-invalid-url-frame.php: Added.
+
 2016-03-10  Nan Wang  <n_w...@apple.com>
 
         AX: Implement bounds/position and index related text marker functions using TextIterator

Added: trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url-expected.txt (0 => 197984)


--- trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url-expected.txt	2016-03-11 02:58:47 UTC (rev 197984)
@@ -0,0 +1,6 @@
+http://127.0.0.1:8000/navigation/resources/redirect-to-invalid-url-frame.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/navigation/resources/redirect-to-invalid-url-frame.php, main document URL http://127.0.0.1:8000/navigation/redirect-to-invalid-url.html, http method GET> redirectResponse (null)
+http://127.0.0.1:8000/navigation/redirect-to-invalid-url.html - didFinishLoading
+http://127.0.0.1:8000/navigation/resources/redirect-to-invalid-url-frame.php - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -999, failing URL "http://127.0.0.1:8000/navigation/resources/redirect-to-invalid-url-frame.php">
+Test passes if WebKit doesn't request the redirected URL.
+
+

Added: trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url.html (0 => 197984)


--- trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/redirect-to-invalid-url.html	2016-03-11 02:58:47 UTC (rev 197984)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadCallbacks();
+        testRunner.waitUntilDone();
+    }
+
+    _onload_ = function() {
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+</script>
+</head>
+<body>
+    <p>Test passes if WebKit doesn't request the redirected URL.</p>
+    <iframe src=""
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/navigation/resources/redirect-to-invalid-url-frame.php (0 => 197984)


--- trunk/LayoutTests/http/tests/navigation/resources/redirect-to-invalid-url-frame.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/redirect-to-invalid-url-frame.php	2016-03-11 02:58:47 UTC (rev 197984)
@@ -0,0 +1,4 @@
+<?php
+header('Location: http://localhost:xyz/none-existed.html');
+?>
+

Modified: trunk/Source/WebCore/ChangeLog (197983 => 197984)


--- trunk/Source/WebCore/ChangeLog	2016-03-11 02:46:03 UTC (rev 197983)
+++ trunk/Source/WebCore/ChangeLog	2016-03-11 02:58:47 UTC (rev 197984)
@@ -1,3 +1,16 @@
+2016-03-10  Jiewen Tan  <jiewen_...@apple.com>
+
+        WebKit should not be redirected to an invalid URL
+        https://bugs.webkit.org/show_bug.cgi?id=155263
+        <rdar://problem/22820172>
+
+        Reviewed by Brent Fulgham.
+
+        Test: http/tests/navigation/redirect-to-invalid-url.html
+
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequestInternal):
+
 2016-03-10  Nan Wang  <n_w...@apple.com>
 
         AX: Implement bounds/position and index related text marker functions using TextIterator

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (197983 => 197984)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2016-03-11 02:46:03 UTC (rev 197983)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2016-03-11 02:58:47 UTC (rev 197984)
@@ -160,6 +160,11 @@
     URL previousURL = request().url();
     Ref<SubresourceLoader> protect(*this);
 
+    if (!newRequest.url().isValid()) {
+        cancel();
+        return;
+    }
+
     ASSERT(!newRequest.isNull());
     if (!redirectResponse.isNull()) {
         // CachedResources are keyed off their original request URL.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to