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

jianli at chromium.org jianli at chromium.org
Wed Dec 22 12:49:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a1450b376c2e42d6dcf1856df195da910acfea25
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 31 07:25:37 2010 +0000

    Expose window.createBlobURL and window.revokeBlobURL.
    https://bugs.webkit.org/show_bug.cgi?id=44908
    
    Reviewed by David Levin.
    
    WebCore:
    
    Tests: fast/files/apply-blob-url-to-img.html
           fast/files/apply-blob-url-to-xhr.html
    
    * page/DOMWindow.cpp:
    (WebCore::DOMWindow::createBlobURL):
    (WebCore::DOMWindow::revokeBlobURL):
    * page/DOMWindow.h:
    * page/DOMWindow.idl:
    * xml/XMLHttpRequest.cpp:
    (WebCore::XMLHttpRequest::createRequest):
    
    LayoutTests:
    
    * fast/dom/Window/script-tests/window-property-descriptors.js:
    * fast/dom/Window/window-properties.html:
    * fast/dom/script-tests/prototype-inheritance.js:
    * fast/files/apply-blob-url-to-img.html: Added.
    * fast/files/apply-blob-url-to-xhr-expected.txt: Added.
    * fast/files/apply-blob-url-to-xhr.html: Added.
    * fast/files/resources/abe.png: Copied from LayoutTests/editing/resources/abe.png.
    * platform/chromium/test_expectations.txt:
    * platform/gtk/Skipped:
    * platform/mac-wk2/Skipped:
    * platform/mac/fast/files/apply-blob-url-to-img-expected.checksum: Added.
    * platform/mac/fast/files/apply-blob-url-to-img-expected.png: Added.
    * platform/mac/fast/files/apply-blob-url-to-img-expected.txt: Added.
    * platform/qt/Skipped:
    * platform/win/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66462 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7f060b8..dbf743d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,29 @@
 
         Reviewed by David Levin.
 
+        Expose window.createBlobURL and window.revokeBlobURL.
+        https://bugs.webkit.org/show_bug.cgi?id=44908
+
+        * fast/dom/Window/script-tests/window-property-descriptors.js:
+        * fast/dom/Window/window-properties.html:
+        * fast/dom/script-tests/prototype-inheritance.js:
+        * fast/files/apply-blob-url-to-img.html: Added.
+        * fast/files/apply-blob-url-to-xhr-expected.txt: Added.
+        * fast/files/apply-blob-url-to-xhr.html: Added.
+        * fast/files/resources/abe.png: Copied from LayoutTests/editing/resources/abe.png.
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac-wk2/Skipped:
+        * platform/mac/fast/files/apply-blob-url-to-img-expected.checksum: Added.
+        * platform/mac/fast/files/apply-blob-url-to-img-expected.png: Added.
+        * platform/mac/fast/files/apply-blob-url-to-img-expected.txt: Added.
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
+2010-08-31  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
         Support FileReaderSync in workers.
         https://bugs.webkit.org/show_bug.cgi?id=44657
 
diff --git a/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js b/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
index 59c99f9..bd03d8e 100644
--- a/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
+++ b/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
@@ -55,7 +55,11 @@ for (var name in protoPropertySet)
     protoPropertyNames.push(name);
 protoPropertyNames.sort();
 
-for (var i = 0; i < protoPropertyNames.length; ++i)
+for (var i = 0; i < protoPropertyNames.length; ++i) {
+    // Ignore these properties because they do not exist in all implementations.
+    if (protoPropertyNames[i] == "createBlobURL" || protoPropertyNames[i] == "revokeBlobURL")
+        continue;
     shouldBeUndefined("Object.getOwnPropertyDescriptor(window, '" + protoPropertyNames[i] + "')");
+}
 
 var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Window/window-properties.html b/LayoutTests/fast/dom/Window/window-properties.html
index 3e0aaa3..24ea0c8 100644
--- a/LayoutTests/fast/dom/Window/window-properties.html
+++ b/LayoutTests/fast/dom/Window/window-properties.html
@@ -80,6 +80,8 @@ var __skip__ = {
     "window.DeviceMotionEvent" : 1,
     "window.ondevicemotion" : 1,
     "window.webkitPerformance" : 1,
+    "window.createBlobURL" : 1,
+    "window.revokeBlobURL" : 1,
 
     // showModalDialog is not implemented on all platforms in DumpRenderTree.
     "window.showModalDialog" : 1,
diff --git a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
index 843d8bb..68857e7 100644
--- a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
+++ b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
@@ -21,6 +21,7 @@ var skippedProperties = [
     "FileError", "FileReader",
     "indexedDB", "IDBKeyRange",
     "showModalDialog",
+    "createBlobURL", "revokeBlobURL",
     // Ignore this property because it only appears in debug builds.
     "jscprint"
 ];
diff --git a/LayoutTests/fast/files/apply-blob-url-to-img.html b/LayoutTests/fast/files/apply-blob-url-to-img.html
new file mode 100644
index 0000000..617cadb
--- /dev/null
+++ b/LayoutTests/fast/files/apply-blob-url-to-img.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input type="file" name="file" id="file" onchange="onInputFileChange()">
+<img id='imgToReplace' src=''>
+<pre id='console'></pre>
+
+<script>
+function onInputFileChange(file)
+{
+    var file = document.getElementById("file").files[0];
+    document.getElementById('imgToReplace').src = window.createBlobURL(file);
+}
+
+function runTests()
+{
+    eventSender.beginDragWithFiles(['resources/abe.png']);
+    eventSender.mouseMoveTo(10, 10);
+    eventSender.mouseUp();
+}
+
+if (window.eventSender) {
+    window.onload = runTests;
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt b/LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt
new file mode 100644
index 0000000..a24c719
--- /dev/null
+++ b/LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt
@@ -0,0 +1,8 @@
+
+Test that XMLHttpRequest GET succeeds.
+Hello
+Test that XMLHttpRequest POST fails.
+Received exception 101: NETWORK_ERR
+
+DONE
+
diff --git a/LayoutTests/fast/files/apply-blob-url-to-xhr.html b/LayoutTests/fast/files/apply-blob-url-to-xhr.html
new file mode 100644
index 0000000..6a74c3d
--- /dev/null
+++ b/LayoutTests/fast/files/apply-blob-url-to-xhr.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input type="file" name="file" id="file" onchange="onInputFileChange()">
+<pre id='console'></pre>
+
+<script>
+function log(message)
+{
+    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+function onInputFileChange(file)
+{
+    var file = document.getElementById("file").files[0];
+    var fileURL = window.createBlobURL(file);
+
+    log("Test that XMLHttpRequest GET succeeds.");
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", fileURL, false);
+    xhr.send();
+    log(xhr.responseText);
+
+    log("Test that XMLHttpRequest POST fails.");
+    xhr = new XMLHttpRequest();
+    xhr.open("POST", fileURL, false);
+    try {
+        xhr.send();
+    } catch (error) {
+        log("Received exception " + error.code + ": " + error.name);
+    }
+    log(xhr.responseText);
+
+    log("DONE");
+    if (layoutTestController.notifyDone)
+        layoutTestController.notifyDone();
+}
+
+function runTests()
+{
+    eventSender.beginDragWithFiles(['resources/UTF8.txt']);
+    eventSender.mouseMoveTo(10, 10);
+    eventSender.mouseUp();
+}
+
+if (window.eventSender) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+    window.onload = runTests;
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt b/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt
new file mode 100644
index 0000000..3691a58
Binary files /dev/null and b/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt differ
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 28aac93..376c890 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3177,3 +3177,6 @@ BUG47946 WIN LINUX MAC : scrollbars/custom-scrollbar-with-incomplete-style.html
 
 // Doesn't apply to Chromium (QuickTime-specific behavior)
 WONTFIX SKIP : media/video-does-not-loop.html = TIMEOUT
+
+// Need rebaseline
+BUGJIANLI : files/apply-blob-url-to-img.html = FAIL
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index ace3844..53a57f7 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -3148,6 +3148,8 @@ http/tests/local/formdata/send-form-data-with-sliced-file.html
 http/tests/local/formdata/upload-events.html
 fast/files/read-blob-async.html
 fast/files/read-file-async.html
+fast/files/apply-blob-url-to-img.html
+fast/files/apply-blob-url-to-xhr.html
 fast/files/workers
 http/tests/media/video-play-stall-seek.html
 http/tests/media/video-play-stall.html
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index 465be8d..fd3fbf6 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -366,6 +366,8 @@ fast/events/window-events-capture.html
 fast/events/zoom-dblclick.html
 fast/files/read-blob-async.html
 fast/files/read-file-async.html
+fast/files/apply-blob-url-to-img.html
+fast/files/apply-blob-url-to-xhr.html
 fast/files/workers
 fast/forms/25153.html
 fast/forms/access-key.html
diff --git a/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.checksum b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.checksum
new file mode 100644
index 0000000..5ae583f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.checksum
@@ -0,0 +1 @@
+7740b21739fb6ed55a8b44322626aafa
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.png b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.png
new file mode 100644
index 0000000..d9f5865
Binary files /dev/null and b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.txt b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.txt
new file mode 100644
index 0000000..684a3bf
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/files/apply-blob-url-to-img-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x131
+  RenderBlock {HTML} at (0,0) size 800x131
+    RenderBody {BODY} at (8,8) size 784x110
+      RenderBlock (anonymous) at (0,0) size 784x110
+        RenderFileUploadControl {INPUT} at (2,90) size 237x18 "abe.png"
+          RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
+            RenderBlock (anonymous) at (8,2) size 62x13
+              RenderText at (0,0) size 62x13
+                text run at (0,0) width 62: "Choose File"
+        RenderText {#text} at (241,89) size 4x18
+          text run at (241,89) width 4: " "
+        RenderImage {IMG} at (245,0) size 76x103
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {PRE} at (0,123) size 784x0
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 614c590..2cca5b7 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -783,6 +783,8 @@ http/tests/security/isolatedWorld/world-reuse.html
 fast/dom/Window/window-postmessage-clone-frames.html
 fast/files/read-blob-async.html
 fast/files/read-file-async.html
+fast/files/apply-blob-url-to-img.html
+fast/files/apply-blob-url-to-xhr.html
 fast/files/workers
 
 # Missing layoutTestController.setAlwaysAcceptCookies()
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 8af9e31..53edd35 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -197,6 +197,8 @@ fast/events/drag-file-crash.html
 fast/dom/Window/window-postmessage-clone.html
 fast/files/read-blob-async.html
 fast/files/read-file-async.html
+fast/files/apply-blob-url-to-img.html
+fast/files/apply-blob-url-to-xhr.html
 fast/files/workers
 
 # Need to add functionality to DumpRenderTree to test IDN <rdar://problem/5301954>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 45b7355..c63e0f9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,24 @@
 
         Reviewed by David Levin.
 
+        Expose window.createBlobURL and window.revokeBlobURL.
+        https://bugs.webkit.org/show_bug.cgi?id=44908
+
+        Tests: fast/files/apply-blob-url-to-img.html
+               fast/files/apply-blob-url-to-xhr.html
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::createBlobURL):
+        (WebCore::DOMWindow::revokeBlobURL):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::createRequest):
+
+2010-08-31  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
         Support FileReaderSync in workers.
         https://bugs.webkit.org/show_bug.cgi?id=44657
 
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 6a4d12f..a6e8b40 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -63,6 +63,7 @@
 #include "IDBKeyRange.h"
 #include "InspectorController.h"
 #include "InspectorTimelineAgent.h"
+#include "KURL.h"
 #include "Location.h"
 #include "StyleMedia.h"
 #include "MessageEvent.h"
@@ -1571,4 +1572,16 @@ EventTargetData* DOMWindow::ensureEventTargetData()
     return &m_eventTargetData;
 }
 
+#if ENABLE(BLOB)
+String DOMWindow::createBlobURL(Blob* blob)
+{
+    return scriptExecutionContext()->createPublicBlobURL(blob).string();
+}
+
+void DOMWindow::revokeBlobURL(const String& blobURLString)
+{
+    scriptExecutionContext()->revokePublicBlobURL(KURL(ParsedURLString, blobURLString));
+}
+#endif
+
 } // namespace WebCore
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index db453bb..0a5a05d 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -382,6 +382,10 @@ namespace WebCore {
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         DOMApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); }
 #endif
+#if ENABLE(BLOB)
+        String createBlobURL(Blob*);
+        void revokeBlobURL(const String&);
+#endif
 
         using RefCounted<DOMWindow>::ref;
         using RefCounted<DOMWindow>::deref;
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 19bcbee..960fcf6 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -743,6 +743,11 @@ module window {
 
         attribute [Conditional=BLOB] BlobBuilderConstructor BlobBuilder;
 
+#if defined(ENABLE_BLOB) && ENABLE_BLOB
+        DOMString createBlobURL(in Blob blob);
+        void revokeBlobURL(in DOMString blobURL);
+#endif
+
 #endif // defined(LANGUAGE_JAVASCRIPT)
 
 #if defined(V8_BINDING) && V8_BINDING
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index 37e5833..b58e3aa 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -559,6 +559,14 @@ void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec)
 
 void XMLHttpRequest::createRequest(ExceptionCode& ec)
 {
+#if ENABLE(BLOB)
+    // Only GET request is supported for blob URL.
+    if (m_url.protocolIs("blob") && m_method != "GET") {
+        ec = XMLHttpRequestException::NETWORK_ERR;
+        return;
+    }
+#endif
+
     // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not
     // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all.
     // Also, only async requests support upload progress events.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list