Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Issue 157363003: Implement Blob.close(). (Closed)

Created:
6 years, 10 months ago by sof
Modified:
6 years, 10 months ago
CC:
blink-reviews, arv+blink, eae+blinkwatch, dglazkov+blink, adamk+blink_chromium.org, watchdog-blink-watchlist_google.com, Inactive, jbroman
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Implement Blob.close(). This adds support for the close() methods to Blobs, http://dev.w3.org/2006/webapi/FileAPI/#close-method providing a way to explicitly release the underlying data of a Blob. Subsequent uses of a closed Blob is required/assumed to have the following behavior: - the size of a closed Blob should be zero. - Consumers of such a Blob should treat it as having size 0 (e.g., FormData.append(), XHR.send()), and not throw. - FileReader read operations that are underway on a Blob being close()d should not be impacted. - Subsequent FileReader read operations on a closed Blob should fail with InvalidStateError. - Slices of a closed Blob should still be usable. - Dereferencing a blob URL that has been closed should cause a network error, like a revoke. In other words, closing a shared object is not a straightforward matter. R=kinuko@chromium.org,michaeln@chromium.org, jochen@chromium.org BUG=157794 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167874

Patch Set 1 #

Patch Set 2 : Avoid warning from PHP's fread() on empty reads #

Total comments: 17

Patch Set 3 : Put Blob.close() behind an experimental flag + provide revoke-by-UUID method over DOMURL. #

Patch Set 4 : Tweak comment #

Total comments: 8

Patch Set 5 : Rebased + shore up some non-backing-file code paths #

Patch Set 6 : Rebased + shore up some non-backing-file code paths #

Total comments: 12

Patch Set 7 : Rebased + improved tests a bit #

Patch Set 8 : Rebased + improved tests a bit #

Total comments: 2

Patch Set 9 : Test adjustments #

Patch Set 10 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+487 lines, -36 lines) Patch
A LayoutTests/fast/files/blob-close.html View 1 2 3 4 5 6 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/fast/files/blob-close-expected.txt View 1 chunk +18 lines, -0 lines 0 comments Download
A LayoutTests/fast/files/blob-close-read.html View 1 2 3 4 5 6 1 chunk +95 lines, -0 lines 0 comments Download
A LayoutTests/fast/files/blob-close-read-expected.txt View 1 2 3 4 5 6 1 chunk +26 lines, -0 lines 0 comments Download
A LayoutTests/fast/files/blob-close-revoke.html View 1 2 3 4 5 6 7 8 1 chunk +123 lines, -0 lines 0 comments Download
A LayoutTests/fast/files/blob-close-revoke-expected.txt View 1 2 3 4 5 6 1 chunk +25 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async.html View 3 chunks +4 lines, -2 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-async-expected.txt View 2 chunks +2 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync.html View 3 chunks +4 lines, -2 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-sync-expected.txt View 2 chunks +2 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-blob-content-type-tests.js View 2 chunks +9 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-formdata.html View 4 chunks +20 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/post-formdata-expected.txt View 1 chunk +4 lines, -0 lines 0 comments Download
M LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php View 1 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/DOMURL.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/DOMURL.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +11 lines, -3 lines 0 comments Download
M Source/core/fileapi/Blob.h View 2 chunks +6 lines, -2 lines 0 comments Download
M Source/core/fileapi/Blob.cpp View 1 2 3 4 5 chunks +26 lines, -4 lines 0 comments Download
M Source/core/fileapi/Blob.idl View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/fileapi/File.h View 1 2 3 4 5 chunks +15 lines, -5 lines 0 comments Download
M Source/core/fileapi/File.cpp View 1 2 3 4 4 chunks +18 lines, -3 lines 0 comments Download
M Source/core/fileapi/FileReader.h View 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/fileapi/FileReader.cpp View 1 2 3 4 5 6 2 chunks +13 lines, -3 lines 0 comments Download
M Source/core/html/PublicURLManager.h View 2 chunks +9 lines, -4 lines 0 comments Download
M Source/core/html/PublicURLManager.cpp View 1 2 3 4 4 chunks +28 lines, -5 lines 0 comments Download
M Source/platform/RuntimeEnabledFeatures.in View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 43 (0 generated)
sof
When you have a spare moment, please take a look.(If there are others even better ...
6 years, 10 months ago (2014-02-07 14:11:53 UTC) #1
arv (Not doing code reviews)
Maybe send an intent to ship email about this?
6 years, 10 months ago (2014-02-07 16:56:30 UTC) #2
jbroman
On 2014/02/07 14:11:53, sof wrote: > When you have a spare moment, please take a ...
6 years, 10 months ago (2014-02-07 17:24:07 UTC) #3
sof
On 2014/02/07 17:24:07, jbroman wrote: > On 2014/02/07 14:11:53, sof wrote: > > When you ...
6 years, 10 months ago (2014-02-07 17:38:28 UTC) #4
sof
On 2014/02/07 16:56:30, arv wrote: > Maybe send an intent to ship email about this? ...
6 years, 10 months ago (2014-02-07 19:35:11 UTC) #5
michaeln
i can help review this too
6 years, 10 months ago (2014-02-11 21:03:23 UTC) #6
kinuko
(Haven't looked into all details yet, the behavior of readers other than FileReader concerns me ...
6 years, 10 months ago (2014-02-12 06:11:19 UTC) #7
sof
https://codereview.chromium.org/157363003/diff/50001/Source/core/html/PublicURLManager.cpp File Source/core/html/PublicURLManager.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/html/PublicURLManager.cpp#newcode86 Source/core/html/PublicURLManager.cpp:86: } On 2014/02/12 06:11:20, kinuko wrote: > It might ...
6 years, 10 months ago (2014-02-12 06:56:46 UTC) #8
kinuko
https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp File Source/core/fileapi/File.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp#newcode233 Source/core/fileapi/File.cpp:233: m_path = String(); There're more fields in this class ...
6 years, 10 months ago (2014-02-12 12:51:59 UTC) #9
sof
https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp File Source/core/fileapi/File.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp#newcode233 Source/core/fileapi/File.cpp:233: m_path = String(); On 2014/02/12 12:52:00, kinuko wrote: > ...
6 years, 10 months ago (2014-02-12 12:53:45 UTC) #10
kinuko
https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp File Source/core/fileapi/File.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/File.cpp#newcode233 Source/core/fileapi/File.cpp:233: m_path = String(); On 2014/02/12 12:53:46, sof wrote: > ...
6 years, 10 months ago (2014-02-12 13:26:24 UTC) #11
michaeln
https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp File Source/core/dom/DOMURL.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp#newcode73 Source/core/dom/DOMURL.cpp:73: String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrable* registrable, const String& uuid) Not ...
6 years, 10 months ago (2014-02-12 20:33:04 UTC) #12
sof
Thanks; sorry for not following up yet, been busy on other fronts today. Will get ...
6 years, 10 months ago (2014-02-12 22:28:26 UTC) #13
michaeln
https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp File Source/core/dom/DOMURL.cpp (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp#newcode73 Source/core/dom/DOMURL.cpp:73: String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrable* registrable, const String& uuid) > ...
6 years, 10 months ago (2014-02-12 22:34:08 UTC) #14
sof
On 2014/02/12 22:34:08, michaeln wrote: > https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp > File Source/core/dom/DOMURL.cpp (right): > > https://codereview.chromium.org/157363003/diff/50001/Source/core/dom/DOMURL.cpp#newcode73 > ...
6 years, 10 months ago (2014-02-13 09:15:09 UTC) #15
sof
https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/Blob.idl File Source/core/fileapi/Blob.idl (right): https://codereview.chromium.org/157363003/diff/50001/Source/core/fileapi/Blob.idl#newcode41 Source/core/fileapi/Blob.idl:41: [CallWith=ExecutionContext] void close(); On 2014/02/12 06:11:20, kinuko wrote: > ...
6 years, 10 months ago (2014-02-13 09:59:56 UTC) #16
sof
If there's more to attend to here, please let me know.
6 years, 10 months ago (2014-02-18 18:43:58 UTC) #17
michaeln
https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/Blob.cpp File Source/core/fileapi/Blob.cpp (right): https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/Blob.cpp#newcode128 Source/core/fileapi/Blob.cpp:128: // read operations which will throw. Can you add ...
6 years, 10 months ago (2014-02-18 18:59:53 UTC) #18
sof
https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/File.h File Source/core/fileapi/File.h (right): https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/File.h#newcode79 Source/core/fileapi/File.h:79: KURL fileSystemURL() const { ASSERT(m_hasBackingFile); return m_fileSystemURL; } On ...
6 years, 10 months ago (2014-02-18 19:12:47 UTC) #19
michaeln
> Yes, I'll see what I can do. The landmine is already present with being ...
6 years, 10 months ago (2014-02-19 01:39:24 UTC) #20
kinuko
On 2014/02/19 01:39:24, michaeln wrote: > > Yes, I'll see what I can do. The ...
6 years, 10 months ago (2014-02-19 07:10:50 UTC) #21
sof
https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/Blob.cpp File Source/core/fileapi/Blob.cpp (right): https://codereview.chromium.org/157363003/diff/470001/Source/core/fileapi/Blob.cpp#newcode128 Source/core/fileapi/Blob.cpp:128: // read operations which will throw. On 2014/02/18 18:59:54, ...
6 years, 10 months ago (2014-02-19 11:47:38 UTC) #22
sof
On 2014/02/19 07:10:50, kinuko wrote: > On 2014/02/19 01:39:24, michaeln wrote: > > > Yes, ...
6 years, 10 months ago (2014-02-19 11:53:08 UTC) #23
michaeln
i haven't look closely at the tests, but the cpp changes do lgtm now
6 years, 10 months ago (2014-02-20 21:50:20 UTC) #24
kinuko
Sorry for slow review, this almost looks good. I have a few more questions.. https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-read.html ...
6 years, 10 months ago (2014-02-21 12:26:16 UTC) #25
sof
https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html File LayoutTests/fast/files/blob-close-revoke.html (right): https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html#newcode58 LayoutTests/fast/files/blob-close-revoke.html:58: shouldBeTrue("blobURL2.length > 0"); On 2014/02/21 12:26:17, kinuko wrote: > ...
6 years, 10 months ago (2014-02-21 12:36:45 UTC) #26
kinuko
https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html File LayoutTests/fast/files/blob-close-revoke.html (right): https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html#newcode58 LayoutTests/fast/files/blob-close-revoke.html:58: shouldBeTrue("blobURL2.length > 0"); On 2014/02/21 12:36:45, sof wrote: > ...
6 years, 10 months ago (2014-02-21 14:11:17 UTC) #27
sof
Thanks very much, updated the tests based on your feedback. https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-read.html File LayoutTests/fast/files/blob-close-read.html (right): https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-read.html#newcode20 ...
6 years, 10 months ago (2014-02-21 14:56:56 UTC) #28
kinuko
Thanks, lgtm (modulo a few optional nits) https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html File LayoutTests/fast/files/blob-close-revoke.html (right): https://codereview.chromium.org/157363003/diff/710001/LayoutTests/fast/files/blob-close-revoke.html#newcode58 LayoutTests/fast/files/blob-close-revoke.html:58: shouldBeTrue("blobURL2.length > ...
6 years, 10 months ago (2014-02-21 15:40:48 UTC) #29
sof
Updated with another patchset. The previous set wasn't liked by the trybots, suddenly showing the ...
6 years, 10 months ago (2014-02-21 16:02:43 UTC) #30
sof
jochen: adding a new experimental feature for this method; ok to do so?
6 years, 10 months ago (2014-02-21 16:06:38 UTC) #31
jochen (gone - plz use gerrit)
can you please reupload?
6 years, 10 months ago (2014-02-24 11:57:25 UTC) #32
sof
On 2014/02/24 11:57:25, jochen wrote: > can you please reupload? Sorry; done, rebasing at the ...
6 years, 10 months ago (2014-02-24 12:33:37 UTC) #33
jochen (gone - plz use gerrit)
lgtm
6 years, 10 months ago (2014-02-25 19:31:07 UTC) #34
sof
Thanks everyone; let's give this one a go.
6 years, 10 months ago (2014-02-25 21:58:40 UTC) #35
sof
The CQ bit was checked by sigbjornf@opera.com
6 years, 10 months ago (2014-02-25 21:58:49 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sigbjornf@opera.com/157363003/1130001
6 years, 10 months ago (2014-02-25 21:59:27 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sigbjornf@opera.com/157363003/1130001
6 years, 10 months ago (2014-02-25 23:09:08 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sigbjornf@opera.com/157363003/1130001
6 years, 10 months ago (2014-02-25 23:27:21 UTC) #39
Paweł Hajdan Jr.
The CQ bit was unchecked by phajdan.jr@chromium.org
6 years, 10 months ago (2014-02-26 05:45:28 UTC) #40
Paweł Hajdan Jr.
The CQ bit was checked by phajdan.jr@chromium.org
6 years, 10 months ago (2014-02-26 06:01:21 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/sigbjornf@opera.com/157363003/1130001
6 years, 10 months ago (2014-02-26 06:06:35 UTC) #42
commit-bot: I haz the power
6 years, 10 months ago (2014-02-26 09:14:24 UTC) #43
Message was sent while issue was closed.
Change committed as 167874

Powered by Google App Engine
This is Rietveld 408576698