Title: [199985] trunk
Revision
199985
Author
[email protected]
Date
2016-04-25 03:23:41 -0700 (Mon, 25 Apr 2016)

Log Message

Drop [UsePointersEvenForNonNullableObjectArguments] from File API interfaces
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199984 => 199985)


--- trunk/LayoutTests/ChangeLog	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/LayoutTests/ChangeLog	2016-04-25 10:23:41 UTC (rev 199985)
@@ -1,3 +1,21 @@
+2016-04-25  Youenn Fablet  <[email protected]>
+
+        Drop [UsePointersEvenForNonNullableObjectArguments] from File API interfaces
+        https://bugs.webkit.org/show_bug.cgi?id=156898
+
+        Reviewed by Chris Dumez.
+
+        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.
+
 2016-04-25  Manuel Rego Casasnovas  <[email protected]>
 
         [css-grid] Fix grid-template-columns|rows computed style with content alignment

Added: trunk/LayoutTests/fast/files/workers/resources/worker-file-reader-sync-bad-parameter.js (0 => 199985)


--- trunk/LayoutTests/fast/files/workers/resources/worker-file-reader-sync-bad-parameter.js	                        (rev 0)
+++ trunk/LayoutTests/fast/files/workers/resources/worker-file-reader-sync-bad-parameter.js	2016-04-25 10:23:41 UTC (rev 199985)
@@ -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();

Added: trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter-expected.txt (0 => 199985)


--- trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter-expected.txt	2016-04-25 10:23:41 UTC (rev 199985)
@@ -0,0 +1,4 @@
+
+PASS Trying to read a null parameter 
+PASS Trying to read an undefined parameter 
+

Added: trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter.html (0 => 199985)


--- trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter.html	                        (rev 0)
+++ trunk/LayoutTests/fast/files/workers/worker-file-reader-sync-bad-parameter.html	2016-04-25 10:23:41 UTC (rev 199985)
@@ -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=""
+        <meta name="author" title="Canon Research France" href=""
+        <script src=""
+        <script src=""
+    </head>
+    <body>
+        <script>
+            fetch_tests_from_worker(new Worker("resources/worker-file-reader-sync-bad-parameter.js"));
+        </script>
+    </body>
+</html>
+

Modified: trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt (199984 => 199985)


--- trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/LayoutTests/fast/files/workers/worker-read-blob-sync-expected.txt	2016-04-25 10:23:41 UTC (rev 199985)
@@ -2,77 +2,77 @@
 Received files in worker
 Test reading a blob containing non-existent file
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing existent and non-existent file
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing empty file
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing empty text
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing empty files and empty texts
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing single file
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing single text
 result size: 5
 result: First
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing single text as data URL
 result size: 21
 result: data:;base64,Rmlyc3Q=
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing single text as data URL (optional content type provided)
 result size: 29
 result: data:type/foo;base64,Rmlyc3Q=
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing single ArrayBuffer
 result size: 9
 result: 0x0 0x1 0x2 0x80 0x81 0x82 0xfd 0xfe 0xff
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing sliced file
 result size: 5
 result: onder
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing sliced text
 result size: 4
 result: irst
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing sliced ArrayBuffer
 result size: 8
 result: 0x1 0x2 0x80 0x81 0x82 0xfd 0xfe 0xff
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing multiple files
 result size: 19
 result: HelloWonderfulWorld
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing multiple texts
 result size: 16
 result: FirstSecondThird
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a blob containing multiple ArrayBuffer
 result size: 9
 result: 0x0 0x1 0x2 0x80 0x81 0x82 0xfd 0xfe 0xff
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a hybrid blob
 result size: 38
 result: FirstHelloSecondWonderfulWorldThird012
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a sliced hybrid blob
 result size: 12
 result: lloSecondWon
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a triple-sliced hybrid blob
 result size: 30
 result: ondWonderfulWorldThird012Foolo
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 DONE
 

Modified: trunk/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt (199984 => 199985)


--- trunk/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/LayoutTests/fast/files/workers/worker-read-file-sync-expected.txt	2016-04-25 10:23:41 UTC (rev 199985)
@@ -2,80 +2,80 @@
 Received files in worker
 Test reading a non-existent file as array buffer
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a non-existent file as binary string
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a non-existent file as text
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a non-existent file as data URL
 Received exception 1: NOT_FOUND_ERR
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading an empty file as array buffer
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading an empty file as binary string
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading an empty file as text
 result size: 0
 result: 
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading an empty file as data URL
 result size: 5
 result: data:
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-8 file as array buffer
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-8 file as binary string
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a binary file as array buffer
 result size: 9
 result: 0x0 0x1 0x2 0x80 0x81 0x82 0xfd 0xfe 0xff
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a binary file as binary string
 result size: 9
 result: 0x0 0x1 0x2 0x80 0x81 0x82 0xfd 0xfe 0xff
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-8 file as text
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-16BE BOM file as text
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-16LE BOM file as text
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-8 BOM file as text
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-16BE file as text with UTF-16BE encoding
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-16BE BOM file as text with UTF8 encoding
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-16BE BOM file as text with invalid encoding
 result size: 5
 result: Hello
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test reading a UTF-8 file as data URL
 result size: 31
 result: data:text/plain;base64,SGVsbG8=
-Received exception 8: NotFoundError
+Received exception undefined: TypeError
 Test calling multiple read methods in a row
 result size: 5
 result: Hello

Modified: trunk/Source/WebCore/ChangeLog (199984 => 199985)


--- trunk/Source/WebCore/ChangeLog	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/ChangeLog	2016-04-25 10:23:41 UTC (rev 199985)
@@ -1,3 +1,38 @@
+2016-04-25  Youenn Fablet  <[email protected]>
+
+        Drop [UsePointersEvenForNonNullableObjectArguments] from File API interfaces
+        https://bugs.webkit.org/show_bug.cgi?id=156898
+
+        Reviewed by Chris Dumez.
+
+        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:
+
 2016-04-25  Manuel Rego Casasnovas  <[email protected]>
 
         [css-grid] Fix grid-template-columns|rows computed style with content alignment

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (199984 => 199985)


--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2016-04-25 10:23:41 UTC (rev 199985)
@@ -750,9 +750,10 @@
             case BlobLoaderNotStarted:
                 ref(); // Will be derefed after didFinishLoading() or didFail().
                 ASSERT(!m_blobLoader);
+                ASSERT(frame->blobData);
                 m_blobLoader = std::make_unique<FileReaderLoader>(FileReaderLoader::ReadAsArrayBuffer, this);
                 m_blobLoaderStatus = BlobLoaderStarted;
-                m_blobLoader->start(m_document, frame->blobData.get());
+                m_blobLoader->start(m_document, *frame->blobData);
                 m_outgoingFrameQueue.prepend(frame.release());
                 return;
 

Modified: trunk/Source/WebCore/fileapi/FileReader.cpp (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReader.cpp	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReader.cpp	2016-04-25 10:23:41 UTC (rev 199985)
@@ -88,7 +88,7 @@
 
     LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", blob->url().string().utf8().data(), is<File>(*blob) ? downcast<File>(*blob).path().utf8().data() : "");
 
-    readInternal(blob, FileReaderLoader::ReadAsArrayBuffer, ec);
+    readInternal(*blob, FileReaderLoader::ReadAsArrayBuffer, ec);
 }
 
 void FileReader::readAsBinaryString(Blob* blob, ExceptionCode& ec)
@@ -98,7 +98,7 @@
 
     LOG(FileAPI, "FileReader: reading as binary: %s %s\n", blob->url().string().utf8().data(), is<File>(*blob) ? downcast<File>(*blob).path().utf8().data() : "");
 
-    readInternal(blob, FileReaderLoader::ReadAsBinaryString, ec);
+    readInternal(*blob, FileReaderLoader::ReadAsBinaryString, ec);
 }
 
 void FileReader::readAsText(Blob* blob, const String& encoding, ExceptionCode& ec)
@@ -109,7 +109,7 @@
     LOG(FileAPI, "FileReader: reading as text: %s %s\n", blob->url().string().utf8().data(), is<File>(*blob) ? downcast<File>(*blob).path().utf8().data() : "");
 
     m_encoding = encoding;
-    readInternal(blob, FileReaderLoader::ReadAsText, ec);
+    readInternal(*blob, FileReaderLoader::ReadAsText, ec);
 }
 
 void FileReader::readAsText(Blob* blob, ExceptionCode& ec)
@@ -124,10 +124,10 @@
 
     LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", blob->url().string().utf8().data(), is<File>(*blob) ? downcast<File>(*blob).path().utf8().data() : "");
 
-    readInternal(blob, FileReaderLoader::ReadAsDataURL, ec);
+    readInternal(*blob, FileReaderLoader::ReadAsDataURL, ec);
 }
 
-void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, ExceptionCode& ec)
+void FileReader::readInternal(Blob& blob, FileReaderLoader::ReadType type, ExceptionCode& ec)
 {
     // If multiple concurrent read methods are called on the same FileReader, INVALID_STATE_ERR should be thrown when the state is LOADING.
     if (m_state == LOADING) {
@@ -137,7 +137,7 @@
 
     setPendingActivity(this);
 
-    m_blob = blob;
+    m_blob = &blob;
     m_readType = type;
     m_state = LOADING;
     m_error = nullptr;
@@ -145,7 +145,7 @@
     m_loader = std::make_unique<FileReaderLoader>(m_readType, this);
     m_loader->setEncoding(m_encoding);
     m_loader->setDataType(m_blob->type());
-    m_loader->start(scriptExecutionContext(), m_blob.get());
+    m_loader->start(scriptExecutionContext(), blob);
 }
 
 void FileReader::abort()

Modified: trunk/Source/WebCore/fileapi/FileReader.h (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReader.h	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReader.h	2016-04-25 10:23:41 UTC (rev 199985)
@@ -105,7 +105,7 @@
     void derefEventTarget() override { deref(); }
 
     void terminate();
-    void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionCode&);
+    void readInternal(Blob&, FileReaderLoader::ReadType, ExceptionCode&);
     void fireErrorEvent(int httpStatusCode);
     void fireEvent(const AtomicString& type);
 

Modified: trunk/Source/WebCore/fileapi/FileReader.idl (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReader.idl	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReader.idl	2016-04-25 10:23:41 UTC (rev 199985)
@@ -34,7 +34,6 @@
     ActiveDOMObject,
     Constructor,
     ConstructorCallWith=ScriptExecutionContext,
-    UsePointersEvenForNonNullableObjectArguments,
 ] interface FileReader : EventTarget {
     // ready states
     const unsigned short EMPTY = 0;
@@ -42,11 +41,12 @@
     const unsigned short DONE = 2;
     readonly attribute unsigned short readyState;
 
+    // FIXME: In all four methods found below, the blob parameter should not be nullable.
     // async read methods
-    [RaisesException] void readAsArrayBuffer(Blob blob);
-    [RaisesException] void readAsBinaryString(Blob blob);
-    [RaisesException] void readAsText(Blob blob, optional DOMString encoding);
-    [RaisesException] void readAsDataURL(Blob blob);
+    [RaisesException] void readAsArrayBuffer(Blob? blob);
+    [RaisesException] void readAsBinaryString(Blob? blob);
+    [RaisesException] void readAsText(Blob? blob, optional DOMString encoding);
+    [RaisesException] void readAsDataURL(Blob? blob);
 
     void abort();
 

Modified: trunk/Source/WebCore/fileapi/FileReaderLoader.cpp (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReaderLoader.cpp	2016-04-25 10:23:41 UTC (rev 199985)
@@ -71,7 +71,7 @@
         ThreadableBlobRegistry::unregisterBlobURL(m_urlForReading);
 }
 
-void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
+void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, Blob& blob)
 {
     // The blob is read by routing through the request handling layer given a temporary public url.
     m_urlForReading = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
@@ -79,7 +79,7 @@
         failed(FileError::SECURITY_ERR);
         return;
     }
-    ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, blob->url());
+    ThreadableBlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, blob.url());
 
     // Construct and load the request.
     ResourceRequest request(m_urlForReading);

Modified: trunk/Source/WebCore/fileapi/FileReaderLoader.h (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReaderLoader.h	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReaderLoader.h	2016-04-25 10:23:41 UTC (rev 199985)
@@ -64,7 +64,7 @@
     FileReaderLoader(ReadType, FileReaderLoaderClient*);
     ~FileReaderLoader();
 
-    void start(ScriptExecutionContext*, Blob*);
+    void start(ScriptExecutionContext*, Blob&);
     void cancel();
 
     // ThreadableLoaderClient

Modified: trunk/Source/WebCore/fileapi/FileReaderSync.cpp (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReaderSync.cpp	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReaderSync.cpp	2016-04-25 10:23:41 UTC (rev 199985)
@@ -44,58 +44,38 @@
 {
 }
 
-RefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext& scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+RefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext& scriptExecutionContext, Blob& blob, ExceptionCode& ec)
 {
-    if (!blob) {
-        ec = NOT_FOUND_ERR;
-        return nullptr;
-    }
-
     FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0);
     startLoading(scriptExecutionContext, loader, blob, ec);
 
     return loader.arrayBufferResult();
 }
 
-String FileReaderSync::readAsBinaryString(ScriptExecutionContext& scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+String FileReaderSync::readAsBinaryString(ScriptExecutionContext& scriptExecutionContext, Blob& blob, ExceptionCode& ec)
 {
-    if (!blob) {
-        ec = NOT_FOUND_ERR;
-        return String();
-    }
-
     FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0);
     startLoading(scriptExecutionContext, loader, blob, ec);
     return loader.stringResult();
 }
 
-String FileReaderSync::readAsText(ScriptExecutionContext& scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec)
+String FileReaderSync::readAsText(ScriptExecutionContext& scriptExecutionContext, Blob& blob, const String& encoding, ExceptionCode& ec)
 {
-    if (!blob) {
-        ec = NOT_FOUND_ERR;
-        return String();
-    }
-
     FileReaderLoader loader(FileReaderLoader::ReadAsText, 0);
     loader.setEncoding(encoding);
     startLoading(scriptExecutionContext, loader, blob, ec);
     return loader.stringResult();
 }
 
-String FileReaderSync::readAsDataURL(ScriptExecutionContext& scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+String FileReaderSync::readAsDataURL(ScriptExecutionContext& scriptExecutionContext, Blob& blob, ExceptionCode& ec)
 {
-    if (!blob) {
-        ec = NOT_FOUND_ERR;
-        return String();
-    }
-
     FileReaderLoader loader(FileReaderLoader::ReadAsDataURL, 0);
-    loader.setDataType(blob->type());
+    loader.setDataType(blob.type());
     startLoading(scriptExecutionContext, loader, blob, ec);
     return loader.stringResult();
 }
 
-void FileReaderSync::startLoading(ScriptExecutionContext& scriptExecutionContext, FileReaderLoader& loader, Blob* blob, ExceptionCode& ec)
+void FileReaderSync::startLoading(ScriptExecutionContext& scriptExecutionContext, FileReaderLoader& loader, Blob& blob, ExceptionCode& ec)
 {
     loader.start(&scriptExecutionContext, blob);
     ec = FileException::ErrorCodeToExceptionCode(loader.errorCode());

Modified: trunk/Source/WebCore/fileapi/FileReaderSync.h (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReaderSync.h	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReaderSync.h	2016-04-25 10:23:41 UTC (rev 199985)
@@ -56,19 +56,19 @@
 
     virtual ~FileReaderSync() { }
 
-    RefPtr<JSC::ArrayBuffer> readAsArrayBuffer(ScriptExecutionContext&, Blob*, ExceptionCode&);
-    String readAsBinaryString(ScriptExecutionContext&, Blob*, ExceptionCode&);
-    String readAsText(ScriptExecutionContext& scriptExecutionContext, Blob* blob, ExceptionCode& ec)
+    RefPtr<JSC::ArrayBuffer> readAsArrayBuffer(ScriptExecutionContext&, Blob&, ExceptionCode&);
+    String readAsBinaryString(ScriptExecutionContext&, Blob&, ExceptionCode&);
+    String readAsText(ScriptExecutionContext& scriptExecutionContext, Blob& blob, ExceptionCode& ec)
     {
         return readAsText(scriptExecutionContext, blob, emptyString(), ec);
     }
-    String readAsText(ScriptExecutionContext&, Blob*, const String& encoding, ExceptionCode&);
-    String readAsDataURL(ScriptExecutionContext&, Blob*, ExceptionCode&);
+    String readAsText(ScriptExecutionContext&, Blob&, const String& encoding, ExceptionCode&);
+    String readAsDataURL(ScriptExecutionContext&, Blob&, ExceptionCode&);
 
 private:
     FileReaderSync();
 
-    void startLoading(ScriptExecutionContext&, FileReaderLoader&, Blob*, ExceptionCode&);
+    void startLoading(ScriptExecutionContext&, FileReaderLoader&, Blob&, ExceptionCode&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/fileapi/FileReaderSync.idl (199984 => 199985)


--- trunk/Source/WebCore/fileapi/FileReaderSync.idl	2016-04-25 10:08:13 UTC (rev 199984)
+++ trunk/Source/WebCore/fileapi/FileReaderSync.idl	2016-04-25 10:23:41 UTC (rev 199985)
@@ -30,7 +30,6 @@
 
 [
     Constructor,
-    UsePointersEvenForNonNullableObjectArguments,
     Exposed=Worker,
 ] interface FileReaderSync {
     [CallWith=ScriptExecutionContext, RaisesException] ArrayBuffer readAsArrayBuffer(Blob blob);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to