Changeset 207305 in webkit


Ignore:
Timestamp:
Oct 13, 2016 2:01:58 PM (7 years ago)
Author:
achristensen@apple.com
Message:

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

Reviewed by Tim Horton.

Source/WebCore:

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:

Tools:

  • 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.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207302 r207305  
     12016-10-13  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disable URLParser for non-Safari iOS and Mac apps for now
     4        https://bugs.webkit.org/show_bug.cgi?id=163397
     5
     6        Reviewed by Tim Horton.
     7
     8        r207268 was an awful hack, and it was insufficient.
     9        Disable the URLParser for other apps for now.  Hopefully we can enable it everywhere soon.
     10
     11        No change in behavior for testing infrastructure. 
     12        Old URLs were well tested before making the switch, and nothing has changed for them.
     13
     14        * platform/URLParser.cpp:
     15        (WebCore::URLParser::parse):
     16        (WebCore::URLParser::parseHostAndPort):
     17        (WebCore::URLParser::setEnabled):
     18        (WebCore::URLParser::enabled):
     19        * platform/URLParser.h:
     20
    1212016-10-13  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/platform/URLParser.cpp

    r207301 r207305  
    11291129void URLParser::parse(const CharacterType* input, const unsigned length, const URL& base, const TextEncoding& encoding)
    11301130{
    1131 #if PLATFORM(MAC)
    1132     static bool isMail = MacApplication::isAppleMail();
    1133 #else
    1134     static bool isMail = false;
    1135 #endif
    1136    
    11371131    URL_PARSER_LOG("Parsing URL <%s> base <%s> encoding <%s>", String(input, length).utf8().data(), base.string().utf8().data(), encoding.name());
    11381132    m_url = { };
     
    14611455                        m_url.m_userEnd = currentPosition(authorityOrHostBegin);
    14621456                        m_url.m_passwordEnd = m_url.m_userEnd;
    1463                         if (!parseHostAndPort(iterator, isMail)) {
     1457                        if (!parseHostAndPort(iterator)) {
    14641458                            failure();
    14651459                            return;
     
    14831477                LOG_STATE("Host");
    14841478                if (*c == '/' || *c == '?' || *c == '#') {
    1485                     if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
     1479                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
    14861480                        failure();
    14871481                        return;
     
    16541648                        break;
    16551649                    }
    1656                     if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
     1650                    if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
    16571651                        failure();
    16581652                        return;
     
    18741868            m_url.m_portEnd = m_url.m_userStart;
    18751869            m_url.m_pathEnd = m_url.m_userStart + 2;
    1876         } else if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
     1870        } else if (!parseHostAndPort(authorityOrHostBegin)) {
    18771871            failure();
    18781872            return;
    18791873        } else {
    1880             if (LIKELY(!isMail || m_urlIsSpecial)) {
    1881                 syntaxViolation(c);
    1882                 appendToASCIIBuffer('/');
    1883                 m_url.m_pathEnd = m_url.m_portEnd + 1;
    1884             } else
    1885                 m_url.m_pathEnd = m_url.m_portEnd;
     1874            syntaxViolation(c);
     1875            appendToASCIIBuffer('/');
     1876            m_url.m_pathEnd = m_url.m_portEnd + 1;
    18861877        }
    18871878        m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
     
    18911882    case State::Host:
    18921883        LOG_FINAL_STATE("Host");
    1893         if (!parseHostAndPort(authorityOrHostBegin, isMail)) {
     1884        if (!parseHostAndPort(authorityOrHostBegin)) {
    18941885            failure();
    18951886            return;
    18961887        }
    1897         if (LIKELY(!isMail || m_urlIsSpecial)) {
    1898             syntaxViolation(c);
    1899             appendToASCIIBuffer('/');
    1900             m_url.m_pathEnd = m_url.m_portEnd + 1;
    1901         } else
    1902             m_url.m_pathEnd = m_url.m_portEnd;
     1888        syntaxViolation(c);
     1889        appendToASCIIBuffer('/');
     1890        m_url.m_pathEnd = m_url.m_portEnd + 1;
    19031891        m_url.m_pathAfterLastSlash = m_url.m_pathEnd;
    19041892        m_url.m_queryEnd = m_url.m_pathEnd;
     
    19541942        }
    19551943
    1956         if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c), isMail)) {
     1944        if (!parseHostAndPort(CodePointIterator<CharacterType>(authorityOrHostBegin, c))) {
    19571945            failure();
    19581946            return;
     
    25692557
    25702558template<typename CharacterType>
    2571 bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator, const bool& isMail)
     2559bool URLParser::parseHostAndPort(CodePointIterator<CharacterType> iterator)
    25722560{
    25732561    if (iterator.atEnd())
     
    26192607        for (; hostIterator != iterator; ++hostIterator) {
    26202608            if (LIKELY(!isTabOrNewline(*hostIterator))) {
    2621                 if (UNLIKELY(isMail && !m_urlIsSpecial))
    2622                     appendToASCIIBuffer(*hostIterator);
    2623                 else {
    2624                     if (UNLIKELY(isASCIIUpper(*hostIterator)))
    2625                         syntaxViolation(hostIterator);
    2626                     appendToASCIIBuffer(toASCIILower(*hostIterator));
    2627                 }
     2609                if (UNLIKELY(isASCIIUpper(*hostIterator)))
     2610                    syntaxViolation(hostIterator);
     2611                appendToASCIIBuffer(toASCIILower(*hostIterator));
    26282612            } else
    26292613                syntaxViolation(hostIterator);
     
    28042788}
    28052789
    2806 static bool urlParserEnabled = true;
     2790enum class URLParserEnabled {
     2791    Undetermined,
     2792    Yes,
     2793    No
     2794};
     2795
     2796static URLParserEnabled urlParserEnabled = URLParserEnabled::Undetermined;
    28072797
    28082798void URLParser::setEnabled(bool enabled)
    28092799{
    2810     urlParserEnabled = enabled;
     2800    urlParserEnabled = enabled ? URLParserEnabled::Yes : URLParserEnabled::No;
    28112801}
    28122802
    28132803bool URLParser::enabled()
    28142804{
    2815     return urlParserEnabled;
     2805    if (urlParserEnabled == URLParserEnabled::Undetermined) {
     2806#if PLATFORM(MAC)
     2807        urlParserEnabled = MacApplication::isSafari() ? URLParserEnabled::Yes : URLParserEnabled::No;
     2808#elif PLATFORM(IOS)
     2809        urlParserEnabled = IOSApplication::isMobileSafari() ? URLParserEnabled::Yes : URLParserEnabled::No;
     2810#else
     2811        urlParserEnabled = URLParserEnabled::Yes;
     2812#endif
     2813    }
     2814    return urlParserEnabled == URLParserEnabled::Yes;
    28162815}
    28172816
  • trunk/Source/WebCore/platform/URLParser.h

    r207301 r207305  
    6161    template<typename CharacterType> void parse(const CharacterType*, const unsigned length, const URL&, const TextEncoding&);
    6262    template<typename CharacterType> void parseAuthority(CodePointIterator<CharacterType>);
    63     template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>, const bool& isMail);
     63    template<typename CharacterType> bool parseHostAndPort(CodePointIterator<CharacterType>);
    6464    template<typename CharacterType> bool parsePort(CodePointIterator<CharacterType>&);
    6565
  • trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp

    r205275 r207305  
    3636#include "MockGamepadProvider.h"
    3737#include "Page.h"
     38#include "URLParser.h"
    3839#include "WheelEventTestTrigger.h"
    3940#include <JavaScriptCore/APICast.h>
     
    121122}
    122123
     124void setURLParserEnabled(bool enabled)
     125{
     126    URLParser::setEnabled(enabled);
     127}
     128
    123129void installMockGamepadProvider()
    124130{
  • trunk/Source/WebCore/testing/js/WebCoreTestSupport.h

    r204853 r207305  
    5757void initializeLogChannelsIfNecessary() TEST_SUPPORT_EXPORT;
    5858void setAllowsAnySSLCertificate(bool) TEST_SUPPORT_EXPORT;
     59void setURLParserEnabled(bool) TEST_SUPPORT_EXPORT;
    5960
    6061void installMockGamepadProvider() TEST_SUPPORT_EXPORT;
  • trunk/Tools/ChangeLog

    r207301 r207305  
     12016-10-13  Alex Christensen  <achristensen@webkit.org>
     2
     3        Disable URLParser for non-Safari iOS and Mac apps for now
     4        https://bugs.webkit.org/show_bug.cgi?id=163397
     5
     6        Reviewed by Tim Horton.
     7
     8        * DumpRenderTree/mac/DumpRenderTree.mm:
     9        (DumpRenderTreeMain):
     10        * WebKitTestRunner/TestController.cpp:
     11        Enable the URLParser for testing.
     12        * WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig:
     13        Link with WebCoreTestSupport so we can find setURLParserEnabled.
     14
    1152016-10-13  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r207301 r207305  
    14101410int DumpRenderTreeMain(int argc, const char *argv[])
    14111411{
     1412    WebCoreTestSupport::setURLParserEnabled(true);
    14121413    atexit(atexitFunction);
    14131414
  • trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig

    r204386 r207305  
    3030GCC_ENABLE_OBJC_EXCEPTIONS = YES;
    3131
    32 OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
     32OTHER_LDFLAGS = $(inherited) -l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY) -lWebKitTestRunner -lWebCoreTestSupport -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
    3333
    3434SKIP_INSTALL[sdk=macosx*] = YES;
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r206596 r207305  
    116116TestController::TestController(int argc, const char* argv[])
    117117{
     118    WebCoreTestSupport::setURLParserEnabled(true);
    118119    initialize(argc, argv);
    119120    controller = this;
Note: See TracChangeset for help on using the changeset viewer.