#279: Background fetch
Discussions
Comment by @slightlyoff May 16, 2018 (See Github)
My understanding is there's an implementation underway. Is there really no time pressure and/or deadline you'd like us to work under?
Comment by @jakearchibald May 17, 2018 (See Github)
We're aiming to send an intend to ship in July/August, so it's a little more pressing that I initially thought.
Comment by @annevk May 18, 2018 (See Github)
How can you ship when the draft has substantive issues, such as the one below "response failed due to a failed CORS check"? (I don't think we should expose such a failure to content.)
Comment by @jakearchibald May 18, 2018 (See Github)
I do need to get a move on with the spec 😢. Trying to devote more time to it.
Comment by @cynthia Oct 31, 2018 (See Github)
Seems like the explainer switched branches: https://github.com/WICG/background-fetch/blob/master/README.md
Comment by @travisleithead Oct 31, 2018 (See Github)
Hi! Just getting my feet wet with this spec, so I apologies if my mental map is incomplete... Here's a few points of discussion I found in my first read:
The optional downloadTotal
dictionary member misled me by it's name. I think having it called something like doNotExceed
would better map to the use case than a pre-predicted estimate of the download total (and then leave the UI stuff to the UA to figure out (which it should know by the server responses, etc.)
The registration.backgoundFetch
object is similar to a map in many respects. I wonder if some APIs could align better? E.g., id
s are the keys to the various ongoing fetches. getIds() is like
keys()... but
set()` isn't a great match for initiating a fetch so I'm less convinced to go all the way aligning the names :).
In the spirit of not needing to re-activate the browser code to do UI updates, I'd like to suggest we drop updateUI
in favor of pre-declaring these strings at the time of the background fetch start. Probably you just need to care about three states: downloading (icon, title), finished (icon, title), and error/canceled (icon, title). It's not as generally powerful, but can make the UI transitions more smooth by avoiding the round-trip to the client for the various state transitions. (Also the download/upload states aren't really expected to change in an ad-hoc manner.)
Comment by @jakearchibald Oct 31, 2018 (See Github)
The optional
downloadTotal
dictionary member misled me by it's name. I think having it called something likedoNotExceed
doNotExceed
kinda loses context. Eg, does it include upload bandwidth?
(and then leave the UI stuff to the UA to figure out (which it should know by the server responses, etc.)
If you're downloading a DASH-style movie it could be 1000s of resources. It's going to take a long time for the browser to know much about the size.
The registration.backgoundFetch object is similar to a map in many respects.
The main difference is it's async. I'd like to make it an async iterator at some point.
In the spirit of not needing to re-activate the browser code to do UI updates,
The browser needs reactivated anyway so the responses can be handled/read/moved. I kinda like the idea of specifying this stuff ahead of time, but it feels like it loses functionality for not much gain.
Discussed
Nov 28, 2018 (See Github)
Alex: ...
kenneth: Why couldn't this be the metadata to the map?
David: i don't understand why ... this design.
Alex: so sitemap.xxx for modules?
kenneth: Seems to be other things for metadata you might need for your modules.
Hadley: if there is a bottleneck ... explainer says - this is a problem, this is the solution. Does not explain why or what else was considered.
Alex: I think it's a good point. I will go back and talk to the requestor's manager.
David: I was also starting to write a comment - i'll add that.
kenneth: how would you ensure integrity? that would be nice to have in your module map.
David: https://github.com/w3ctag/design-reviews/issues/213#issuecomment-44233519
Comment by @webmaxru Nov 30, 2018 (See Github)
I've just published an article about my exploration of what we have in Chrome Canary M72 at the moment: https://medium.com/@webmaxru/background-fetch-api-get-ready-to-use-it-69cca522cd8f
Comment by @webmaxru Nov 30, 2018 (See Github)
From this post: "The downloadTotal
property we pass during the background fetch registration is the total number of bytes of the whole set. It’s also optional. If passed, it works as a guard — we’ll get backgroundfetcherror
event in the service worker if the total size of the resources is larger. Also, it’s a good helper for our UI to show the correct download percentage if needed. Unfortunately, there is another bug: at least on Mac OS this number can’t be larger than 2147483647
(2 GB) which is the maximum size of one file in the file system but it’s intended to be the maximum total size of the whole set. I’m going to submit a bug to the Chromium Bug Tracker about this. Meanwhile, if the total set size doesn’t bypass 2GB (like in our case) our calculations are correct."
But I might be wrong in my assumptions :)
Comment by @jakearchibald Nov 30, 2018 (See Github)
Your assumptions are correct. The spec defines the maximum of downloadTotal
to be 18,446,744,073,709,551,614, so it's a Chrome bug.
Comment by @jakearchibald Nov 30, 2018 (See Github)
@webmaxru you might also be interested in https://bgfetch-http203.glitch.me/.
Comment by @webmaxru Nov 30, 2018 (See Github)
@webmaxru you might also be interested in https://bgfetch-http203.glitch.me/.
Hard to imagine the better usecase! I plan to build a PoC of bgfetch automation tool, maybe this will end up as a plugin for Workbox - will use podcast app as a guinea pig :)
Discussed
Dec 4, 2018 (See Github)
Kenneth: I am fine with this, Travis had a few comments, espacially about the name of downloadTotal. Waiting on Travis before closing the issue
Comment by @kenchris Dec 11, 2018 (See Github)
Discussed
Jan 8, 2019 (See Github)
Travis: I read through the material and was ok with the responses on our open issues. Trusted UI - when you make a background fetch you provide info that can be displayed in the download manager - a string passed through to the UI. UAs should be careful about this... spammy or phishy messages, or deceptive ones, could be an issue.
Alex: could be non-normative text...
Travis: i'm looking for a note on the potential veunerability in the security & privacy section
Alex: makes sense.
Dan: +1
Peter: what's the issue?
Travis: yes i will open 1.
Peter: can we close this off?
Kenneth: I move to close it off.
Dan: +1
Kenneth: there are some remaining open issues but they are being tracked & i think it's fine.
Peter: closed
Comment by @travisleithead Jan 8, 2019 (See Github)
Have re-read the spec and associated resources, and I'm feeling more comfortable with the design ;-).
In the explainer you note that the UA should take steps to ensure that the content that originates from the web app is distinctly separate from the trusted UI elements as rendered by the UA. Another concern that led to browsers all-but-removing the rendering of beforeunload's status message, is that fields like "title" are potential attack surface. May want to make of note of that in the Security and Privacy section of the spec as well to be sure implementors are aware.
Comment by @travisleithead Jan 8, 2019 (See Github)
Have filed the above issue. All others on the call today supported closing the issue. Thanks so much for the TAG review, and we hope to be of service again soon (Come on back, ya'll!)
Comment by @jakearchibald Jan 9, 2019 (See Github)
Thanks TAG! The review was genuinely useful & I'm looking forward to the next one.
OpenedMay 2, 2018
Hello TAG!
I'm requesting a TAG review of:
You should also know that...
The spec isn't complete yet, so this is more of an opportunity to review the proposed API.
We'd prefer the TAG provide feedback as (please select one):