A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Foreign Fetch

From WHATWG Wiki
Revision as of 10:09, 7 July 2015 by Annevk (talk | contribs) (Created page with "This is a proposal for invoking service workers for requests that are same-origin with the service worker fetched from cross-origin clients. == Modifications to Fetch == ......")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This is a proposal for invoking service workers for requests that are same-origin with the service worker fetched from cross-origin clients.

Modifications to Fetch

...

On the face of it, it seems step 3, substep 5, of https://fetch.spec.whatwg.org/#http-fetch, needs modifications to check for a foreign fetch enabled service worker before going to the cache/network.

API

[Constructor (DOMString type, optional ForeignFetchEventInit eventInitDict),
 Exposed=ServiceWorker]
interface ForeignFetchEvent : ExtendableEvent {
  readonly attribute Request request;
};

dictionary ForeignFetchEventInit : ExtendableEventInit {
  required Request request;
};

partial interface ServiceWorkerRegistration {
  Promise<void> enableForeignFetch();
  Promise<void> disableForeignFetch();
);

Note: We cannot extend FetchEvent because that exposes client and messaging functionality which might lead to security issues since current practice is all same-origin messaging when it comes to service workers.

Link header

Link:</sw.js>;rel=serviceworker;scope=/;handles=fetch,foreignfetch,push