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

jianli at chromium.org jianli at chromium.org
Wed Dec 22 17:45:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2617dfe83a159aab1f5289a1de73df519f7b7c7b
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 03:20:30 2010 +0000

    Add send(ArrayBuffer) to XMLHttpRequest per XMLHttpRequest Level 2 spec
    https://bugs.webkit.org/show_bug.cgi?id=50199
    
    Reviewed by David Levin.
    
    WebCore:
    
    Test: http/tests/xmlhttprequest/send-array-buffer.html
    
    * bindings/js/JSXMLHttpRequestCustom.cpp:
    (WebCore::JSXMLHttpRequest::send):
    * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
    (WebCore::V8XMLHttpRequest::sendCallback):
    * xml/XMLHttpRequest.cpp:
    (WebCore::XMLHttpRequest::send):
    * xml/XMLHttpRequest.h:
    
    LayoutTests:
    
    * http/tests/xmlhttprequest/resources/post-echo-as-ascii.cgi: Added.
    * http/tests/xmlhttprequest/send-array-buffer-expected.txt: Added.
    * http/tests/xmlhttprequest/send-array-buffer.html: Added.
    * platform/gtk/Skipped:
    * platform/qt/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 27e7860..ffa8a93 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-29  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
+        Add send(ArrayBuffer) to XMLHttpRequest per XMLHttpRequest Level 2 spec
+        https://bugs.webkit.org/show_bug.cgi?id=50199
+
+        * http/tests/xmlhttprequest/resources/post-echo-as-ascii.cgi: Added.
+        * http/tests/xmlhttprequest/send-array-buffer-expected.txt: Added.
+        * http/tests/xmlhttprequest/send-array-buffer.html: Added.
+        * platform/gtk/Skipped:
+        * platform/qt/Skipped:
+
 2010-11-29  Xiaomei Ji  <xji at chromium.org>
 
         Unreviewed.
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/post-echo-as-ascii.cgi b/LayoutTests/http/tests/xmlhttprequest/resources/post-echo-as-ascii.cgi
new file mode 100755
index 0000000..c2046bf
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/resources/post-echo-as-ascii.cgi
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/plain\n\n"; 
+
+if ($ENV{'REQUEST_METHOD'} eq "POST") {
+    read(STDIN, $request, $ENV{'CONTENT_LENGTH'})
+                || die "Could not get query\n";
+    my @array = split //, $request;
+    @array = map(ord, @array);
+    print "@array";
+} else {
+    print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
+} 
diff --git a/LayoutTests/http/tests/xmlhttprequest/send-array-buffer-expected.txt b/LayoutTests/http/tests/xmlhttprequest/send-array-buffer-expected.txt
new file mode 100644
index 0000000..e5f7421
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/send-array-buffer-expected.txt
@@ -0,0 +1,2 @@
+Tests sending an array buffer.
+0 1 2 48 49 50 128 129 130 253 254 255
diff --git a/LayoutTests/http/tests/xmlhttprequest/send-array-buffer.html b/LayoutTests/http/tests/xmlhttprequest/send-array-buffer.html
new file mode 100644
index 0000000..6bc82cc
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/send-array-buffer.html
@@ -0,0 +1,25 @@
+<html>
+<body>
+Tests sending an array buffer.
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var console_messages = document.createElement("ul");
+document.body.appendChild(console_messages);
+
+function log(message)
+{
+    var item = document.createElement("li");
+    item.appendChild(document.createTextNode(message));
+    console_messages.appendChild(item);
+}
+
+var array = new Uint8Array([0, 1, 2, 48, 49, 50, 128, 129, 130, 253, 254, 255]);
+var xhr = new XMLHttpRequest;
+xhr.open("POST", "resources/post-echo-as-ascii.cgi", false);
+xhr.send(array.buffer);
+log(xhr.responseText);
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 8fff49a..df0b546 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1109,6 +1109,7 @@ fast/xmlhttprequest/xmlhttprequest-responsetype-abort.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-arraybuffer.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-document.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-text.html
+http/tests/xmlhttprequest/send-array-buffer.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=30508
 # All these tests fail because WebKit does not work correctly with
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index c570c73..bbc9f45 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -285,6 +285,7 @@ fast/xmlhttprequest/xmlhttprequest-responsetype-abort.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-arraybuffer.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-document.html
 fast/xmlhttprequest/xmlhttprequest-responsetype-text.html
+http/tests/xmlhttprequest/send-array-buffer.html
 
 # Missing DRT ability to set accept cookie policy
 http/tests/xmlhttprequest/cross-origin-cookie-storage.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 121dde3..b237de8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-29  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
+        Add send(ArrayBuffer) to XMLHttpRequest per XMLHttpRequest Level 2 spec
+        https://bugs.webkit.org/show_bug.cgi?id=50199
+
+        Test: http/tests/xmlhttprequest/send-array-buffer.html
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::send):
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::V8XMLHttpRequest::sendCallback):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::send):
+        * xml/XMLHttpRequest.h:
+
 2010-11-29  James Robinson  <jamesr at chromium.org>
 
         [chromium] REGRESSION(72470): Crash in skia on some images
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index b237aac..7cf8207 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -124,6 +124,10 @@ JSValue JSXMLHttpRequest::send(ExecState* exec)
             impl()->send(toBlob(val), ec);
         else if (val.inherits(&JSDOMFormData::s_info))
             impl()->send(toDOMFormData(val), ec);
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+        else if (val.inherits(&JSArrayBuffer::s_info))
+            impl()->send(toArrayBuffer(val), ec);
+#endif
         else
             impl()->send(ustringToString(val.toString(exec)), ec);
     }
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 5c56cfb..6a571ae 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -193,6 +193,13 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args)
             DOMFormData* domFormData = V8DOMFormData::toNative(object);
             ASSERT(domFormData);
             xmlHttpRequest->send(domFormData, ec);
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+        } else if (V8ArrayBuffer::HasInstance(arg)) {
+            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
+            ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object);
+            ASSERT(arrayBuffer);
+            xmlHttpRequest->send(arrayBuffer, ec);
+#endif
         } else
             xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
     }
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index 6103703..b0c7a87 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -586,6 +586,22 @@ void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec)
     createRequest(ec);
 }
 
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+void XMLHttpRequest::send(ArrayBuffer* body, ExceptionCode& ec)
+{
+    if (!initSend(ec))
+        return;
+
+    if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily()) {
+        m_requestEntityBody = FormData::create(body->data(), body->byteLength());
+        if (m_upload)
+            m_requestEntityBody->setAlwaysStream(true);
+    }
+
+    createRequest(ec);
+}
+#endif
+
 void XMLHttpRequest::createRequest(ExceptionCode& ec)
 {
 #if ENABLE(BLOB)
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
index 098e19f..bc6815d 100644
--- a/WebCore/xml/XMLHttpRequest.h
+++ b/WebCore/xml/XMLHttpRequest.h
@@ -94,6 +94,9 @@ public:
     void send(const String&, ExceptionCode&);
     void send(Blob*, ExceptionCode&);
     void send(DOMFormData*, ExceptionCode&);
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+    void send(ArrayBuffer*, ExceptionCode&);
+#endif
     void abort();
     void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&);
     void overrideMimeType(const String& override);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list