Changeset 55319 in webkit


Ignore:
Timestamp:
Feb 26, 2010 3:18:11 PM (14 years ago)
Author:
brettw@chromium.org
Message:

2010-02-12 Brett Wilson <brettw@chromium.org>

Reviewed by Adam Barth.

Update the Google-URL version of KURL and the V8 bindings to the new
behavior of KURL.IsStandard.

https://bugs.webkit.org/show_bug.cgi?id=34859

This is covered by fast/dom/Window/invalid-protocol.html

  • bindings/v8/custom/V8LocationCustom.cpp: (WebCore::V8Location::protocolAccessorSetter):
  • platform/KURLGoogle.cpp: (WebCore::KURL::setProtocol): (WebCore::KURL::isHierarchical):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55318 r55319  
     12010-02-12  Brett Wilson  <brettw@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Update the Google-URL version of KURL and the V8 bindings to the new
     6        behavior of KURL.IsStandard.
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=34859
     9
     10        This is covered by fast/dom/Window/invalid-protocol.html
     11
     12        * bindings/v8/custom/V8LocationCustom.cpp:
     13        (WebCore::V8Location::protocolAccessorSetter):
     14        * platform/KURLGoogle.cpp:
     15        (WebCore::KURL::setProtocol):
     16        (WebCore::KURL::isHierarchical):
     17
     182010-02-26  Gavin Barraclough  <barraclough@apple.com>
     19
     20        Reviewed by NOBODY (Build fix following r55312).
     21
     22        * bridge/qt/qt_pixmapruntime.cpp:
     23        (JSC::Bindings::QtPixmapInstance::invokeMethod):
     24
    1252010-02-26  Yaar Schnitman  <yaar@chromium.org>
    226
     
    34223446        * html/HTMLOptionElement.h:
    34233447
    3424 2010-02-12  Brett Wilson  <brettw@chromium.org>
    3425 
    3426         Reviewed by Adam Barth.
    3427 
    3428         Update the Google-URL version of KURL and the V8 bindings to the new
    3429         behavior of KURL.IsStandard.
    3430 
    3431         https://bugs.webkit.org/show_bug.cgi?id=34859
    3432 
    3433         This is covered by fast/dom/Window/invalid-protocol.html
    3434 
    3435         * bindings/v8/custom/V8LocationCustom.cpp:
    3436         (WebCore::V8Location::protocolAccessorSetter):
    3437         * platform/KURLGoogle.cpp:
    3438         (WebCore::KURL::setProtocol):
    3439         (WebCore::KURL::isHierarchical):
    3440 
    344134482010-02-18  Simon Fraser  <simon.fraser@apple.com>
    34423449
     
    38093816        (WebCore::V8DOMWrapper::instantiateV8Object): Merge instantiateV8Object paths.
    38103817        * bindings/v8/V8DOMWrapper.h:
     3818
     38192010-02-12  Brett Wilson  <brettw@chromium.org>
     3820
     3821        Reviewed by Adam Barth.
     3822
     3823        Update the Google-URL version of KURL and the V8 bindings to the new
     3824        behavior of KURL.IsStandard.
     3825
     3826        https://bugs.webkit.org/show_bug.cgi?id=34859
     3827
     3828        This is covered by fast/dom/Window/invalid-protocol.html
     3829
     3830        * bindings/v8/custom/V8LocationCustom.cpp:
     3831        (WebCore::V8Location::protocolAccessorSetter):
     3832        * platform/KURLGoogle.cpp:
     3833        (WebCore::KURL::setProtocol):
     3834        (WebCore::KURL::isHierarchical):
    38113835
    381238362010-02-18  Xan Lopez  <xlopez@igalia.com>
  • trunk/WebCore/bindings/v8/custom/V8LocationCustom.cpp

    r55285 r55319  
    191191
    192192    KURL url = frame->loader()->url();
    193     url.setProtocol(protocol);
     193    if (!url.setProtocol(protocol)) {
     194        throwError("Can't set protocol", V8Proxy::SyntaxError);
     195        return;
     196    }
    194197
    195198    navigateIfAllowed(frame, url, false, false);
  • trunk/WebCore/platform/KURLGoogle.cpp

    r55011 r55319  
    573573bool KURL::setProtocol(const String& protocol)
    574574{
     575    // Firefox and IE remove everything after the first ':'.
     576    int separatorPosition = protocol.find(':');
     577    String newProtocol = protocol.substring(0, separatorPosition);
     578
     579    // If KURL is given an invalid scheme, it returns failure without modifying
     580    // the URL at all. This is in contrast to most other setters which modify
     581    // the URL and set "m_isValid."
     582    url_canon::RawCanonOutputT<char> canonProtocol;
     583    url_parse::Component protocolComponent;
     584    if (!url_canon::CanonicalizeScheme(newProtocol.characters(),
     585                                       url_parse::Component(0, newProtocol.length()),
     586                                       &canonProtocol, &protocolComponent)
     587        || !protocolComponent.is_nonempty())
     588        return false;
     589
    575590    KURLGooglePrivate::Replacements replacements;
    576     replacements.SetScheme(CharactersOrEmpty(protocol),
    577                            url_parse::Component(0, protocol.length()));
     591    replacements.SetScheme(CharactersOrEmpty(newProtocol),
     592                           url_parse::Component(0, newProtocol.length()));
    578593    m_url.replaceComponents(replacements);
     594
     595    // isValid could be false but we still return true here. This is because
     596    // WebCore or JS scripts can build up a URL by setting individual
     597    // components, and a JS exception is based on the return value of this
     598    // function. We want to throw the exception and stop the script only when
     599    // its trying to set a bad protocol, and not when it maybe just hasn't
     600    // finished building up its final scheme.
    579601    return true;
    580602}
Note: See TracChangeset for help on using the changeset viewer.