Intent to Deprecate and Remove: Blob URLs created in Service Workers

118 views
Skip to first unread message

Joshua Bell

unread,
Apr 22, 2016, 2:42:28 PM4/22/16
to blink-dev

Primary eng (and PM) emails

jsb...@chromium.org


Summary

Remove URL.createObjectURL, URL.revokeObjectURL from Service Workers


Motivation

Service Worker inherited URL minting methods for blobs (URL.createObjectURL, URL.revokeObjectURL) since they were exposed to Window and Worker contexts by default. This was raised as an issue [1] since the URL lifetime is tied to the lifetime of the creation context, but SWs are (by design) shut down promptly. The resolution to the issue was to forbid these methods in SW contexts.


The relevant spec (File API) was updated[2]. I'm following up with MediaSource [3] as well, assuming the same logic applies.


[1] https://github.com/slightlyoff/ServiceWorker/issues/688

[2] https://w3c.github.io/FileAPI/

[3] https://github.com/w3c/media-source/issues/67


Compatibility Risk

Only affects Service Workers, and use of the URLs would have been flaky at best.


Gecko is also removing the methods.


Alternative implementation suggestion for web developers

In a Service Worker, the model is inverted - you're almost certainly servicing a fetch from a page via a FetchEvent with a URL that you want to intercept and provide a response for. In that case you can simply respondWith(new Response(blob)).


Usage information from UseCounter

n/a - we're removing ASAP


OWP launch tracking bug

n/a - we're hoping no-one even noticed these were present...


Entry on the feature dashboard

n/a - these aren't the droids you're looking for...


Requesting approval to remove too?

Yes.


Chris Harrelson

unread,
Apr 22, 2016, 5:20:16 PM4/22/16
to Joshua Bell, blink-dev
LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Rick Byers

unread,
Apr 22, 2016, 8:06:37 PM4/22/16
to Chris Harrelson, blink-dev, Joshua Bell

Seems likely to be low risk, but in general I don't like relying on "hope" when it comes to potentially breaking sites. It doesn't seem impossible to me that some library code (designed for non-worker scenarios but used in a SW) is somehow depending on these APIs existing, right?

Perhaps it's not too late to get a deprecation warning (with UseCounter) merged back to 51, then you can remove in trunk after a few days of data confirms there's no usage in beta. WDYT?

Marijn Kruisselbrink

unread,
Apr 22, 2016, 8:14:03 PM4/22/16
to Rick Byers, Chris harrelson, Joshua Bell, blink-dev

Unfortunately use counters aren't supported yet in shared and service workers. So getting data would be significantly harder than that.

Chris Harrelson

unread,
Apr 22, 2016, 8:36:41 PM4/22/16
to Marijn Kruisselbrink, Rick Byers, Joshua Bell, blink-dev
On Fri, Apr 22, 2016 at 5:14 PM Marijn Kruisselbrink <m...@chromium.org> wrote:

Unfortunately use counters aren't supported yet in shared and service workers. So getting data would be significantly harder than that.

Is there a plan to do it soon? It's not good at all to fly blind like this.

Marijn Kruisselbrink

unread,
Apr 22, 2016, 8:39:02 PM4/22/16
to Chris harrelson, Rick Byers, blink-dev, Joshua Bell

I believe the worker team has it as one of their okr's this quarter. I'm sure they'll correct me if I'm wrong.

Matt Falkenhagen

unread,
Apr 25, 2016, 12:52:23 AM4/25/16
to Marijn Kruisselbrink, Chris harrelson, Rick Byers, blink-dev, Joshua Bell
Yes, this is on our goals for Q2. The tracking bug is https://bugs.chromium.org/p/chromium/issues/detail?id=376039. We should at least have a design proposal and discussion within this quarter, even if implementation slips to next quarter.

Rick Byers

unread,
Apr 26, 2016, 2:39:16 PM4/26/16
to Matt Falkenhagen, Marijn Kruisselbrink, Chris harrelson, blink-dev, Joshua Bell
Thanks.  I added a couple notes to the bug.

I also did a little digging with httparchive to see if it's possible to search for service-worker specific uses there, but it looks like SW resources aren't captured.  I filed this issue to track that.

We do still support deprecation warning messages generated within a service worker context, right?  Could we at least get the deprecation warning added to M51 so we at least provide some warning to any developers that may be depending on this (and may occasionally look at the devtools console for their app)?

Joshua Bell

unread,
May 2, 2016, 5:06:01 PM5/2/16
to Rick Byers, Shruthi Sreekanta, Matt Falkenhagen, Marijn Kruisselbrink, Chris harrelson, blink-dev
Since no-one else has commented, I've gone ahead and created a CL to add a deprecation warning for 51 (land deprecation, then immediately request a merge, then land the removal).

Sound good?

Elliott Sprehn

unread,
May 2, 2016, 5:10:18 PM5/2/16
to Joshua Bell, Marijn Kruisselbrink, Matt Falkenhagen, Shruthi Sreekanta, Chris harrelson, Rick Byers, blink-dev

Yes, but I also think getting UMA and UseCounters fixed for both fast shutdown and workers is the P0 we keep ignoring here...

Christian Biesinger

unread,
May 2, 2016, 5:13:08 PM5/2/16
to Elliott Sprehn, Joshua Bell, Marijn Kruisselbrink, Matt Falkenhagen, Shruthi Sreekanta, Chris harrelson, Rick Byers, blink-dev
They have been fixed for fast shutdown, no?
https://bugs.chromium.org/p/chromium/issues/detail?id=544971

Don't know about workers.

-Christian

Elliott Sprehn

unread,
May 2, 2016, 5:20:39 PM5/2/16
to Christian Biesinger, Marijn Kruisselbrink, Shruthi Sreekanta, Matt Falkenhagen, Joshua Bell, Chris harrelson, Rick Byers, blink-dev

Yay! Carry on then. :)

Rick Byers

unread,
May 3, 2016, 2:33:54 PM5/3/16
to Elliott Sprehn, Christian Biesinger, Marijn Kruisselbrink, Shruthi Sreekanta, Matt Falkenhagen, Joshua Bell, Chris harrelson, blink-dev
That sounds good to me Josh.  I don't see any better option than just going with a deprecation warning for one milestone then removing and keeping a close eye out for any fall-out.  Worst case we'll learn something about the risks of changing service worker exposed APIs without the UMA coverage in place :-).

Rick Byers

unread,
May 3, 2016, 2:34:38 PM5/3/16
to Elliott Sprehn, Christian Biesinger, Marijn Kruisselbrink, Shruthi Sreekanta, Matt Falkenhagen, Joshua Bell, Chris harrelson, blink-dev
So, LGTM2 to deprecate and remove according to that plan.

Chris, does your LGTM still stand after this debate?

Chris Harrelson

unread,
May 3, 2016, 3:40:55 PM5/3/16
to Rick Byers, Elliott Sprehn, Christian Biesinger, Marijn Kruisselbrink, Shruthi Sreekanta, Matt Falkenhagen, Joshua Bell, blink-dev
Yes, still LGTM.

Dimitri Glazkov

unread,
May 9, 2016, 2:23:12 PM5/9/16
to Chris Harrelson, Rick Byers, Elliott Sprehn, Christian Biesinger, Marijn Kruisselbrink, Shruthi Sreekanta, Matt Falkenhagen, Joshua Bell, blink-dev
LGTM3

:DG<
Reply all
Reply to author
Forward
0 new messages