Diff
Modified: trunk/Source/WebCore/ChangeLog (207304 => 207305)
--- trunk/Source/WebCore/ChangeLog 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Source/WebCore/ChangeLog 2016-10-13 21:01:58 UTC (rev 207305)
@@ -1,3 +1,23 @@
+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 Chris Dumez <cdu...@apple.com>
Rename [ConstructorTemplate=*] to [LegacyConstructorTemplate=*]
Modified: trunk/Source/WebCore/platform/URLParser.cpp (207304 => 207305)
--- trunk/Source/WebCore/platform/URLParser.cpp 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2016-10-13 21:01:58 UTC (rev 207305)
@@ -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: trunk/Source/WebCore/platform/URLParser.h (207304 => 207305)
--- trunk/Source/WebCore/platform/URLParser.h 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Source/WebCore/platform/URLParser.h 2016-10-13 21:01:58 UTC (rev 207305)
@@ -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: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (207304 => 207305)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2016-10-13 21:01:58 UTC (rev 207305)
@@ -35,6 +35,7 @@
#include "LogInitialization.h"
#include "MockGamepadProvider.h"
#include "Page.h"
+#include "URLParser.h"
#include "WheelEventTestTrigger.h"
#include <_javascript_Core/APICast.h>
#include <_javascript_Core/JSValueRef.h>
@@ -120,6 +121,11 @@
InternalSettings::setAllowsAnySSLCertificate(allowAnySSLCertificate);
}
+void setURLParserEnabled(bool enabled)
+{
+ URLParser::setEnabled(enabled);
+}
+
void installMockGamepadProvider()
{
#if ENABLE(GAMEPAD)
Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.h (207304 => 207305)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.h 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.h 2016-10-13 21:01:58 UTC (rev 207305)
@@ -56,6 +56,7 @@
void setLogChannelToAccumulate(const WTF::String& name) TEST_SUPPORT_EXPORT;
void initializeLogChannelsIfNecessary() TEST_SUPPORT_EXPORT;
void setAllowsAnySSLCertificate(bool) TEST_SUPPORT_EXPORT;
+void setURLParserEnabled(bool) TEST_SUPPORT_EXPORT;
void installMockGamepadProvider() TEST_SUPPORT_EXPORT;
void connectMockGamepad(unsigned index) TEST_SUPPORT_EXPORT;
Modified: trunk/Tools/ChangeLog (207304 => 207305)
--- trunk/Tools/ChangeLog 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Tools/ChangeLog 2016-10-13 21:01:58 UTC (rev 207305)
@@ -1,3 +1,17 @@
+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/TestController.cpp:
+ Enable the URLParser for testing.
+ * WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig:
+ Link with WebCoreTestSupport so we can find setURLParserEnabled.
+
2016-10-13 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r207297.
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (207304 => 207305)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-10-13 21:01:58 UTC (rev 207305)
@@ -1409,6 +1409,7 @@
int DumpRenderTreeMain(int argc, const char *argv[])
{
+ WebCoreTestSupport::setURLParserEnabled(true);
atexit(atexitFunction);
#if PLATFORM(IOS)
Modified: trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig (207304 => 207305)
--- trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig 2016-10-13 21:01:58 UTC (rev 207305)
@@ -29,7 +29,7 @@
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
-OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -framework _javascript_Core -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
+OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -lWebCoreTestSupport -framework _javascript_Core -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
SKIP_INSTALL[sdk=macosx*] = YES;
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (207304 => 207305)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2016-10-13 20:03:45 UTC (rev 207304)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2016-10-13 21:01:58 UTC (rev 207305)
@@ -115,6 +115,7 @@
TestController::TestController(int argc, const char* argv[])
{
+ WebCoreTestSupport::setURLParserEnabled(true);
initialize(argc, argv);
controller = this;
run();