[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

brettw at chromium.org brettw at chromium.org
Fri Feb 26 22:25:23 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit c84f00d2be06d248bbaa72ace82c3282633a1af7
Author: brettw at chromium.org <brettw at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 19 02:06:14 2010 +0000

    2010-02-12  Brett Wilson  <brettw at 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):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bf165aa..c6b99bd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-02-12  Brett Wilson  <brettw at 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):
+
 2010-02-18  Simon Fraser  <simon.fraser at apple.com>
 
         No Review.
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index b5df601..880d4b2 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -185,7 +185,10 @@ void V8Location::protocolAccessorSetter(v8::Local<v8::String> name, v8::Local<v8
         return;
 
     KURL url = frame->loader()->url();
-    url.setProtocol(protocol);
+    if (!url.setProtocol(protocol)) {
+        throwError("Can't set protocol", V8Proxy::SyntaxError);
+        return;
+    }
 
     navigateIfAllowed(frame, url, false, false);
 }
diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp
index 65ca346..3b1401d 100644
--- a/WebCore/platform/KURLGoogle.cpp
+++ b/WebCore/platform/KURLGoogle.cpp
@@ -572,10 +572,32 @@ String KURL::path() const
 
 bool KURL::setProtocol(const String& protocol)
 {
+    // Firefox and IE remove everything after the first ':'.
+    int separatorPosition = protocol.find(':');
+    String newProtocol = protocol.substring(0, separatorPosition);
+
+    // If KURL is given an invalid scheme, it returns failure without modifying
+    // the URL at all. This is in contrast to most other setters which modify
+    // the URL and set "m_isValid."
+    url_canon::RawCanonOutputT<char> canonProtocol;
+    url_parse::Component protocolComponent;
+    if (!url_canon::CanonicalizeScheme(newProtocol.characters(),
+                                       url_parse::Component(0, newProtocol.length()),
+                                       &canonProtocol, &protocolComponent)
+        || !protocolComponent.is_nonempty())
+        return false;
+
     KURLGooglePrivate::Replacements replacements;
-    replacements.SetScheme(CharactersOrEmpty(protocol),
-                           url_parse::Component(0, protocol.length()));
+    replacements.SetScheme(CharactersOrEmpty(newProtocol),
+                           url_parse::Component(0, newProtocol.length()));
     m_url.replaceComponents(replacements);
+
+    // isValid could be false but we still return true here. This is because
+    // WebCore or JS scripts can build up a URL by setting individual
+    // components, and a JS exception is based on the return value of this
+    // function. We want to throw the exception and stop the script only when
+    // its trying to set a bad protocol, and not when it maybe just hasn't
+    // finished building up its final scheme.
     return true;
 }
 
@@ -1015,7 +1037,6 @@ bool KURL::isHierarchical() const
         return false;
     return url_util::IsStandard(
         &m_url.utf8String().data()[m_url.m_parsed.scheme.begin],
-        m_url.utf8String().length(),
         m_url.m_parsed.scheme);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list