Title: [205147] trunk
Revision
205147
Author
achristen...@apple.com
Date
2016-08-29 14:15:27 -0700 (Mon, 29 Aug 2016)

Log Message

URLParser should parse about:blank
https://bugs.webkit.org/show_bug.cgi?id=161324

Reviewed by Brady Eidson.

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 (205146 => 205147)


--- trunk/Source/WebCore/ChangeLog	2016-08-29 21:12:29 UTC (rev 205146)
+++ trunk/Source/WebCore/ChangeLog	2016-08-29 21:15:27 UTC (rev 205147)
@@ -1,3 +1,15 @@
+2016-08-29  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser should parse about:blank
+        https://bugs.webkit.org/show_bug.cgi?id=161324
+
+        Reviewed by Brady Eidson.
+
+        Covered by new API tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
 2016-08-29  Chris Dumez  <cdu...@apple.com>
 
         document.createEvent("popstateevent") should create a PopStateEvent

Modified: trunk/Source/WebCore/platform/URLParser.cpp (205146 => 205147)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-08-29 21:12:29 UTC (rev 205146)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-08-29 21:15:27 UTC (rev 205147)
@@ -220,8 +220,15 @@
                 m_buffer.append('/');
                 state = State::PathOrAuthority;
                 ++c;
-            } else
+            } else {
+                m_url.m_userStart = m_buffer.length();
+                m_url.m_userEnd = m_url.m_userStart;
+                m_url.m_passwordEnd = m_url.m_userStart;
+                m_url.m_hostEnd = m_url.m_userStart;
+                m_url.m_portEnd = m_url.m_userStart;
+                m_url.m_pathAfterLastSlash = m_url.m_userStart,
                 state = State::CannotBeABaseURLPath;
+            }
             break;
         case State::NoScheme:
             LOG_STATE("NoScheme");
@@ -404,8 +411,17 @@
             break;
         case State::CannotBeABaseURLPath:
             LOG_STATE("CannotBeABaseURLPath");
-            notImplemented();
-            ++c;
+            if (*c == '?') {
+                m_url.m_pathEnd = m_buffer.length();
+                state = State::Query;
+            } else if (*c == '#') {
+                m_url.m_pathEnd = m_buffer.length();
+                m_url.m_queryEnd = m_url.m_pathEnd;
+                state = State::Fragment;
+            } else {
+                m_buffer.append(*c);
+                ++c;
+            }
             break;
         case State::Query:
             LOG_STATE("Query");
@@ -492,6 +508,9 @@
         break;
     case State::CannotBeABaseURLPath:
         LOG_FINAL_STATE("CannotBeABaseURLPath");
+        m_url.m_pathEnd = m_buffer.length();
+        m_url.m_queryEnd = m_url.m_pathEnd;
+        m_url.m_fragmentEnd = m_url.m_pathEnd;
         break;
     case State::Query:
         LOG_FINAL_STATE("Query");

Modified: trunk/Tools/ChangeLog (205146 => 205147)


--- trunk/Tools/ChangeLog	2016-08-29 21:12:29 UTC (rev 205146)
+++ trunk/Tools/ChangeLog	2016-08-29 21:15:27 UTC (rev 205147)
@@ -1,3 +1,13 @@
+2016-08-29  Alex Christensen  <achristen...@webkit.org>
+
+        URLParser should parse about:blank
+        https://bugs.webkit.org/show_bug.cgi?id=161324
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2016-08-29  JF Bastien  <jfbast...@apple.com>
 
         Bug 161165 - check-webkit-style doesn't understand macros containing `else` or labels

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (205146 => 205147)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-08-29 21:12:29 UTC (rev 205146)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-08-29 21:15:27 UTC (rev 205147)
@@ -91,7 +91,9 @@
     checkURL("http://127.0.0.1", {"http", "", "", "127.0.0.1", 0, "/", "", "", "http://127.0.0.1/"});
     checkURL("http://webkit.org/", {"http", "", "", "webkit.org", 0, "/", "", "", "http://webkit.org/"});
     checkURL("http://webkit.org/path1/path2/index.html", {"http", "", "", "webkit.org", 0, "/path1/path2/index.html", "", "", "http://webkit.org/path1/path2/index.html"});
-
+    checkURL("about:blank", {"about", "", "", "", 0, "blank", "", "", "about:blank"});
+    checkURL("about:blank?query", {"about", "", "", "", 0, "blank", "query", "", "about:blank?query"});
+    checkURL("about:blank#fragment", {"about", "", "", "", 0, "blank", "", "fragment", "about:blank#fragment"});
 }
 
 static void checkRelativeURL(const String& urlString, const String& baseURLString, const ExpectedParts& parts)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to