Skip to content

Commit

Permalink
Correct typing of the FetchEvent.preloadResponse property a little.
Browse files Browse the repository at this point in the history
The spec calls out some cases where this can resolve to undefined, such as
navigation preload not being turned on. See the cases where preloadResponse
resolves to undefined in this algorithm:
https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm

Also add targetClientId and reservedClientId to the spec from
w3c/ServiceWorker#870

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164604919
  • Loading branch information
clayw authored and blickly committed Aug 8, 2017
1 parent 98f9f37 commit a2f4dee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions externs/browser/w3c_serviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ function FetchEvent(type, opt_eventInitDict) {}
FetchEvent.prototype.request;

/**
* @type {!Promise<Response>}
* @type {!Promise<!Response|undefined>}
*/
FetchEvent.prototype.preloadResponse;

Expand All @@ -604,11 +604,17 @@ FetchEvent.prototype.client;
/** @type {?string} */
FetchEvent.prototype.clientId;

/** @type {?string} */
FetchEvent.prototype.targetClientId;

/** @type {?string} */
FetchEvent.prototype.reserveClientId;

/** @type {!boolean} */
FetchEvent.prototype.isReload;

/**
* @param {(Response|IThenable<Response>)} r
* @param {(Response|IThenable<?Response|undefined>)} r
* @return {undefined}
*/
FetchEvent.prototype.respondWith = function(r) {};
Expand All @@ -629,7 +635,7 @@ FetchEvent.prototype.default = function() {};
* bubbles: (boolean|undefined),
* cancelable: (boolean|undefined),
* request: (!Request|undefined),
* preloadResponse: (!Promise<Response>),
* preloadResponse: (!Promise<?Response|undefined>),
* client: (!ServiceWorkerClient|undefined),
* isReload: (!boolean|undefined)
* }}
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/resources.json

Large diffs are not rendered by default.

0 comments on commit a2f4dee

Please sign in to comment.