source: trunk/LayoutTests/fast/files/workers/inline-worker-via-blob-url.html @ 115484

Revision 115484, 1019 bytes checked in by weinig@apple.com, 2 years ago (diff)

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:

  • 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:
Line 
1<!DOCTYPE html>
2<html>
3<head>
4<script>
5function log(message)
6{
7    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
8}
9
10function runTest()
11{
12    log("Test inline web worker via blob URL.");
13    var string = [
14        "onmessage = function(e) {",
15        "    postMessage('Hello from worker');",
16        "};"
17    ].join('\n'));
18    var blobURL = webkitURL.createObjectURL(new Blob([string]));
19    var worker = new Worker(blobURL);
20    worker.onmessage = function(event) {
21        log(event.data);
22        log("DONE");
23        if (layoutTestController.notifyDone)
24            layoutTestController.notifyDone();
25    };
26    worker.postMessage();
27}
28
29if (window.layoutTestController) {
30    layoutTestController.setAllowUniversalAccessFromFileURLs(false);
31    layoutTestController.setAllowFileAccessFromFileURLs(true);
32    layoutTestController.dumpAsText();
33    layoutTestController.waitUntilDone();
34}
35</script>
36</head>
37<body onload="runTest()">
38<pre id='console'></pre>
39</body>
40</html>
Note: See TracBrowser for help on using the repository browser.