Title: [205846] trunk
Revision
205846
Author
achristen...@apple.com
Date
2016-09-12 18:25:08 -0700 (Mon, 12 Sep 2016)

Log Message

URLParser: Correctly ignore spaces before relative URLs with no scheme
https://bugs.webkit.org/show_bug.cgi?id=161889

Reviewed by Daniel Bates.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (205845 => 205846)


--- trunk/Source/WebCore/ChangeLog	2016-09-13 00:58:22 UTC (rev 205845)
+++ trunk/Source/WebCore/ChangeLog	2016-09-13 01:25:08 UTC (rev 205846)
@@ -1,3 +1,15 @@
+2016-09-12  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser: Correctly ignore spaces before relative URLs with no scheme
+        https://bugs.webkit.org/show_bug.cgi?id=161889
+
+        Reviewed by Daniel Bates.
+
+        Covered by new API tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
 2016-09-12  Nan Wang  <n_w...@apple.com>
 
         AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23

Modified: trunk/Source/WebCore/platform/URLParser.cpp (205845 => 205846)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-13 00:58:22 UTC (rev 205845)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-13 01:25:08 UTC (rev 205846)
@@ -490,6 +490,7 @@
     auto authorityOrHostBegin = codePoints.begin();
     while (c != end && isC0ControlOrSpace(*c))
         ++c;
+    auto beginAfterControlAndSpace = c;
     
     enum class State : uint8_t {
         SchemeStart,
@@ -582,7 +583,7 @@
             } else {
                 m_buffer.clear();
                 state = State::NoScheme;
-                c = codePoints.begin();
+                c = beginAfterControlAndSpace;
                 break;
             }
             ++c;
@@ -591,7 +592,7 @@
             if (c == end) {
                 m_buffer.clear();
                 state = State::NoScheme;
-                c = codePoints.begin();
+                c = beginAfterControlAndSpace;
             }
             break;
         case State::NoScheme:

Modified: trunk/Tools/ChangeLog (205845 => 205846)


--- trunk/Tools/ChangeLog	2016-09-13 00:58:22 UTC (rev 205845)
+++ trunk/Tools/ChangeLog	2016-09-13 01:25:08 UTC (rev 205846)
@@ -1,5 +1,15 @@
 2016-09-12  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser: Correctly ignore spaces before relative URLs with no scheme
+        https://bugs.webkit.org/show_bug.cgi?id=161889
+
+        Reviewed by Daniel Bates.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2016-09-12  Alex Christensen  <achristen...@webkit.org>
+
         URLParser: Fix relative URLs containing only fragments
         https://bugs.webkit.org/show_bug.cgi?id=161882
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (205845 => 205846)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-13 00:58:22 UTC (rev 205845)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-13 01:25:08 UTC (rev 205846)
@@ -277,6 +277,8 @@
     checkRelativeURL("http:", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar"});
     checkRelativeURL("#x", "data:,", {"data", "", "", "", 0, ",", "", "x", "data:,#x"});
     checkRelativeURL("#x", "about:blank", {"about", "", "", "", 0, "blank", "", "x", "about:blank#x"});
+    checkRelativeURL("  foo.com  ", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/foo.com", "", "", "http://example.org/foo/foo.com"});
+    checkRelativeURL(" \a baz", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/baz", "", "", "http://example.org/foo/baz"});
     
     // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
     // but it is included in the web platform tests.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to