Changeset 54997 in webkit
- Timestamp:
- Feb 18, 2010 6:06:14 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54995 r54997 1 2010-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 1 18 2010-02-18 Simon Fraser <simon.fraser@apple.com> 2 19 -
trunk/WebCore/bindings/v8/custom/V8LocationCustom.cpp
r54629 r54997 186 186 187 187 KURL url = frame->loader()->url(); 188 url.setProtocol(protocol); 188 if (!url.setProtocol(protocol)) { 189 throwError("Can't set protocol", V8Proxy::SyntaxError); 190 return; 191 } 189 192 190 193 navigateIfAllowed(frame, url, false, false); -
trunk/WebCore/platform/KURLGoogle.cpp
r53712 r54997 573 573 bool KURL::setProtocol(const String& protocol) 574 574 { 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 575 590 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())); 578 593 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. 579 601 return true; 580 602 } … … 1016 1038 return url_util::IsStandard( 1017 1039 &m_url.utf8String().data()[m_url.m_parsed.scheme.begin], 1018 m_url.utf8String().length(),1019 1040 m_url.m_parsed.scheme); 1020 1041 }
Note: See TracChangeset
for help on using the changeset viewer.