Skip to content

Commit

Permalink
Improve navigate for service worker hooks
Browse files Browse the repository at this point in the history
Before this patch, there has been no concept that holds reserved
client's information referenced from a service worker during a
navigation (more precisely before the actual global object and its
relevant environment settings object for the resulting resource is
created).

This patch defines an "environment" concept (a supertype object of an
environment settings object) that has an id, a creation URL, a target
browsing context, and an active service worker such that service
workers' FetchEvent handlers can reference this client information
before the corresponding environment settings object is actually
created.

The changes include:
 - Create an environment (a reserved client) during a navigation; for
 worker creation requests, create an environment settings object and
 set the fields correspondingly
 - Set request's reserved client to the created environment or
 environment settings object such that fetch (and Handle Fetch) can
 use it
 - Set request's target client id such that fetch (and Handle Fetch)
 can use it

Note: The reserved client's active service worker is set, if
available, during the fetch (in service worker's Handle Fetch
algorithm).

Related issue: w3c/ServiceWorker#870
Related change: whatwg/fetch#383
  • Loading branch information
jungkees authored and annevk committed Oct 24, 2016
1 parent 37799dd commit 2b93f9e
Showing 1 changed file with 154 additions and 50 deletions.

0 comments on commit 2b93f9e

Please sign in to comment.