Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Blob is missing text() & arrayBuffer() operations
https://bugs.webkit.org/show_bug.cgi?id=215663 Reviewed by Geoff Garen. LayoutTests/imported/w3c: * web-platform-tests/FileAPI/blob/Blob-array-buffer.any-expected.txt: * web-platform-tests/FileAPI/blob/Blob-array-buffer.any.worker-expected.txt: * web-platform-tests/FileAPI/blob/Blob-text.any-expected.txt: * web-platform-tests/FileAPI/blob/Blob-text.any.worker-expected.txt: * web-platform-tests/FileAPI/idlharness-expected.txt: * web-platform-tests/FileAPI/idlharness.worker-expected.txt: Source/WebCore: Implementation support for Blob.text() & Blob.arrayBuffer() as per specification: - https://w3c.github.io/FileAPI/#blob-section The implementation relies on the pre-existing BlobLoader class but the following changes were made: - Stop calling start() in the BlobLoader constructor and have the caller call start() explicitly after constructing the BlobLoader. This is important because the load may fail synchronously in some cases. - Add support for reading Blob as text. Previously, BlobLoader would only support reading the blob as an ArrayBuffer. - Use a CompletionHandler instead of a Function and make sure that it is always called. No new tests, rebaselined existing tests. * fileapi/Blob.cpp: (WebCore::Blob::~Blob): (WebCore::Blob::loadBlob): (WebCore::Blob::text): (WebCore::Blob::arrayBuffer): * fileapi/Blob.h: * fileapi/Blob.idl: * fileapi/BlobLoader.h: (WebCore::BlobLoader::BlobLoader): (WebCore::BlobLoader::~BlobLoader): (WebCore::BlobLoader::cancel): (WebCore::BlobLoader::start): (WebCore::BlobLoader::didFinishLoading): (WebCore::BlobLoader::didFail): (WebCore::BlobLoader::complete): Deleted. * fileapi/NetworkSendQueue.cpp: (WebCore::NetworkSendQueue::enqueue): (WebCore::NetworkSendQueue::clear): (WebCore::NetworkSendQueue::processMessages): * page/ShareDataReader.cpp: (WebCore::ShareDataReader::start): (WebCore::ShareDataReader::didFinishLoading): (WebCore::ShareDataReader::cancel): Canonical link: https://commits.webkit.org/228429@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
18 changed files
with
206 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-array-buffer.any-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
FAIL Blob.arrayBuffer() promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() empty Blob data promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() non-ascii input promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() non-unicode input promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() concurrent reads promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
PASS Blob.arrayBuffer() | ||
PASS Blob.arrayBuffer() empty Blob data | ||
PASS Blob.arrayBuffer() non-ascii input | ||
PASS Blob.arrayBuffer() non-unicode input | ||
PASS Blob.arrayBuffer() concurrent reads | ||
|
10 changes: 5 additions & 5 deletions
10
...ts/imported/w3c/web-platform-tests/FileAPI/blob/Blob-array-buffer.any.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
FAIL Blob.arrayBuffer() promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() empty Blob data promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() non-ascii input promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() non-unicode input promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
FAIL Blob.arrayBuffer() concurrent reads promise_test: Unhandled rejection with value: object "TypeError: blob.arrayBuffer is not a function. (In 'blob.arrayBuffer()', 'blob.arrayBuffer' is undefined)" | ||
PASS Blob.arrayBuffer() | ||
PASS Blob.arrayBuffer() empty Blob data | ||
PASS Blob.arrayBuffer() non-ascii input | ||
PASS Blob.arrayBuffer() non-unicode input | ||
PASS Blob.arrayBuffer() concurrent reads | ||
|
16 changes: 8 additions & 8 deletions
16
LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-text.any-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
FAIL Blob.text() promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() empty blob data promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() multi-element array in constructor promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() non-unicode promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() different charset param in type option promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() different charset param with non-ascii input promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() invalid utf-8 input promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() concurrent reads promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
PASS Blob.text() | ||
PASS Blob.text() empty blob data | ||
PASS Blob.text() multi-element array in constructor | ||
PASS Blob.text() non-unicode | ||
PASS Blob.text() different charset param in type option | ||
PASS Blob.text() different charset param with non-ascii input | ||
PASS Blob.text() invalid utf-8 input | ||
PASS Blob.text() concurrent reads | ||
|
16 changes: 8 additions & 8 deletions
16
LayoutTests/imported/w3c/web-platform-tests/FileAPI/blob/Blob-text.any.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
FAIL Blob.text() promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() empty blob data promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() multi-element array in constructor promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() non-unicode promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() different charset param in type option promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() different charset param with non-ascii input promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() invalid utf-8 input promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
FAIL Blob.text() concurrent reads promise_test: Unhandled rejection with value: object "TypeError: blob.text is not a function. (In 'blob.text()', 'blob.text' is undefined)" | ||
PASS Blob.text() | ||
PASS Blob.text() empty blob data | ||
PASS Blob.text() multi-element array in constructor | ||
PASS Blob.text() non-unicode | ||
PASS Blob.text() different charset param in type option | ||
PASS Blob.text() different charset param with non-ascii input | ||
PASS Blob.text() invalid utf-8 input | ||
PASS Blob.text() concurrent reads | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ests/imported/w3c/web-platform-tests/IndexedDB/blob-valid-after-deletion.any-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Blobs stay alive after their records are deleted. record.a0.text is not a function. (In 'record.a0.text()', 'record.a0.text' is undefined) | ||
PASS Blobs stay alive after their records are deleted. | ||
|
2 changes: 1 addition & 1 deletion
2
...ported/w3c/web-platform-tests/IndexedDB/blob-valid-after-deletion.any.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Blobs stay alive after their records are deleted. record.a0.text is not a function. (In 'record.a0.text()', 'record.a0.text' is undefined) | ||
PASS Blobs stay alive after their records are deleted. | ||
|
2 changes: 1 addition & 1 deletion
2
...Tests/imported/w3c/web-platform-tests/IndexedDB/blob-valid-before-commit.any-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Blobs can be read back before their records are committed. record.a0.text is not a function. (In 'record.a0.text()', 'record.a0.text' is undefined) | ||
PASS Blobs can be read back before their records are committed. | ||
|
2 changes: 1 addition & 1 deletion
2
...mported/w3c/web-platform-tests/IndexedDB/blob-valid-before-commit.any.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Blobs can be read back before their records are committed. record.a0.text is not a function. (In 'record.a0.text()', 'record.a0.text' is undefined) | ||
PASS Blobs can be read back before their records are committed. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.