Add support for the Blob constructor
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2012 20:23:53 +0000 (20:23 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Apr 2012 20:23:53 +0000 (20:23 +0000)
commit7650134ae1fb66065707947bf09f0f8192afc593
tree4e8ba6f47743f69f34c328eefaac84424bf72ea1
parent2347286e6623e8ac70c0fd0d70d3495db4845fdc
Add support for the Blob constructor
https://bugs.webkit.org/show_bug.cgi?id=84555

Reviewed by Maciej Stachowiak.

Source/WebCore:

Test: fast/files/blob-constructor.html

This adds an implementation of the Blob constructor that willfully
violates the W3C Editor’s Draft 29 February 2012 in the following ways:
- Elements in the parts array are coerced to DOMStrings https://www.w3.org/Bugs/Public/show_bug.cgi?id=16721
- Don't throw for invalid key in the dictionary https://www.w3.org/Bugs/Public/show_bug.cgi?id=16727
- Values for the endings property are treated as enums https://www.w3.org/Bugs/Public/show_bug.cgi?id=16729

* bindings/js/JSBlobCustom.cpp:
(WebCore::JSBlobConstructor::constructJSBlob):
Implement blob constructor.

* bindings/v8/custom/V8BlobCustom.cpp:
(WebCore::V8Blob::constructorCallback):
Implement blob constructor.

* fileapi/Blob.idl:
Add constructor to IDL.

* workers/WorkerContext.idl:
Add Blob constructor to the worker global object.

LayoutTests:

Switch tests that were not directly testing BlobBuilder over to
using the Blob constructor, to get test coverage of standard way
constructing blobs.

* fast/files/blob-constructor.html:
* fast/files/blob-constructor-expected.txt:
* fast/files/script-tests/blob-constructor.js:
New test.

* fast/dom/HTMLAnchorElement/anchor-download-unset.html:
* fast/dom/HTMLAnchorElement/anchor-download.html:
* fast/dom/HTMLAnchorElement/anchor-nodownload-set.html:
* fast/dom/HTMLAnchorElement/anchor-nodownload.html:
* fast/dom/window-domurl-crash.html:
* fast/files/blob-builder-crash-expected.txt: Removed.
* fast/files/blob-builder-crash.html: Removed.
* fast/files/blob-slice-overflow.html:
* fast/files/blob-slice-test.html:
* fast/files/file-reader-fffd.html:
* fast/files/not-enough-arguments.html:
* fast/files/resources/read-blob-test-cases.js:
* fast/files/resources/read-common.js:
* fast/files/workers/inline-worker-via-blob-url.html:
* fast/filesystem/resources/file-writer-abort-continue.js:
* fast/filesystem/resources/file-writer-abort-depth.js:
* fast/filesystem/resources/file-writer-abort.js:
* fast/filesystem/resources/file-writer-events.js:
* fast/filesystem/resources/file-writer-gc-blob.js:
* fast/filesystem/resources/file-writer-sync-truncate-extend.js:
* fast/filesystem/resources/file-writer-sync-write-overlapped.js:
* fast/filesystem/resources/file-writer-utils.js:
* http/tests/fileapi/create-blob-url-from-data-url.html:
* http/tests/filesystem/no-cache-filesystem-url.html:
* http/tests/local/blob/resources/hybrid-blob-util.js:
* http/tests/security/resources/create-filesystem-file.html:
* http/tests/websocket/tests/hixie76/send-object.html:
* http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy.html:
* http/tests/websocket/tests/hybi/bufferedAmount-after-close.html:
* http/tests/websocket/tests/hybi/send-blob.html:
* http/tests/websocket/tests/hybi/send-file-blob-fail.html:
* http/tests/websocket/tests/hybi/send-file-blob.html:
* http/tests/websocket/tests/hybi/workers/resources/send-blob.js:
* platform/mac/fast/dom/Window/window-properties-expected.txt:
* storage/indexeddb/noblobs.html:
* storage/indexeddb/structured-clone.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115484 268f45cc-cd09-0410-ab3c-d52691b4dbfc
45 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLAnchorElement/anchor-download-unset.html
LayoutTests/fast/dom/HTMLAnchorElement/anchor-download.html
LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
LayoutTests/fast/dom/HTMLAnchorElement/anchor-nodownload.html
LayoutTests/fast/dom/window-domurl-crash.html
LayoutTests/fast/files/blob-constructor-expected.txt [new file with mode: 0644]
LayoutTests/fast/files/blob-constructor.html [new file with mode: 0644]
LayoutTests/fast/files/blob-slice-overflow.html
LayoutTests/fast/files/blob-slice-test.html
LayoutTests/fast/files/file-reader-fffd.html
LayoutTests/fast/files/not-enough-arguments.html
LayoutTests/fast/files/resources/read-blob-test-cases.js
LayoutTests/fast/files/resources/read-common.js
LayoutTests/fast/files/script-tests/blob-constructor.js [new file with mode: 0644]
LayoutTests/fast/files/workers/inline-worker-via-blob-url.html
LayoutTests/fast/filesystem/resources/file-writer-abort-continue.js
LayoutTests/fast/filesystem/resources/file-writer-abort-depth.js
LayoutTests/fast/filesystem/resources/file-writer-abort.js
LayoutTests/fast/filesystem/resources/file-writer-events.js
LayoutTests/fast/filesystem/resources/file-writer-gc-blob.js
LayoutTests/fast/filesystem/resources/file-writer-sync-truncate-extend.js
LayoutTests/fast/filesystem/resources/file-writer-sync-write-overlapped.js
LayoutTests/fast/filesystem/resources/file-writer-utils.js
LayoutTests/http/tests/fileapi/create-blob-url-from-data-url.html
LayoutTests/http/tests/filesystem/no-cache-filesystem-url.html
LayoutTests/http/tests/local/blob/resources/hybrid-blob-util.js
LayoutTests/http/tests/security/resources/create-filesystem-file.html
LayoutTests/http/tests/websocket/tests/hixie76/send-object.html
LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy.html
LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html
LayoutTests/http/tests/websocket/tests/hybi/send-blob.html
LayoutTests/http/tests/websocket/tests/hybi/send-file-blob-fail.html
LayoutTests/http/tests/websocket/tests/hybi/send-file-blob.html
LayoutTests/http/tests/websocket/tests/hybi/workers/resources/send-blob.js
LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt
LayoutTests/storage/indexeddb/noblobs.html
LayoutTests/storage/indexeddb/structured-clone.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSBlobCustom.cpp
Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp
Source/WebCore/fileapi/Blob.cpp
Source/WebCore/fileapi/Blob.h
Source/WebCore/fileapi/Blob.idl
Source/WebCore/workers/WorkerContext.idl