[Bug 24387] Expose media queries to workers

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

--- Comment #2 from Jonas Sicking <jonas@sicking.cc> ---
One of the central features of Service Workers is to pre-download resources
that a website will need such that when they are needed they are already
available cached when needed. The goal is both to make online faster and
offline possible.

As part of that, the ServiceWorker receives events when the UA detects that a
new version of the ServiceWorker (and thus likely of the website) is available.
This way the ServiceWorker can download the assets needed by that version.

It's up to the UA to choose when it's looking for updated versions of the SW.
It's also up to the UA when to launch the SW and fire an event to it letting it
know that it is a good time to download new needed resources.

This might happen when no pages for the website is open. I.e. a UA can (and
implementations have indicated that they will) check for updates for websites
that the user uses a lot even if the user isn't currently using the website.

In some instances the SW will likely want to develop different resources based
on the physical capabilities of the hardware that the UA is running on. So for
example when a new version of a website is released, the new version might use
a couple of images that are available in multiple different resolutions. The SW
would then want to choose which images to predownload and cache based on things
like screen size and screen resolution.

Hence it needs a way to ask about those things. When the website is up and
running it could simply use postMessage to talk to JS running in a Window which
could then use the normal media queries API. However if the website isn't
currently open in any Window, that doesn't work. (And arguably it's an awkward
solution even when possible).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Monday, 27 January 2014 18:53:29 UTC