Title: [207301] trunk
Revision
207301
Author
ryanhad...@apple.com
Date
2016-10-13 12:21:35 -0700 (Thu, 13 Oct 2016)

Log Message

Unreviewed, rolling out r207297.

This change broke the iOS build.

Reverted changeset:

"Disable URLParser for non-Safari iOS and Mac apps for now"
https://bugs.webkit.org/show_bug.cgi?id=163397
http://trac.webkit.org/changeset/207297

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207300 => 207301)


--- trunk/Source/WebCore/ChangeLog	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Source/WebCore/ChangeLog	2016-10-13 19:21:35 UTC (rev 207301)
@@ -1,3 +1,15 @@
+2016-10-13  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r207297.
+
+        This change broke the iOS build.
+
+        Reverted changeset:
+
+        "Disable URLParser for non-Safari iOS and Mac apps for now"
+        https://bugs.webkit.org/show_bug.cgi?id=163397
+        http://trac.webkit.org/changeset/207297
+
 2016-10-13  Anders Carlsson  <ander...@apple.com>
 
         Get rid of the HistoryItemVector typedef

Modified: trunk/Source/WebCore/platform/URLParser.cpp (207300 => 207301)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-10-13 19:21:35 UTC (rev 207301)
@@ -1128,6 +1128,12 @@
 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());
@@ -1454,7 +1460,7 @@
                     } else {
                         m_url.m_userEnd = currentPosition(authorityOrHostBegin);
                         m_url.m_passwordEnd = m_url.m_userEnd;
-                        if (!parseHostAndPort(iterator)) {
+                        if (!parseHostAndPort(iterator, isMail)) {
                             failure();
                             return;
                         }
@@ -1476,7 +1482,7 @@
             do {
                 LOG_STATE("Host");
                 if (*c == '/' || *c == '?' || *c == '#') {
-                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
+                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
                         failure();
                         return;
                     }
@@ -1647,7 +1653,7 @@
                         state = State::Path;
                         break;
                     }
-                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
+                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
                         failure();
                         return;
                     }
@@ -1867,13 +1873,16 @@
             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)) {
+        } else if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
             failure();
             return;
         } else {
-            syntaxViolation(c);
-            appendToASCIIBuffer('/');
-            m_url.m_pathEnd = m_url.m_portEnd + 1;
+            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;
         }
         m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
         m_url.m_queryEnd = m_url.m_pathEnd;
@@ -1881,13 +1890,16 @@
         break;
     case State::Host:
         LOG_FINAL_STATE("Host");
-        if (!parseHostAndPort(authorityOrHostBegin)) {
+        if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
             failure();
             return;
         }
-        syntaxViolation(c);
-        appendToASCIIBuffer('/');
-        m_url.m_pathEnd = m_url.m_portEnd + 1;
+        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;
         m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
         m_url.m_queryEnd = m_url.m_pathEnd;
         m_url.m_fragmentEnd = m_url.m_pathEnd;
@@ -1941,7 +1953,7 @@
             break;
         }
 
-        if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
+        if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
             failure();
             return;
         }
@@ -2556,7 +2568,7 @@
 }
 
 template<typename CharacterType>
-bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator)
+bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator, const bool& isMail)
 {
     if (iterator.atEnd())
         return false;
@@ -2606,9 +2618,13 @@
         }
         for (; hostIterator != iterator; ++hostIterator) {
             if (LIKELY(!isTabOrNewline(*hostIterator))) {
-                if (UNLIKELY(isASCIIUpper(*hostIterator)))
-                    syntaxViolation(hostIterator);
-                appendToASCIIBuffer(toASCIILower(*hostIterator));
+                if (UNLIKELY(isMail && !m_urlIsSpecial))
+                    appendToASCIIBuffer(*hostIterator);
+                else {
+                    if (UNLIKELY(isASCIIUpper(*hostIterator)))
+                        syntaxViolation(hostIterator);
+                    appendToASCIIBuffer(toASCIILower(*hostIterator));
+                }
             } else
                 syntaxViolation(hostIterator);
         }
@@ -2787,31 +2803,16 @@
     // It should be able to be deduced from m_isValid and m_string.length() to save memory.
 }
 
-enum class URLParserEnabled {
-    Undetermined,
-    Yes,
-    No
-};
+static bool urlParserEnabled = true;
 
-static URLParserEnabled urlParserEnabled = URLParserEnabled::Undetermined;
-
 void URLParser::setEnabled(bool enabled)
 {
-    urlParserEnabled = enabled ? URLParserEnabled::Yes : URLParserEnabled::No;
+    urlParserEnabled = enabled;
 }
 
 bool URLParser::enabled()
 {
-    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;
+    return urlParserEnabled;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/URLParser.h (207300 => 207301)


--- trunk/Source/WebCore/platform/URLParser.h	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Source/WebCore/platform/URLParser.h	2016-10-13 19:21:35 UTC (rev 207301)
@@ -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>);
+    template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>, const bool& isMail);
     template<typename CharacterType> bool parsePort(CodePointIterator<CharacterType>&);
 
     void failure();

Modified: trunk/Tools/ChangeLog (207300 => 207301)


--- trunk/Tools/ChangeLog	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Tools/ChangeLog	2016-10-13 19:21:35 UTC (rev 207301)
@@ -1,3 +1,15 @@
+2016-10-13  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r207297.
+
+        This change broke the iOS build.
+
+        Reverted changeset:
+
+        "Disable URLParser for non-Safari iOS and Mac apps for now"
+        https://bugs.webkit.org/show_bug.cgi?id=163397
+        http://trac.webkit.org/changeset/207297
+
 2016-10-13  Alex Christensen  <achristen...@webkit.org>
 
         Disable URLParser for non-Safari iOS and Mac apps for now

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (207300 => 207301)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-10-13 19:21:35 UTC (rev 207301)
@@ -58,7 +58,6 @@
 #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>
@@ -1410,7 +1409,6 @@
 
 int DumpRenderTreeMain(int argc, const char *argv[])
 {
-    WebCore::URLParser::setEnabled(true);
     atexit(atexitFunction);
 
 #if PLATFORM(IOS)

Modified: trunk/Tools/WebKitTestRunner/ios/mainIOS.mm (207300 => 207301)


--- trunk/Tools/WebKitTestRunner/ios/mainIOS.mm	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Tools/WebKitTestRunner/ios/mainIOS.mm	2016-10-13 19:21:35 UTC (rev 207301)
@@ -29,7 +29,6 @@
 #import "TestController.h"
 #import "UIKitSPI.h"
 #import <UIKit/UIKit.h>
-#import <WebCore/URLParser.h>
 
 static int _argc;
 static const char **_argv;
@@ -65,7 +64,6 @@
 
 int main(int argc, const char* argv[])
 {
-    WebCore::URLParser::setEnabled(true);
     _argc = argc;
     _argv = argv;
 

Modified: trunk/Tools/WebKitTestRunner/mac/main.mm (207300 => 207301)


--- trunk/Tools/WebKitTestRunner/mac/main.mm	2016-10-13 19:15:23 UTC (rev 207300)
+++ trunk/Tools/WebKitTestRunner/mac/main.mm	2016-10-13 19:21:35 UTC (rev 207301)
@@ -29,7 +29,6 @@
 
 #import "PlatformWebView.h"
 #import "TestController.h"
-#import <WebCore/URLParser.h>
 
 static void setDefaultsToConsistentValuesForTesting()
 {
@@ -56,7 +55,6 @@
 
 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