Changeset 207304 in webkit


Ignore:
Timestamp:
Oct 13, 2016 1:03:45 PM (8 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r207297. rdar://problem/28756748

Location:
tags/Safari-603.1.9
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • tags/Safari-603.1.9/Source/WebCore/ChangeLog

    r207303 r207304  
     12016-10-13  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r207297. rdar://problem/28756748
     4
     5    2016-10-13  Alex Christensen  <achristensen@webkit.org>
     6
     7            Disable URLParser for non-Safari iOS and Mac apps for now
     8            https://bugs.webkit.org/show_bug.cgi?id=163397
     9
     10            Reviewed by Tim Horton.
     11
     12            r207268 was an awful hack, and it was insufficient.
     13            Disable the URLParser for other apps for now.  Hopefully we can enable it everywhere soon.
     14
     15            No change in behavior for testing infrastructure.
     16            Old URLs were well tested before making the switch, and nothing has changed for them.
     17
     18            * platform/URLParser.cpp:
     19            (WebCore::URLParser::parse):
     20            (WebCore::URLParser::parseHostAndPort):
     21            (WebCore::URLParser::setEnabled):
     22            (WebCore::URLParser::enabled):
     23            * platform/URLParser.h:
     24
    1252016-10-13  Matthew Hanson  <matthew_hanson@apple.com>
    226
  • tags/Safari-603.1.9/Source/WebCore/platform/URLParser.cpp

    r207303 r207304  
    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
  • tags/Safari-603.1.9/Source/WebCore/platform/URLParser.h

    r207303 r207304  
    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
  • tags/Safari-603.1.9/Tools/ChangeLog

    r207225 r207304  
     12016-10-13  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r207297. rdar://problem/28756748
     4
     5    2016-10-13  Alex Christensen  <achristensen@webkit.org>
     6
     7            Disable URLParser for non-Safari iOS and Mac apps for now
     8            https://bugs.webkit.org/show_bug.cgi?id=163397
     9
     10            Reviewed by Tim Horton.
     11
     12            * DumpRenderTree/mac/DumpRenderTree.mm:
     13            (DumpRenderTreeMain):
     14            * WebKitTestRunner/ios/mainIOS.mm:
     15            (main):
     16            * WebKitTestRunner/mac/main.mm:
     17            (main):
     18
    1192016-10-11  Sam Weinig  <sam@webkit.org>
    220
  • tags/Safari-603.1.9/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r206296 r207304  
    5959#import <JavaScriptCore/TestRunnerUtils.h>
    6060#import <WebCore/LogInitialization.h>
     61#import <WebCore/URLParser.h>
    6162#import <WebKit/DOMElement.h>
    6263#import <WebKit/DOMExtensions.h>
     
    14101411int DumpRenderTreeMain(int argc, const char *argv[])
    14111412{
     1413    WebCore::URLParser::setEnabled(true);
    14121414    atexit(atexitFunction);
    14131415
  • tags/Safari-603.1.9/Tools/WebKitTestRunner/ios/mainIOS.mm

    r202743 r207304  
    3030#import "UIKitSPI.h"
    3131#import <UIKit/UIKit.h>
     32#import <WebCore/URLParser.h>
    3233
    3334static int _argc;
     
    6566int main(int argc, const char* argv[])
    6667{
     68    WebCore::URLParser::setEnabled(true);
    6769    _argc = argc;
    6870    _argv = argv;
  • tags/Safari-603.1.9/Tools/WebKitTestRunner/mac/main.mm

    r204853 r207304  
    3030#import "PlatformWebView.h"
    3131#import "TestController.h"
     32#import <WebCore/URLParser.h>
    3233
    3334static void setDefaultsToConsistentValuesForTesting()
     
    5657int main(int argc, const char* argv[])
    5758{
     59    WebCore::URLParser::setEnabled(true);
    5860    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    5961    [NSApplication sharedApplication];
Note: See TracChangeset for help on using the changeset viewer.