Closed
Bug 898728
Opened 11 years ago
Closed 8 years ago
Blob URIs are briefly reusable after page unload, seemingly contradicting the FileAPI
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: swhitemanlistens-software, Assigned: baku)
Details
Attachments
(1 file)
1.96 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20130518 Firefox/20.0 PaleMoon/20.1 (Nightly/Aurora) Build ID: 20130518142809 Steps to reproduce: Using an <INPUT type=file>, browse for an image. Use getObjectURL to retrieve the Blob URI. Set the src of an IMG on the page to the Blob URI. Copy the Blob URI to my keyboard. Refresh the tab (note page is not fetched from cache). Set the src of an IMG on the page to the copied Blob URI. Testbed @ http://jsfiddle.net/sDj67/6/show/light/ Actual results: The first attempt to set the src after the refresh succeeds, updating the IMG with the original saved bitmap. After some iterations of settting the src to an empty string and then setting back to the same Blob UTI, it will eventually fail to render the image, and from that point forward will no longer render the image, including after subsequent refreshes. Expected results: The URI should not be useable after a refresh, for any period of time. A refresh fires the onunload event, that seems well, explicitly contrary to "This Blob URI must persist... till the unloading document cleanup steps are executed." [FileAPI spec 12.8.1.2.B] Even if the first document's unload is technically still "executing" in the background, it is definitely the intent of the spec that you are not supposed to be able to reuse a Blob URI from one DOM document when there is a new DOM document in its place. [It is my guess -- just a guess -- that the URI is "lazy-revoked," like lazily closing a Websocket, but it shouldn't be reusable from another document even if the actual memory release is happening in the background.]
I'm not able to reproduce the issue, after the refresh, the fieled "Set Image Src to" keeps the Blob URI but doesn't display the image. Even if I paste the blob URI, it stays blank. Could you update to Firefox 22 and test again, please?
Component: Untriaged → DOM
Flags: needinfo?(swhitemanlistens-software)
Product: Firefox → Core
Reporter | ||
Comment 2•11 years ago
|
||
Same results on Firefox 22. Make sure you're _changing_ the `Set Image Src` field (it has an onchange event). So you can set it to blank or gibberish and then set to it to the Blob URI.
Flags: needinfo?(swhitemanlistens-software)
From code inspection it looks like we revoke the URLs only after the document is GCd, not when we unload the document.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Can you confirm that if you have about:memory open in a second tab the URL generally works before clicking "Minimize Memory" but never after?
Flags: needinfo?(swhitemanlistens-software)
Reporter | ||
Comment 5•11 years ago
|
||
Yes, I confirm that `Minimize Memory Usage` prevents the tests from succeeding thereafter. [FYI: this discovery came after a fellow dev reported to me that Mobile Safari (and Chrome Mobile, as we later noted) both persist the Blob URI *indefinitely* after unlimited refreshes. That is, where FF is unpredictable based on the GC timer but eventually settles down, those browsers are predictable, and always wrong. IE 10 appears to have a correct implementation as the Blob URI never works at all after a refresh.]
Flags: needinfo?(swhitemanlistens-software)
Thanks. Should be a pretty easy fix. I'll look at it on Monday.
Assignee: nobody → khuey
So, I was wrong, this turned out to be quite hard and I never did it :) I think baku looked into something similar recently.
Assignee: khuey → nobody
Flags: needinfo?(amarchesini)
Assignee | ||
Comment 8•8 years ago
|
||
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Attachment #8781129 -
Flags: review?(bugs)
Updated•8 years ago
|
Attachment #8781129 -
Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/f07eb53ea2ba Blob should be invalidated when the window is destroyed, r=smaug
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f07eb53ea2ba
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•