[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:43:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit da6bd45bd87c54bbe32b3ccecde256eb92ab8d90
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 27 19:42:20 2010 +0000

    2010-08-27  Michael Nordman  <michaeln at google.com>
    
            Reviewed by David Levin.
    
            https://bugs.webkit.org/show_bug.cgi?id=44133
            IDL bindings for XmlHttpRequest.responseBlob support, doesn't do anything yet.
            Adds two new attributes, asBlob and responseBlob.
            Runtime disabled by default, also behind a new ENABLE_XHR_RESPONSE_BLOB compile time guard.
    
            No new tests, just adding some stubs.
    
            * bindings/generic/RuntimeEnabledFeatures.cpp:
            * bindings/generic/RuntimeEnabledFeatures.h:
            (WebCore::RuntimeEnabledFeatures::setResponseBlobEnabled):
            (WebCore::RuntimeEnabledFeatures::responseBlobEnabled):
            (WebCore::RuntimeEnabledFeatures::asBlobEnabled):
            * bindings/js/JSXMLHttpRequestCustom.cpp:
            (WebCore::JSXMLHttpRequest::responseText): Changed to allow an exceptional return path.
            * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
            (WebCore::V8XMLHttpRequest::responseTextAccessorGetter): Changed to allow an exceptional return path.
            * xml/XMLHttpRequest.cpp:
            (WebCore::XMLHttpRequest::responseText): Changed to raise an exception when accessed with asBlob set to true.
            (WebCore::XMLHttpRequest::responseXML): Changed to raise an exception when accessed with asBlob set to true.
            (WebCore::XMLHttpRequest::responseBlob): Added stub method, returns 0 for now.
            (WebCore::XMLHttpRequest::setAsBlob): Sets the asBlob attribute, raises exception if called at an inappropriate time.
            (WebCore::XMLHttpRequest::open): Resets asBlob to false, the default value.
            (WebCore::XMLHttpRequest::abort): Clears m_responseBlob.
            (WebCore::XMLHttpRequest::clearResponse): Clears m_responseBlob.
            (WebCore::XMLHttpRequest::didFinishLoading): Added a FIXME to populate m_responseBlob.
            * xml/XMLHttpRequest.h:
            (WebCore::XMLHttpRequest::asBlob):
            * xml/XMLHttpRequest.idl:
    2010-08-27  Michael Nordman  <michaeln at google.com>
    
            Reviewed by David Levin.
    
            https://bugs.webkit.org/show_bug.cgi?id=44133
            WebKitAPI to allow runtime enablement of XmlHttpRequest.responseBlob.
    
            * features.gypi: Define ENABLE_XHR_RESPONSE_BLOB.
            * public/WebRuntimeFeatures.h:
            * src/WebRuntimeFeatures.cpp:
            (WebKit::WebRuntimeFeatures::enableXHRResponseBlob):
            (WebKit::WebRuntimeFeatures::isXHRResponseBlobEnabled):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66243 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c8f9bcf..bdae17d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-08-27  Michael Nordman  <michaeln at google.com>
+
+        Reviewed by David Levin.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44133
+        IDL bindings for XmlHttpRequest.responseBlob support, doesn't do anything yet.
+        Adds two new attributes, asBlob and responseBlob.
+        Runtime disabled by default, also behind a new ENABLE_XHR_RESPONSE_BLOB compile time guard.
+        
+        No new tests, just adding some stubs.
+
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setResponseBlobEnabled):
+        (WebCore::RuntimeEnabledFeatures::responseBlobEnabled):
+        (WebCore::RuntimeEnabledFeatures::asBlobEnabled):
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::responseText): Changed to allow an exceptional return path.
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::V8XMLHttpRequest::responseTextAccessorGetter): Changed to allow an exceptional return path.
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseText): Changed to raise an exception when accessed with asBlob set to true.
+        (WebCore::XMLHttpRequest::responseXML): Changed to raise an exception when accessed with asBlob set to true.
+        (WebCore::XMLHttpRequest::responseBlob): Added stub method, returns 0 for now.
+        (WebCore::XMLHttpRequest::setAsBlob): Sets the asBlob attribute, raises exception if called at an inappropriate time.
+        (WebCore::XMLHttpRequest::open): Resets asBlob to false, the default value.
+        (WebCore::XMLHttpRequest::abort): Clears m_responseBlob.
+        (WebCore::XMLHttpRequest::clearResponse): Clears m_responseBlob.
+        (WebCore::XMLHttpRequest::didFinishLoading): Added a FIXME to populate m_responseBlob.
+        * xml/XMLHttpRequest.h:
+        (WebCore::XMLHttpRequest::asBlob):
+        * xml/XMLHttpRequest.idl:
+
 2010-08-27  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
index 94e984f..66de0f9 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
@@ -51,6 +51,10 @@ bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
 
+#if ENABLE(XHR_RESPONSE_BLOB)
+bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
+#endif
+
 #if ENABLE(VIDEO)
 
 bool RuntimeEnabledFeatures::audioEnabled()
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index fd7308e..cc55364 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -128,6 +128,13 @@ public:
     static bool speechInputEnabled() { return isSpeechInputEnabled; }
     static bool speechEnabled() { return isSpeechInputEnabled; }
 
+#if ENABLE(XHR_RESPONSE_BLOB)
+    static bool xhrResponseBlobEnabled() { return isXHRResponseBlobEnabled; }
+    static void setXHRResponseBlobEnabled(bool isEnabled) { isXHRResponseBlobEnabled = isEnabled; }
+    static bool responseBlobEnabled() { return isXHRResponseBlobEnabled; }
+    static bool asBlobEnabled()  { return isXHRResponseBlobEnabled; }
+#endif
+
 private:
     // Never instantiate.
     RuntimeEnabledFeatures() { }
@@ -144,6 +151,9 @@ private:
     static bool isDeviceMotionEnabled;
     static bool isDeviceOrientationEnabled;
     static bool isSpeechInputEnabled;
+#if ENABLE(XHR_RESPONSE_BLOB)
+    static bool isXHRResponseBlobEnabled;
+#endif
 };
 
 } // namespace WebCore
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index da75139..2da3771 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -124,7 +124,13 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
 
 JSValue JSXMLHttpRequest::responseText(ExecState* exec) const
 {
-    return jsOwnedStringOrNull(exec, impl()->responseText());
+    ExceptionCode ec = 0;
+    const ScriptString& text = impl()->responseText(ec);
+    if (ec) {
+        setDOMException(exec, ec);
+        return jsUndefined();
+    }
+    return jsOwnedStringOrNull(exec, text);
 }
 
 EncodedJSValue JSC_HOST_CALL JSXMLHttpRequestConstructor::constructJSXMLHttpRequest(ExecState* exec)
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 3da664f..cfeb503 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -49,7 +49,11 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseTextAccessorGetter(v8::Local<v8:
 {
     INC_STATS("DOM.XMLHttpRequest.responsetext._get");
     XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
-    return xmlHttpRequest->responseText().v8StringOrNull();
+    ExceptionCode ec = 0;
+    const ScriptString& text = xmlHttpRequest->responseText(ec);
+    if (ec)
+        return throwError(ec);
+    return text.v8StringOrNull();
 }
 
 v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index 3e76407..c12dc16 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -48,6 +48,7 @@
 #include <wtf/text/CString.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/RefCountedLeakCounter.h>
+#include <wtf/UnusedParam.h>
 
 #if USE(JSC)
 #include "JSDOMBinding.h"
@@ -171,6 +172,9 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
     : ActiveDOMObject(context, this)
     , m_async(true)
     , m_includeCredentials(false)
+#if ENABLE(XHR_RESPONSE_BLOB)
+    , m_asBlob(false)
+#endif
     , m_state(UNSENT)
     , m_responseText("")
     , m_createdDocument(false)
@@ -225,13 +229,28 @@ XMLHttpRequest::State XMLHttpRequest::readyState() const
     return m_state;
 }
 
-const ScriptString& XMLHttpRequest::responseText() const
+const ScriptString& XMLHttpRequest::responseText(ExceptionCode& ec) const
 {
+#if ENABLE(XHR_RESPONSE_BLOB)
+    if (m_asBlob)
+        ec = INVALID_STATE_ERR;
+#else
+    UNUSED_PARAM(ec);
+#endif
     return m_responseText;
 }
 
-Document* XMLHttpRequest::responseXML() const
+Document* XMLHttpRequest::responseXML(ExceptionCode& ec) const
 {
+#if ENABLE(XHR_RESPONSE_BLOB)
+    if (m_asBlob) {
+        ec = INVALID_STATE_ERR;
+        return 0;
+    }
+#else
+    UNUSED_PARAM(ec);
+#endif
+
     if (m_state != DONE)
         return 0;
 
@@ -256,6 +275,17 @@ Document* XMLHttpRequest::responseXML() const
     return m_responseXML.get();
 }
 
+#if ENABLE(XHR_RESPONSE_BLOB)
+Blob* XMLHttpRequest::responseBlob(ExceptionCode& ec) const
+{
+    if (!m_asBlob) {
+        ec = INVALID_STATE_ERR;
+        return 0;
+    }
+    return m_responseBlob.get();
+}
+#endif
+
 XMLHttpRequestUpload* XMLHttpRequest::upload()
 {
     if (!m_upload)
@@ -318,6 +348,18 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec)
     m_includeCredentials = value;
 }
 
+#if ENABLE(XHR_RESPONSE_BLOB)
+void XMLHttpRequest::setAsBlob(bool value, ExceptionCode& ec)
+{
+    if (m_state != OPENED || m_loader) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    m_asBlob = value;
+}
+#endif
+
 void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionCode& ec)
 {
     open(method, url, true, ec);
@@ -329,7 +371,9 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc
     State previousState = m_state;
     m_state = UNSENT;
     m_error = false;
-
+#if ENABLE(XHR_RESPONSE_BLOB)
+    m_asBlob = false;
+#endif
     m_uploadComplete = false;
 
     // clear stuff from possible previous load
@@ -594,6 +638,9 @@ void XMLHttpRequest::abort()
     m_responseText = "";
     m_createdDocument = false;
     m_responseXML = 0;
+#if ENABLE(XHR_RESPONSE_BLOB)
+    m_responseBlob = 0;
+#endif
 
     // Clear headers as required by the spec
     m_requestHeaders.clear();
@@ -640,6 +687,9 @@ void XMLHttpRequest::clearResponse()
     m_responseText = "";
     m_createdDocument = false;
     m_responseXML = 0;
+#if ENABLE(XHR_RESPONSE_BLOB)
+    m_responseBlob = 0;
+#endif
 }
 
 void XMLHttpRequest::clearRequest()
@@ -902,6 +952,10 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
     if (m_decoder)
         m_responseText += m_decoder->flush();
 
+#if ENABLE(XHR_RESPONSE_BLOB)
+    // FIXME: Set m_responseBlob to something here in the m_asBlob case.
+#endif
+
 #if ENABLE(INSPECTOR)
     if (InspectorController* inspector = scriptExecutionContext()->inspectorController())
         inspector->resourceRetrievedByXMLHttpRequest(identifier, m_responseText, m_url, m_lastSendURL, m_lastSendLineNumber);
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
index 2947b46..d25f63f 100644
--- a/WebCore/xml/XMLHttpRequest.h
+++ b/WebCore/xml/XMLHttpRequest.h
@@ -70,6 +70,10 @@ public:
     State readyState() const;
     bool withCredentials() const { return m_includeCredentials; }
     void setWithCredentials(bool, ExceptionCode&);
+#if ENABLE(XHR_RESPONSE_BLOB)
+    bool asBlob() const { return m_asBlob; }
+    void setAsBlob(bool, ExceptionCode&);
+#endif
     void open(const String& method, const KURL&, ExceptionCode&);
     void open(const String& method, const KURL&, bool async, ExceptionCode&);
     void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&);
@@ -84,8 +88,11 @@ public:
     void overrideMimeType(const String& override);
     String getAllResponseHeaders(ExceptionCode&) const;
     String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
-    const ScriptString& responseText() const;
-    Document* responseXML() const;
+    const ScriptString& responseText(ExceptionCode&) const;
+    Document* responseXML(ExceptionCode&) const;
+#if ENABLE(XHR_RESPONSE_BLOB)
+    Blob* responseBlob(ExceptionCode&) const;
+#endif
     void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
     void setLastSendURL(const String& url) { m_lastSendURL = url; }
 
@@ -155,6 +162,10 @@ private:
     String m_mimeTypeOverride;
     bool m_async;
     bool m_includeCredentials;
+#if ENABLE(XHR_RESPONSE_BLOB)
+    bool m_asBlob;
+    RefPtr<Blob> m_responseBlob;
+#endif
 
     RefPtr<ThreadableLoader> m_loader;
     State m_state;
diff --git a/WebCore/xml/XMLHttpRequest.idl b/WebCore/xml/XMLHttpRequest.idl
index 58413ff..59997f8 100644
--- a/WebCore/xml/XMLHttpRequest.idl
+++ b/WebCore/xml/XMLHttpRequest.idl
@@ -57,6 +57,11 @@ module xml {
         readonly attribute unsigned short readyState;
 
         // request
+#if defined(ENABLE_XHR_RESPONSE_BLOB) && ENABLE_XHR_RESPONSE_BLOB
+        attribute [EnabledAtRuntime] boolean asBlob
+            setter raises(DOMException);
+#endif
+
         attribute boolean withCredentials
             setter raises(DOMException);
         // void open(in DOMString method, in DOMString url);
@@ -82,8 +87,14 @@ module xml {
             raises(DOMException);
         [RequiresAllArguments=Raise, ConvertNullStringTo=Null] DOMString getResponseHeader(in DOMString header)
             raises(DOMException);
-        readonly attribute [CustomGetter] DOMString responseText; // The custom getter implements ConvertNullStringTo=Null
-        readonly attribute Document responseXML;
+        readonly attribute [CustomGetter] DOMString responseText // The custom getter implements ConvertNullStringTo=Null
+            getter raises(DOMException);
+        readonly attribute Document responseXML
+            getter raises(DOMException);
+#if defined(ENABLE_XHR_RESPONSE_BLOB) && ENABLE_XHR_RESPONSE_BLOB
+        readonly attribute [EnabledAtRuntime] Blob responseBlob
+            getter raises(DOMException);
+#endif
         readonly attribute unsigned short status
             getter raises(DOMException);
         readonly attribute DOMString statusText
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index b893777..d264291 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-27  Michael Nordman  <michaeln at google.com>
+
+        Reviewed by David Levin.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44133
+        WebKitAPI to allow runtime enablement of XmlHttpRequest.responseBlob.
+
+        * features.gypi: Define ENABLE_XHR_RESPONSE_BLOB.
+        * public/WebRuntimeFeatures.h:
+        * src/WebRuntimeFeatures.cpp:
+        (WebKit::WebRuntimeFeatures::enableXHRResponseBlob):
+        (WebKit::WebRuntimeFeatures::isXHRResponseBlobEnabled):
+
 2010-08-25  Jeremy Orlow  <jorlow at chromium.org>
 
         Reviewed by Steve Block.
diff --git a/WebKit/chromium/features.gypi b/WebKit/chromium/features.gypi
index df3e999..df277d6 100644
--- a/WebKit/chromium/features.gypi
+++ b/WebKit/chromium/features.gypi
@@ -81,6 +81,7 @@
         'ENABLE_WEB_SOCKETS=1',
         'ENABLE_WEB_TIMING=1',
         'ENABLE_WORKERS=1',
+        'ENABLE_XHR_RESPONSE_BLOB=1',
         'ENABLE_XPATH=1',
         'ENABLE_XSLT=1',
       ],
diff --git a/WebKit/chromium/public/WebRuntimeFeatures.h b/WebKit/chromium/public/WebRuntimeFeatures.h
index 9aa1f4f..e282864 100644
--- a/WebKit/chromium/public/WebRuntimeFeatures.h
+++ b/WebKit/chromium/public/WebRuntimeFeatures.h
@@ -86,6 +86,9 @@ public:
     WEBKIT_API static void enableSpeechInput(bool);
     WEBKIT_API static bool isSpeechInputEnabled();
 
+    WEBKIT_API static void enableXHRResponseBlob(bool);
+    WEBKIT_API static bool isXHRResponseBlobEnabled();
+
 private:
     WebRuntimeFeatures();
 };
diff --git a/WebKit/chromium/src/WebRuntimeFeatures.cpp b/WebKit/chromium/src/WebRuntimeFeatures.cpp
index 9e21d58..9e1e4de 100644
--- a/WebKit/chromium/src/WebRuntimeFeatures.cpp
+++ b/WebKit/chromium/src/WebRuntimeFeatures.cpp
@@ -256,4 +256,20 @@ bool WebRuntimeFeatures::isSpeechInputEnabled()
     return RuntimeEnabledFeatures::speechInputEnabled();
 }
 
+void WebRuntimeFeatures::enableXHRResponseBlob(bool enable)
+{
+#if ENABLE(XHR_RESPONSE_BLOB)
+    RuntimeEnabledFeatures::setXHRResponseBlobEnabled(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isXHRResponseBlobEnabled()
+{
+#if ENABLE(XHR_RESPONSE_BLOB)
+    return RuntimeEnabledFeatures::xhrResponseBlobEnabled();
+#else
+    return false;
+#endif
+}
+
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list