-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define the lifetime of a blob URL created inside a service worker #688
Comments
I think Gecko's current behaviour is correct. Yes, it may get GC'd when the SW closes, but same with variables. If you want a long term way to store a response, the caches api is the way to go right? Tieing it to registration feels wrong as it would need to survive browser shut down. What is the current behaviour breaking? I'm wondering if a way to access items in the cache api by url may be a better solution. |
We should maybe restrict this API inside service workers since it's a giant memory leak. And only allow the one-time-minting variant. |
Is it a giant memory leak if the data is GC'd when the SW terminates? |
Depends on whether service workers will forever terminate quickly. It seems better to simply not offer APIs that are known to be problematic. |
@annevk I really don't think this is a problem any more than it is on pages. Service workers are generally not alive longer than pages. |
Right, that argument was made, and the argument against was that it might not remain that way. I guess the other question is why we need blob URLs in service workers since we can just use Request/Response objects. |
Need a resolution. Would like to discuss at the f2f. |
Implementor feedback from Chrome: if we continue to allow blob URLs in service workers, tieing the lifetime to the service worker (i.e., the execution context that created it, not the registration) sounds good. That's what Chrome does already. |
F2F resolution: remove |
@annevk Is it better to make |
@jungkees no, I would get the File API specification to use |
Closing with w3c/FileAPI#31 merged. |
Blink tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=604951 I filed w3c/media-source#67 since MediaSource has createObjectURL as well. MediaStream had it as well at some point but it's been removed from the spec. |
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1264182 gecko-commit: 40d4999db3191bca0aeb75a50b37537ad78102ed gecko-integration-branch: autoland gecko-reviewers: mrbkap, asuth
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 --HG-- extra : moz-landing-system : lando
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1264182 gecko-commit: 40d4999db3191bca0aeb75a50b37537ad78102ed gecko-integration-branch: autoland gecko-reviewers: mrbkap, asuth
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 UltraBlame original commit: 40d4999db3191bca0aeb75a50b37537ad78102ed
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 UltraBlame original commit: 40d4999db3191bca0aeb75a50b37537ad78102ed
The appropriate lifetime for URLs created with URL.createObjectURL turned out to be tricky to define, so it was decided to hide it from service workers altogether. (w3c/ServiceWorker#688) This commit implements this change and adds a web platform test to verify it. It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker and SharedWorker contexts in order to comply with the WebIDL spec (see w3c/media-source#168 (comment)). Differential Revision: https://phabricator.services.mozilla.com/D2728 UltraBlame original commit: 40d4999db3191bca0aeb75a50b37537ad78102ed
Right now in Gecko at least we tie the lifetime of such URLs to the Worker or SharedWorker that created them, but doing the same (as in, invalidating the blob URL when the service worker goes away) seems wrong, since that can happen at any time at UA's discretion.
How should we handle this?
One option that comes to my mind right now is keeping those URLs valid until the service worker that registered them is unregistered.
The text was updated successfully, but these errors were encountered: