Title: [207304] tags/Safari-603.1.9

Diff

Modified: tags/Safari-603.1.9/Source/WebCore/ChangeLog (207303 => 207304)


--- tags/Safari-603.1.9/Source/WebCore/ChangeLog	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Source/WebCore/ChangeLog	2016-10-13 20:03:45 UTC (rev 207304)
@@ -1,5 +1,29 @@
 2016-10-13  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r207297. rdar://problem/28756748
+
+    2016-10-13  Alex Christensen  <achristen...@webkit.org>
+
+            Disable URLParser for non-Safari iOS and Mac apps for now
+            https://bugs.webkit.org/show_bug.cgi?id=163397
+
+            Reviewed by Tim Horton.
+
+            r207268 was an awful hack, and it was insufficient.
+            Disable the URLParser for other apps for now.  Hopefully we can enable it everywhere soon.
+
+            No change in behavior for testing infrastructure.
+            Old URLs were well tested before making the switch, and nothing has changed for them.
+
+            * platform/URLParser.cpp:
+            (WebCore::URLParser::parse):
+            (WebCore::URLParser::parseHostAndPort):
+            (WebCore::URLParser::setEnabled):
+            (WebCore::URLParser::enabled):
+            * platform/URLParser.h:
+
+2016-10-13  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r207268. rdar://problem/28756748
 
     2016-10-12  Alex Christensen  <achristen...@webkit.org>

Modified: tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp (207303 => 207304)


--- tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp	2016-10-13 20:03:45 UTC (rev 207304)
@@ -1128,12 +1128,6 @@
 template<typename CharacterType>
 void URLParser::parse(const CharacterType* input, const unsigned length, const URL& base, const TextEncoding& encoding)
 {
-#if PLATFORM(MAC)
-    static bool isMail = MacApplication::isAppleMail();
-#else
-    static bool isMail = false;
-#endif
-    
     URL_PARSER_LOG("Parsing URL <%s> base <%s> encoding <%s>", String(input, length).utf8().data(), base.string().utf8().data(), encoding.name());
     m_url = { };
     ASSERT(m_asciiBuffer.isEmpty());
@@ -1460,7 +1454,7 @@
                     } else {
                         m_url.m_userEnd = currentPosition(authorityOrHostBegin);
                         m_url.m_passwordEnd = m_url.m_userEnd;
-                        if (!parseHostAndPort(iterator, isMail)) {
+                        if (!parseHostAndPort(iterator)) {
                             failure();
                             return;
                         }
@@ -1482,7 +1476,7 @@
             do {
                 LOG_STATE("Host");
                 if (*c == '/' || *c == '?' || *c == '#') {
-                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
+                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
                         failure();
                         return;
                     }
@@ -1653,7 +1647,7 @@
                         state = State::Path;
                         break;
                     }
-                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
+                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
                         failure();
                         return;
                     }
@@ -1873,16 +1867,13 @@
             m_url.m_hostEnd = m_url.m_userStart;
             m_url.m_portEnd = m_url.m_userStart;
             m_url.m_pathEnd = m_url.m_userStart + 2;
-        } else if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
+        } else if (!parseHostAndPort(authorityOrHostBegin)) {
             failure();
             return;
         } else {
-            if (LIKELY(!isMail || m_urlIsSpecial)) {
-                syntaxViolation(c);
-                appendToASCIIBuffer('/');
-                m_url.m_pathEnd = m_url.m_portEnd + 1;
-            } else
-                m_url.m_pathEnd = m_url.m_portEnd;
+            syntaxViolation(c);
+            appendToASCIIBuffer('/');
+            m_url.m_pathEnd = m_url.m_portEnd + 1;
         }
         m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
         m_url.m_queryEnd = m_url.m_pathEnd;
@@ -1890,16 +1881,13 @@
         break;
     case State::Host:
         LOG_FINAL_STATE("Host");
-        if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
+        if (!parseHostAndPort(authorityOrHostBegin)) {
             failure();
             return;
         }
-        if (LIKELY(!isMail || m_urlIsSpecial)) {
-            syntaxViolation(c);
-            appendToASCIIBuffer('/');
-            m_url.m_pathEnd = m_url.m_portEnd + 1;
-        } else
-            m_url.m_pathEnd = m_url.m_portEnd;
+        syntaxViolation(c);
+        appendToASCIIBuffer('/');
+        m_url.m_pathEnd = m_url.m_portEnd + 1;
         m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
         m_url.m_queryEnd = m_url.m_pathEnd;
         m_url.m_fragmentEnd = m_url.m_pathEnd;
@@ -1953,7 +1941,7 @@
             break;
         }
 
-        if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
+        if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
             failure();
             return;
         }
@@ -2568,7 +2556,7 @@
 }
 
 template<typename CharacterType>
-bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator, const bool& isMail)
+bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator)
 {
     if (iterator.atEnd())
         return false;
@@ -2618,13 +2606,9 @@
         }
         for (; hostIterator != iterator; ++hostIterator) {
             if (LIKELY(!isTabOrNewline(*hostIterator))) {
-                if (UNLIKELY(isMail && !m_urlIsSpecial))
-                    appendToASCIIBuffer(*hostIterator);
-                else {
-                    if (UNLIKELY(isASCIIUpper(*hostIterator)))
-                        syntaxViolation(hostIterator);
-                    appendToASCIIBuffer(toASCIILower(*hostIterator));
-                }
+                if (UNLIKELY(isASCIIUpper(*hostIterator)))
+                    syntaxViolation(hostIterator);
+                appendToASCIIBuffer(toASCIILower(*hostIterator));
             } else
                 syntaxViolation(hostIterator);
         }
@@ -2803,16 +2787,31 @@
     // It should be able to be deduced from m_isValid and m_string.length() to save memory.
 }
 
-static bool urlParserEnabled = true;
+enum class URLParserEnabled {
+    Undetermined,
+    Yes,
+    No
+};
 
+static URLParserEnabled urlParserEnabled = URLParserEnabled::Undetermined;
+
 void URLParser::setEnabled(bool enabled)
 {
-    urlParserEnabled = enabled;
+    urlParserEnabled = enabled ? URLParserEnabled::Yes : URLParserEnabled::No;
 }
 
 bool URLParser::enabled()
 {
-    return urlParserEnabled;
+    if (urlParserEnabled == URLParserEnabled::Undetermined) {
+#if PLATFORM(MAC)
+        urlParserEnabled = MacApplication::isSafari() ? URLParserEnabled::Yes : URLParserEnabled::No;
+#elif PLATFORM(IOS)
+        urlParserEnabled = IOSApplication::isMobileSafari() ? URLParserEnabled::Yes : URLParserEnabled::No;
+#else
+        urlParserEnabled = URLParserEnabled::Yes;
+#endif
+    }
+    return urlParserEnabled == URLParserEnabled::Yes;
 }
 
 } // namespace WebCore

Modified: tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h (207303 => 207304)


--- tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h	2016-10-13 20:03:45 UTC (rev 207304)
@@ -60,7 +60,7 @@
 
     template<typename CharacterType> void parse(const CharacterType*, const unsigned length, const URL&, const TextEncoding&);
     template<typename CharacterType> void parseAuthority(CodePointIterator<CharacterType>);
-    template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>, const bool& isMail);
+    template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>);
     template<typename CharacterType> bool parsePort(CodePointIterator<CharacterType>&);
 
     void failure();

Modified: tags/Safari-603.1.9/Tools/ChangeLog (207303 => 207304)


--- tags/Safari-603.1.9/Tools/ChangeLog	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Tools/ChangeLog	2016-10-13 20:03:45 UTC (rev 207304)
@@ -1,3 +1,21 @@
+2016-10-13  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r207297. rdar://problem/28756748
+
+    2016-10-13  Alex Christensen  <achristen...@webkit.org>
+
+            Disable URLParser for non-Safari iOS and Mac apps for now
+            https://bugs.webkit.org/show_bug.cgi?id=163397
+
+            Reviewed by Tim Horton.
+
+            * DumpRenderTree/mac/DumpRenderTree.mm:
+            (DumpRenderTreeMain):
+            * WebKitTestRunner/ios/mainIOS.mm:
+            (main):
+            * WebKitTestRunner/mac/main.mm:
+            (main):
+
 2016-10-11  Sam Weinig  <s...@webkit.org>
 
         Optional's move-constructor and move-assignment operator don't disengage the value being moved from

Modified: tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm (207303 => 207304)


--- tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-10-13 20:03:45 UTC (rev 207304)
@@ -58,6 +58,7 @@
 #import <CoreFoundation/CoreFoundation.h>
 #import <_javascript_Core/TestRunnerUtils.h>
 #import <WebCore/LogInitialization.h>
+#import <WebCore/URLParser.h>
 #import <WebKit/DOMElement.h>
 #import <WebKit/DOMExtensions.h>
 #import <WebKit/DOMRange.h>
@@ -1409,6 +1410,7 @@
 
 int DumpRenderTreeMain(int argc, const char *argv[])
 {
+    WebCore::URLParser::setEnabled(true);
     atexit(atexitFunction);
 
 #if PLATFORM(IOS)

Modified: tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm (207303 => 207304)


--- tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm	2016-10-13 20:03:45 UTC (rev 207304)
@@ -29,6 +29,7 @@
 #import "TestController.h"
 #import "UIKitSPI.h"
 #import <UIKit/UIKit.h>
+#import <WebCore/URLParser.h>
 
 static int _argc;
 static const char **_argv;
@@ -64,6 +65,7 @@
 
 int main(int argc, const char* argv[])
 {
+    WebCore::URLParser::setEnabled(true);
     _argc = argc;
     _argv = argv;
 

Modified: tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm (207303 => 207304)


--- tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm	2016-10-13 20:03:39 UTC (rev 207303)
+++ tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm	2016-10-13 20:03:45 UTC (rev 207304)
@@ -29,6 +29,7 @@
 
 #import "PlatformWebView.h"
 #import "TestController.h"
+#import <WebCore/URLParser.h>
 
 static void setDefaultsToConsistentValuesForTesting()
 {
@@ -55,6 +56,7 @@
 
 int main(int argc, const char* argv[])
 {
+    WebCore::URLParser::setEnabled(true);
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     [NSApplication sharedApplication];
     setDefaultsToConsistentValuesForTesting();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to