Title: [223446] trunk/Source/WebCore
Revision
223446
Author
commit-qu...@webkit.org
Date
2017-10-16 16:29:36 -0700 (Mon, 16 Oct 2017)

Log Message

Allow modern decoding of URLs
https://bugs.webkit.org/show_bug.cgi?id=178265

Patch by Alex Christensen <achristen...@webkit.org> on 2017-10-16
Reviewed by Chris Dumez.

* platform/URL.h:
(WebCore::URL::decode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223445 => 223446)


--- trunk/Source/WebCore/ChangeLog	2017-10-16 23:10:00 UTC (rev 223445)
+++ trunk/Source/WebCore/ChangeLog	2017-10-16 23:29:36 UTC (rev 223446)
@@ -1,3 +1,13 @@
+2017-10-16  Alex Christensen  <achristen...@webkit.org>
+
+        Allow modern decoding of URLs
+        https://bugs.webkit.org/show_bug.cgi?id=178265
+
+        Reviewed by Chris Dumez.
+
+        * platform/URL.h:
+        (WebCore::URL::decode):
+
 2017-10-16  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, rolling out r223425.

Modified: trunk/Source/WebCore/platform/URL.h (223445 => 223446)


--- trunk/Source/WebCore/platform/URL.h	2017-10-16 23:10:00 UTC (rev 223445)
+++ trunk/Source/WebCore/platform/URL.h	2017-10-16 23:29:36 UTC (rev 223446)
@@ -205,6 +205,7 @@
 
     template <class Encoder> void encode(Encoder&) const;
     template <class Decoder> static bool decode(Decoder&, URL&);
+    template <class Decoder> static std::optional<URL> decode(Decoder&);
 
     String serialize(bool omitFragment = false) const;
 
@@ -261,37 +262,48 @@
 template <class Decoder>
 bool URL::decode(Decoder& decoder, URL& url)
 {
+    auto optionalURL = URL::decode(decoder);
+    if (!optionalURL)
+        return false;
+    url = ""
+    return true;
+}
+
+template <class Decoder>
+std::optional<URL> URL::decode(Decoder& decoder)
+{
+    URL url;
     if (!decoder.decode(url.m_string))
-        return false;
+        return std::nullopt;
     bool isValid;
     if (!decoder.decode(isValid))
-        return false;
+        return std::nullopt;
     url.m_isValid = isValid;
     if (!isValid)
-        return true;
+        return WTFMove(url);
     bool protocolIsInHTTPFamily;
     if (!decoder.decode(protocolIsInHTTPFamily))
-        return false;
+        return std::nullopt;
     url.m_protocolIsInHTTPFamily = protocolIsInHTTPFamily;
     if (!decoder.decode(url.m_schemeEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_userStart))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_userEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_passwordEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_hostEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_portEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_pathAfterLastSlash))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_pathEnd))
-        return false;
+        return std::nullopt;
     if (!decoder.decode(url.m_queryEnd))
-        return false;
-    return true;
+        return std::nullopt;
+    return WTFMove(url);
 }
 
 bool operator==(const URL&, const URL&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to