Changeset 66074 in webkit
- Timestamp:
- Aug 25, 2010 7:54:04 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66071 r66074 1 2010-08-25 Michael Nordman <michaeln@google.com> 2 3 Reviewed by David Levin. 4 5 https://bugs.webkit.org/show_bug.cgi?id=44133 6 IDL bindings for XmlHttpRequest.responseBlob support, doesn't do anything yet. 7 Adds two new attributes, asBlob and responseBlob. 8 Runtime disabled by default, also behind a new ENABLE_XHR_RESPONSE_BLOB compile time guard. 9 10 No new tests, just adding some stubs. 11 12 * bindings/generic/RuntimeEnabledFeatures.cpp: 13 * bindings/generic/RuntimeEnabledFeatures.h: 14 (WebCore::RuntimeEnabledFeatures::setResponseBlobEnabled): 15 (WebCore::RuntimeEnabledFeatures::responseBlobEnabled): 16 (WebCore::RuntimeEnabledFeatures::asBlobEnabled): 17 * bindings/js/JSXMLHttpRequestCustom.cpp: 18 (WebCore::JSXMLHttpRequest::responseText): Changed to allow an exceptional return path. 19 * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: 20 (WebCore::V8XMLHttpRequest::responseTextAccessorGetter): Changed to allow an exceptional return path. 21 * xml/XMLHttpRequest.cpp: 22 (WebCore::XMLHttpRequest::responseText): Changed to raise an exception when accessed with asBlob set to true. 23 (WebCore::XMLHttpRequest::responseXML): Changed to raise an exception when accessed with asBlob set to true. 24 (WebCore::XMLHttpRequest::responseBlob): Added stub method, returns 0 for now. 25 (WebCore::XMLHttpRequest::setAsBlob): Sets the asBlob attribute, raises exception if called at an inappropriate time. 26 (WebCore::XMLHttpRequest::open): Resets asBlob to false, the default value. 27 (WebCore::XMLHttpRequest::abort): Clears m_responseBlob. 28 (WebCore::XMLHttpRequest::clearResponse): Clears m_responseBlob. 29 (WebCore::XMLHttpRequest::didFinishLoading): Added a FIXME to populate m_responseBlob. 30 * xml/XMLHttpRequest.h: 31 (WebCore::XMLHttpRequest::asBlob): 32 * xml/XMLHttpRequest.idl: 33 1 34 2010-08-24 Victoria Kirst <vrk@google.com> 2 35 -
trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
r64845 r66074 51 51 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true; 52 52 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true; 53 54 #if ENABLE(XHR_RESPONSE_BLOB) 55 bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false; 56 #endif 53 57 54 58 #if ENABLE(VIDEO) -
trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.h
r64845 r66074 129 129 static bool speechEnabled() { return isSpeechInputEnabled; } 130 130 131 #if ENABLE(XHR_RESPONSE_BLOB) 132 static bool xhrResponseBlobEnabled() { return isXHRResponseBlobEnabled; } 133 static void setXHRResponseBlobEnabled(bool isEnabled) { isXHRResponseBlobEnabled = isEnabled; } 134 static bool responseBlobEnabled() { return isXHRResponseBlobEnabled; } 135 static bool asBlobEnabled() { return isXHRResponseBlobEnabled; } 136 #endif 137 131 138 private: 132 139 // Never instantiate. … … 145 152 static bool isDeviceOrientationEnabled; 146 153 static bool isSpeechInputEnabled; 154 static bool isXHRResponseBlobEnabled; 147 155 }; 148 156 -
trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
r61100 r66074 125 125 JSValue JSXMLHttpRequest::responseText(ExecState* exec) const 126 126 { 127 return jsOwnedStringOrNull(exec, impl()->responseText()); 127 ExceptionCode ec = 0; 128 const ScriptString& text = impl()->responseText(ec); 129 if (ec) { 130 setDOMException(exec, ec); 131 return jsUndefined(); 132 } 133 return jsOwnedStringOrNull(exec, text); 128 134 } 129 135 -
trunk/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
r59559 r66074 50 50 INC_STATS("DOM.XMLHttpRequest.responsetext._get"); 51 51 XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); 52 return xmlHttpRequest->responseText().v8StringOrNull(); 52 ExceptionCode ec = 0; 53 const ScriptString& text = xmlHttpRequest->responseText(ec); 54 if (ec) 55 return throwError(ec); 56 return text.v8StringOrNull(); 53 57 } 54 58 -
trunk/WebCore/xml/XMLHttpRequest.cpp
r63680 r66074 49 49 #include <wtf/StdLibExtras.h> 50 50 #include <wtf/RefCountedLeakCounter.h> 51 #include <wtf/UnusedParam.h> 51 52 52 53 #if USE(JSC) … … 226 227 } 227 228 228 const ScriptString& XMLHttpRequest::responseText() const 229 { 229 const ScriptString& XMLHttpRequest::responseText(ExceptionCode& ec) const 230 { 231 #if ENABLE(XHR_RESPONSE_BLOB) 232 if (m_asBlob) 233 ec = INVALID_STATE_ERR; 234 #else 235 UNUSED_PARAM(ec); 236 #endif 230 237 return m_responseText; 231 238 } 232 239 233 Document* XMLHttpRequest::responseXML() const 234 { 240 Document* XMLHttpRequest::responseXML(ExceptionCode& ec) const 241 { 242 #if ENABLE(XHR_RESPONSE_BLOB) 243 if (m_asBlob) { 244 ec = INVALID_STATE_ERR; 245 return 0; 246 } 247 #else 248 UNUSED_PARAM(ec); 249 #endif 250 235 251 if (m_state != DONE) 236 252 return 0; … … 257 273 } 258 274 275 #if ENABLE(XHR_RESPONSE_BLOB) 276 Blob* XMLHttpRequest::responseBlob(ExceptionCode& ec) const 277 { 278 if (!m_asBlob) { 279 ec = INVALID_STATE_ERR; 280 return 0; 281 } 282 return m_responseBlob.get(); 283 } 284 #endif 285 259 286 XMLHttpRequestUpload* XMLHttpRequest::upload() 260 287 { … … 319 346 } 320 347 348 #if ENABLE(XHR_RESPONSE_BLOB) 349 void XMLHttpRequest::setAsBlob(bool value, ExceptionCode& ec) 350 { 351 if (m_state != OPENED || m_loader) { 352 ec = INVALID_STATE_ERR; 353 return; 354 } 355 356 m_asBlob = value; 357 } 358 #endif 359 321 360 void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionCode& ec) 322 361 { … … 330 369 m_state = UNSENT; 331 370 m_error = false; 332 371 #if ENABLE(XHR_RESPONSE_BLOB) 372 m_asBlob = false; 373 #endif 333 374 m_uploadComplete = false; 334 375 … … 595 636 m_createdDocument = false; 596 637 m_responseXML = 0; 638 #if ENABLE(XHR_RESPONSE_BLOB) 639 m_responseBlob = 0; 640 #endif 597 641 598 642 // Clear headers as required by the spec … … 641 685 m_createdDocument = false; 642 686 m_responseXML = 0; 687 #if ENABLE(XHR_RESPONSE_BLOB) 688 m_responseBlob = 0; 689 #endif 643 690 } 644 691 … … 902 949 if (m_decoder) 903 950 m_responseText += m_decoder->flush(); 951 952 #if ENABLE(XHR_RESPONSE_BLOB) 953 // FIXME: Set m_responseBlob to something here in the m_asBlob case. 954 #endif 904 955 905 956 #if ENABLE(INSPECTOR) -
trunk/WebCore/xml/XMLHttpRequest.h
r65077 r66074 71 71 bool withCredentials() const { return m_includeCredentials; } 72 72 void setWithCredentials(bool, ExceptionCode&); 73 #if ENABLE(XHR_RESPONSE_BLOB) 74 bool asBlob() const { return m_asBlob; } 75 void setAsBlob(bool, ExceptionCode&); 76 #endif 73 77 void open(const String& method, const KURL&, ExceptionCode&); 74 78 void open(const String& method, const KURL&, bool async, ExceptionCode&); … … 85 89 String getAllResponseHeaders(ExceptionCode&) const; 86 90 String getResponseHeader(const AtomicString& name, ExceptionCode&) const; 87 const ScriptString& responseText() const; 88 Document* responseXML() const; 91 const ScriptString& responseText(ExceptionCode&) const; 92 Document* responseXML(ExceptionCode&) const; 93 #if ENABLE(XHR_RESPONSE_BLOB) 94 Blob* responseBlob(ExceptionCode&) const; 95 #endif 89 96 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; } 90 97 void setLastSendURL(const String& url) { m_lastSendURL = url; } … … 156 163 bool m_async; 157 164 bool m_includeCredentials; 165 #if ENABLE(XHR_RESPONSE_BLOB) 166 bool m_asBlob; 167 RefPtr<Blob> m_responseBlob; 168 #endif 158 169 159 170 RefPtr<ThreadableLoader> m_loader; -
trunk/WebCore/xml/XMLHttpRequest.idl
r61101 r66074 58 58 59 59 // request 60 #if defined(ENABLE_XHR_RESPONSE_BLOB) && ENABLE_XHR_RESPONSE_BLOB 61 attribute [EnabledAtRuntime] boolean asBlob 62 setter raises(DOMException); 63 #endif 64 60 65 attribute boolean withCredentials 61 66 setter raises(DOMException); … … 83 88 [RequiresAllArguments=Raise, ConvertNullStringTo=Null] DOMString getResponseHeader(in DOMString header) 84 89 raises(DOMException); 85 readonly attribute [CustomGetter] DOMString responseText; // The custom getter implements ConvertNullStringTo=Null 86 readonly attribute Document responseXML; 90 readonly attribute [CustomGetter] DOMString responseText // The custom getter implements ConvertNullStringTo=Null 91 getter raises(DOMException); 92 readonly attribute Document responseXML 93 getter raises(DOMException); 94 #if defined(ENABLE_XHR_RESPONSE_BLOB) && ENABLE_XHR_RESPONSE_BLOB 95 readonly attribute [EnabledAtRuntime] Blob responseBlob 96 getter raises(DOMException); 97 #endif 87 98 readonly attribute unsigned short status 88 99 getter raises(DOMException); -
trunk/WebKit/chromium/ChangeLog
r66071 r66074 1 2010-08-25 Michael Nordman <michaeln@google.com> 2 3 Reviewed by David Levin. 4 5 https://bugs.webkit.org/show_bug.cgi?id=44133 6 WebKitAPI to allow runtime enablement of XmlHttpRequest.responseBlob. 7 8 * features.gypi: Define ENABLE_XHR_RESPONSE_BLOB. 9 * public/WebRuntimeFeatures.h: 10 * src/WebRuntimeFeatures.cpp: 11 (WebKit::WebRuntimeFeatures::enableXHRResponseBlob): 12 (WebKit::WebRuntimeFeatures::isXHRResponseBlobEnabled): 13 1 14 2010-08-24 Victoria Kirst <vrk@google.com> 2 15 -
trunk/WebKit/chromium/features.gypi
r65766 r66074 82 82 'ENABLE_WEB_TIMING=1', 83 83 'ENABLE_WORKERS=1', 84 'ENABLE_XHR_RESPONSE_BLOB=1', 84 85 'ENABLE_XPATH=1', 85 86 'ENABLE_XSLT=1', -
trunk/WebKit/chromium/public/WebRuntimeFeatures.h
r64851 r66074 87 87 WEBKIT_API static bool isSpeechInputEnabled(); 88 88 89 WEBKIT_API static void enableXHRResponseBlob(bool); 90 WEBKIT_API static bool isXHRResponseBlobEnabled(); 91 89 92 private: 90 93 WebRuntimeFeatures(); -
trunk/WebKit/chromium/src/WebRuntimeFeatures.cpp
r64972 r66074 257 257 } 258 258 259 void WebRuntimeFeatures::enableXHRResponseBlob(bool enable) 260 { 261 #if ENABLE(XHR_RESPONSE_BLOB) 262 RuntimeEnabledFeatures::setXHRResponseBlobEnabled(enable); 263 #endif 264 } 265 266 bool WebRuntimeFeatures::isXHRResponseBlobEnabled() 267 { 268 #if ENABLE(XHR_RESPONSE_BLOB) 269 return RuntimeEnabledFeatures::xhrResponseBlobEnabled(); 270 #else 271 return false; 272 #endif 273 } 274 259 275 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.