Closed Bug 773132 Opened 8 years ago Closed 3 years ago

Implement auto-revoking blob URIs

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: emk, Unassigned)

References

()

Details

Per latest spec, blob URIs are automatically revoked by default after providing a stable state.
Depends on: 587251
I'd prefer not using HTML spec's stable state for anything.
Then what should be used?
I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=17758.
Looks like there can be also other problems in the spec.
I'm testing auto-revoke blob URI patch and I found it broke img-blobURI-2.html.
https://mxr.mozilla.org/mozilla-central/source/layout/reftests/svg/as-image/img-blobURI-2.html?force=1
I think this is expected because the outer SVG-as-an-image will not even start loading before a stable state (or a microtask checkpoint, it doesn't matter for this problem). But is it acceptable to potentially break existing contents which use blob URIs inside SVG-as-an-image?
Yeah, loading the data-url source will definitely happen asynchronously, which means that the blob-url will be revoked by the time it's supposed to be parsed.

I think that's ok. At least I think it's at least worth trying, defaulting to auto-revoking definitely has a risk that it'll break too much content, but we won't know until we try.
(In reply to Olli Pettay [:smaug] from comment #3)
> I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=17758.
> Looks like there can be also other problems in the spec.

Olli: I'm not sure your problems with stable state are solved with microtasks -- that's equally vague, if not more so.

Can you look at that bug again?  I left a comment for you regarding "await..." versus "present..."

Moreover, there are now *two bugs* that I think legitimately address the problem of autoRevoke:

1. https://www.w3.org/Bugs/Public/show_bug.cgi?id=16953#c8 (and https://www.w3.org/Bugs/Public/show_bug.cgi?id=16953#c11)

2. https://www.w3.org/Bugs/Public/show_bug.cgi?id=17765

I think the above two bugs are the correct bugs with the specification, and NOT the microtask bug.  Thoughts?
Script (event listener etc) can't know what all scripts will run before the next stable state.
Microtask doesn't really have that problem.
I agree, we should definitely use microtasks
(In reply to Jonas Sicking (:sicking) from comment #8)
> I agree, we should definitely use microtasks

But microtasks aren't a real concept!  There's only the "magic words" which are "Perform a microtask checkpoint."  That's what this is all about:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16790

We could:

1. Bolster up the existing stable state requirements.
2. Go back to https://www.w3.org/Bugs/Public/show_bug.cgi?id=16790 and do a better job of defining what a microtask is.
Microtask is the outermost script execution.
MutationObserver callbacks get called at the end of the microtask or end of task, whichever is first.
Please don't fragment the discussion: https://www.w3.org/Bugs/Public/show_bug.cgi?id=16790
Also,
  var fileurl = URL.createObjectURL(file);
  audio.src = fileurl;
failed to load because the resource selection algorithm is awaiting a stable state before reading a src attribute.
http://dev.w3.org/html5/spec/single-page.html#concept-media-load-algorithm
that seems like a bigger problem!
Blocks: 794386
No longer blocks: 794386
Auto-revoking Blobs are now harnessed to "post-script cleanup steps."  

See: https://www.w3.org/Bugs/Public/show_bug.cgi?id=19554#c4

And in spec., see: 
http://www.whatwg.org/specs/web-apps/current-work/#calling-scripts
Autorevoke is not a thing in the latest version of the spec. I'm right? We should close this bug.
Flags: needinfo?(annevk)
Yup.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(annevk)
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.