Title: [235949] trunk/Source/WebCore
Revision
235949
Author
[email protected]
Date
2018-09-12 14:01:05 -0700 (Wed, 12 Sep 2018)

Log Message

Expose fewer of URL's internal members
https://bugs.webkit.org/show_bug.cgi?id=189528

Patch by Alex Christensen <[email protected]> on 2018-09-12
Reviewed by Chris Dumez.

* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::urlHostHash):
* platform/URL.cpp:
(WebCore::URL::hostStart const):
(WebCore::protocolHostAndPortAreEqual):
(WebCore::hostsAreEqual):
* platform/URL.h:
(WebCore::URL::hostStart const): Deleted.
(WebCore::URL::hostEnd const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235948 => 235949)


--- trunk/Source/WebCore/ChangeLog	2018-09-12 20:59:33 UTC (rev 235948)
+++ trunk/Source/WebCore/ChangeLog	2018-09-12 21:01:05 UTC (rev 235949)
@@ -1,3 +1,20 @@
+2018-09-12  Alex Christensen  <[email protected]>
+
+        Expose fewer of URL's internal members
+        https://bugs.webkit.org/show_bug.cgi?id=189528
+
+        Reviewed by Chris Dumez.
+
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::urlHostHash):
+        * platform/URL.cpp:
+        (WebCore::URL::hostStart const):
+        (WebCore::protocolHostAndPortAreEqual):
+        (WebCore::hostsAreEqual):
+        * platform/URL.h:
+        (WebCore::URL::hostStart const): Deleted.
+        (WebCore::URL::hostEnd const): Deleted.
+
 2018-09-12  Basuke Suzuki  <[email protected]>
 
         [Curl] Implement correct total received bytes.

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (235948 => 235949)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2018-09-12 20:59:33 UTC (rev 235948)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2018-09-12 21:01:05 UTC (rev 235949)
@@ -84,15 +84,10 @@
 
 static unsigned urlHostHash(const URL& url)
 {
-    unsigned hostStart = url.hostStart();
-    unsigned hostEnd = url.hostEnd();
-
-    const String& urlString = url.string();
-
-    if (urlString.is8Bit())
-        return AlreadyHashed::avoidDeletedValue(StringHasher::computeHashAndMaskTop8Bits(urlString.characters8() + hostStart, hostEnd - hostStart));
-    
-    return AlreadyHashed::avoidDeletedValue(StringHasher::computeHashAndMaskTop8Bits(urlString.characters16() + hostStart, hostEnd - hostStart));
+    StringView host = url.host();
+    if (host.is8Bit())
+        return AlreadyHashed::avoidDeletedValue(StringHasher::computeHashAndMaskTop8Bits(host.characters8(), host.length()));
+    return AlreadyHashed::avoidDeletedValue(StringHasher::computeHashAndMaskTop8Bits(host.characters16(), host.length()));
 }
 
 ApplicationCacheGroup* ApplicationCacheStorage::loadCacheGroup(const URL& manifestURL)

Modified: trunk/Source/WebCore/platform/URL.cpp (235948 => 235949)


--- trunk/Source/WebCore/platform/URL.cpp	2018-09-12 20:59:33 UTC (rev 235948)
+++ trunk/Source/WebCore/platform/URL.cpp	2018-09-12 21:01:05 UTC (rev 235949)
@@ -427,7 +427,12 @@
     }
     return false;
 }
-    
+
+unsigned URL::hostStart() const
+{
+    return (m_passwordEnd == m_userStart) ? m_passwordEnd : m_passwordEnd + 1;
+}
+
 void URL::setHost(const String& s)
 {
     if (!m_isValid)
@@ -742,9 +747,9 @@
         return false;
 
     unsigned hostStartA = a.hostStart();
-    unsigned hostLengthA = a.hostEnd() - hostStartA;
+    unsigned hostLengthA = a.m_hostEnd - hostStartA;
     unsigned hostStartB = b.hostStart();
-    unsigned hostLengthB = b.hostEnd() - b.hostStart();
+    unsigned hostLengthB = b.m_hostEnd - b.hostStart();
     if (hostLengthA != hostLengthB)
         return false;
 
@@ -769,9 +774,9 @@
 bool hostsAreEqual(const URL& a, const URL& b)
 {
     unsigned hostStartA = a.hostStart();
-    unsigned hostLengthA = a.hostEnd() - hostStartA;
+    unsigned hostLengthA = a.m_hostEnd - hostStartA;
     unsigned hostStartB = b.hostStart();
-    unsigned hostLengthB = b.hostEnd() - hostStartB;
+    unsigned hostLengthB = b.m_hostEnd - hostStartB;
     if (hostLengthA != hostLengthB)
         return false;
 

Modified: trunk/Source/WebCore/platform/URL.h (235948 => 235949)


--- trunk/Source/WebCore/platform/URL.h	2018-09-12 20:59:33 UTC (rev 235948)
+++ trunk/Source/WebCore/platform/URL.h	2018-09-12 21:01:05 UTC (rev 235949)
@@ -170,13 +170,6 @@
 
     WEBCORE_EXPORT void removeQueryAndFragmentIdentifier();
 
-    WEBCORE_EXPORT friend bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
-
-    WEBCORE_EXPORT friend bool protocolHostAndPortAreEqual(const URL&, const URL&);
-
-    unsigned hostStart() const;
-    unsigned hostEnd() const;
-
     WEBCORE_EXPORT static bool hostIsIPAddress(StringView);
 
     unsigned pathStart() const;
@@ -217,7 +210,12 @@
     static bool protocolIs(const String&, const char*);
     void init(const URL&, const String&, const TextEncoding&);
     void copyToBuffer(Vector<char, 512>& buffer) const;
+    unsigned hostStart() const;
 
+    WEBCORE_EXPORT friend bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
+    WEBCORE_EXPORT friend bool protocolHostAndPortAreEqual(const URL&, const URL&);
+    WEBCORE_EXPORT friend bool hostsAreEqual(const URL&, const URL&);
+
     String m_string;
 
     unsigned m_isValid : 1;
@@ -394,16 +392,6 @@
     return m_protocolIsInHTTPFamily;
 }
 
-inline unsigned URL::hostStart() const
-{
-    return (m_passwordEnd == m_userStart) ? m_passwordEnd : m_passwordEnd + 1;
-}
-
-inline unsigned URL::hostEnd() const
-{
-    return m_hostEnd;
-}
-
 inline unsigned URL::pathStart() const
 {
     return m_hostEnd + m_portLength;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to