Diff
Modified: tags/Safari-603.1.9/Source/WebCore/ChangeLog (207305 => 207306)
--- tags/Safari-603.1.9/Source/WebCore/ChangeLog 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Source/WebCore/ChangeLog 2016-10-13 21:07:57 UTC (rev 207306)
@@ -1,5 +1,21 @@
2016-10-13 Matthew Hanson <matthew_han...@apple.com>
+ Merge r207301. rdar://problem/28756748
+
+ 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 Matthew Hanson <matthew_han...@apple.com>
+
Merge r207297. rdar://problem/28756748
2016-10-13 Alex Christensen <achristen...@webkit.org>
Modified: tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp (207305 => 207306)
--- tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp 2016-10-13 21:07:57 UTC (rev 207306)
@@ -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: tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h (207305 => 207306)
--- tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h 2016-10-13 21:07:57 UTC (rev 207306)
@@ -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: tags/Safari-603.1.9/Tools/ChangeLog (207305 => 207306)
--- tags/Safari-603.1.9/Tools/ChangeLog 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Tools/ChangeLog 2016-10-13 21:07:57 UTC (rev 207306)
@@ -1,5 +1,21 @@
2016-10-13 Matthew Hanson <matthew_han...@apple.com>
+ Merge r207301. rdar://problem/28756748
+
+ 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 Matthew Hanson <matthew_han...@apple.com>
+
Merge r207297. rdar://problem/28756748
2016-10-13 Alex Christensen <achristen...@webkit.org>
Modified: tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm (207305 => 207306)
--- tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-10-13 21:07:57 UTC (rev 207306)
@@ -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: tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm (207305 => 207306)
--- tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm 2016-10-13 21:07:57 UTC (rev 207306)
@@ -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: tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm (207305 => 207306)
--- tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm 2016-10-13 21:01:58 UTC (rev 207305)
+++ tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm 2016-10-13 21:07:57 UTC (rev 207306)
@@ -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();