Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Drop [UsePointersEvenForNonNullableObjectArguments] from File API int…
…erfaces https://bugs.webkit.org/show_bug.cgi?id=156898 Reviewed by Chris Dumez. Source/WebCore: Making FileReaderSync API API throwing a TypeError in case of null parameters, in lieu of a NOT_FOUND_ERR. Making FileReader API taking nullable parameters as a temporary fix. Test: fast/files/workers/worker-file-reader-sync-bad-parameter.html * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::processOutgoingFrameQueue): Updated to cope with FileReaderLoader::start taking a Blob&. * fileapi/FileReader.cpp: (WebCore::FileReader::readAsArrayBuffer): Updated to cope with readInternal taking a Blob&. (WebCore::FileReader::readAsBinaryString): Ditto. (WebCore::FileReader::readAsText): Ditto. (WebCore::FileReader::readAsDataURL): Ditto. (WebCore::FileReader::readInternal): Updated to cope with FileReaderLoader::start taking a Blob&. * fileapi/FileReader.h: * fileapi/FileReader.idl: Marking the readXX methods as taking a nullable blob parameter to keep compatibility, at least temporarily. * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::start): It now takes a Blob& as input. * fileapi/FileReaderLoader.h: * fileapi/FileReaderSync.cpp: (WebCore::FileReaderSync::readAsArrayBuffer): Taking a Blob& as input. (WebCore::FileReaderSync::readAsBinaryString): Ditto. (WebCore::FileReaderSync::readAsText): Ditto. (WebCore::FileReaderSync::readAsDataURL): Ditto. (WebCore::FileReaderSync::startLoading) Ditto. * fileapi/FileReaderSync.h: (WebCore::FileReaderSync::readAsText): Ditto. * fileapi/FileReaderSync.idl: LayoutTests: Checking FileReaderSync send method in case of null or undefined blob parameter. worker-read-blob-sync.html and worker-read-file-sync check the case of badly typed parameters. In all cases, TypeError is thrown. * fast/files/workers/resources/worker-file-reader-sync-bad-parameter.js: Added. (test): * fast/files/workers/worker-file-reader-sync-bad-parameter-expected.txt: Added. * fast/files/workers/worker-file-reader-sync-bad-parameter.html: Added. * fast/files/workers/worker-read-blob-sync-expected.txt: Rebasing expectation. * fast/files/workers/worker-read-file-sync-expected.txt: Ditto. Canonical link: https://commits.webkit.org/175083@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
16 changed files
with
162 additions
and
89 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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if (self.importScripts) | ||
self.importScripts('../../../../resources/testharness.js'); | ||
|
||
test(function() { | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsBinaryString(null); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsArrayBuffer(null); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsText(null); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsDataURL(null); }); | ||
}, "Trying to read a null parameter"); | ||
|
||
|
||
test(function() { | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsBinaryString(undefined); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsArrayBuffer(undefined); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsText(undefined); }); | ||
assert_throws(new TypeError(), function() { new FileReaderSync().readAsDataURL(undefined); }); | ||
}, "Trying to read an undefined parameter"); | ||
|
||
done(); |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS Trying to read a null parameter | ||
PASS Trying to read an undefined parameter | ||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Checking FileReaderSync API in case of null and undefined blob parameter</title> | ||
<meta name="help" href="https://fetch.spec.whatwg.org/#fetching"> | ||
<meta name="author" title="Canon Research France" href="https://www.crf.canon.fr"> | ||
<script src="../../../resources/testharness.js"></script> | ||
<script src="../../../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
fetch_tests_from_worker(new Worker("resources/worker-file-reader-sync-bad-parameter.js")); | ||
</script> | ||
</body> | ||
</html> | ||
|
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
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
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.