Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Add unregisterMissingServiceWorkers option. #53

Merged
merged 1 commit into from
Oct 23, 2017
Merged

Add unregisterMissingServiceWorkers option. #53

merged 1 commit into from
Oct 23, 2017

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Oct 23, 2017

By default, automatically serve a tiny self-unregistering service worker for would-be 404 service worker requests, to prevent clients from getting stuck with invalid service workers indefinitely.

Fixes Polymer/shop#150

@aomarks aomarks changed the title Add unregisterMissingServiceWorkers option. Add unregisterMissingServiceWorkers option. Oct 23, 2017
@aomarks aomarks force-pushed the sw-killer branch 3 times, most recently from 1be9a8c to 8ee5651 Compare October 23, 2017 22:32
src/prpl.ts Outdated
@@ -51,6 +67,8 @@ export function makeHandler(root?: string, config?: Config): (
console.info(`Serving files from "${absRoot}".`);
const builds = loadBuilds(absRoot, config);
const cacheControl = (config && config.cacheControl) || 'max-age=60';
const unregisterMissingServiceWorkers =
(config && config.unregisterMissingServiceWorkers === false) || true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like unregisterMissingServiceWorkers is always evaluated to true here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Fixed and added test.

By default, automatically serve a tiny self-unregistering service worker
for would-be 404 service worker requests, to prevent clients from
getting stuck with invalid service workers indefinitely.
@aomarks aomarks merged commit 1dacf3f into master Oct 23, 2017
@aomarks aomarks deleted the sw-killer branch October 23, 2017 23:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants