Bug 215663

Summary: Blob is missing text() & arrayBuffer() operations
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, alecflett, beidson, esprehn+autocc, ews-watchlist, ggaren, jsbell, kondapallykalyan, simon.fraser, tetsuharu.ohzeki, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar, WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://w3c.github.io/FileAPI/#blob-section
Bug Depends on: 215832    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Chris Dumez 2020-08-19 14:31:49 PDT
Blob is missing text() & arrayBuffer() operations:
- https://w3c.github.io/FileAPI/#blob-section
Comment 1 Chris Dumez 2020-08-19 14:37:20 PDT
Created attachment 406873 [details]
Patch
Comment 2 Chris Dumez 2020-08-19 15:15:04 PDT
Created attachment 406877 [details]
Patch
Comment 3 Geoffrey Garen 2020-08-19 15:36:36 PDT
Comment on attachment 406877 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=406877&action=review

r=me

> Source/WebCore/fileapi/NetworkSendQueue.cpp:74
> +    blobLoaderPtr->start(blob, m_document.get(), FileReaderLoader::ReadAsArrayBuffer);

Could use m_queue.last() here instead of blobLoaderPtr. Not sure if that's obviously better; but taking a raw pointer to a UniqueRef smells bad.

> Source/WebCore/page/ShareDataReader.cpp:58
> +        blobLoaderPtr->start(*blob, document, FileReaderLoader::ReadAsArrayBuffer);

Here too.
Comment 4 Chris Dumez 2020-08-19 16:07:41 PDT
For the record, this was reported via Twitter here:
https://twitter.com/baldand/status/1295769537367990273
Comment 5 Chris Dumez 2020-08-19 16:09:49 PDT
Comment on attachment 406877 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=406877&action=review

>> Source/WebCore/fileapi/NetworkSendQueue.cpp:74
>> +    blobLoaderPtr->start(blob, m_document.get(), FileReaderLoader::ReadAsArrayBuffer);
> 
> Could use m_queue.last() here instead of blobLoaderPtr. Not sure if that's obviously better; but taking a raw pointer to a UniqueRef smells bad.

Sadly, the queue contains a Variant type so it is not convenient to do what you suggest. I will apply your suggestion to ShareDataReader.cpp though.
Comment 6 Chris Dumez 2020-08-19 16:11:51 PDT
Created attachment 406884 [details]
Patch
Comment 7 EWS 2020-08-19 16:56:08 PDT
Committed r265908: <https://trac.webkit.org/changeset/265908>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 406884 [details].
Comment 8 Radar WebKit Bug Importer 2020-08-19 16:57:17 PDT
<rdar://problem/67436725>
Comment 9 Tetsuharu Ohzeki [UTC+9] 2020-09-03 11:11:05 PDT
*** Bug 213168 has been marked as a duplicate of this bug. ***