fix(service-worker): navigation urls backwards compatibility (#27244)
PR Close #27244
This commit is contained in:
@ -15,6 +15,12 @@ import {IdleScheduler} from './idle';
|
||||
import {Manifest} from './manifest';
|
||||
|
||||
|
||||
const BACKWARDS_COMPATIBILITY_NAVIGATION_URLS = [
|
||||
{positive: true, regex: '^/.*$'},
|
||||
{positive: false, regex: '^/.*\\.[^/]*$'},
|
||||
{positive: false, regex: '^/.*__'},
|
||||
];
|
||||
|
||||
/**
|
||||
* A specific version of the application, identified by a unique manifest
|
||||
* as determined by its hash.
|
||||
@ -85,6 +91,10 @@ export class AppVersion implements UpdateSource {
|
||||
this.scope, this.adapter, config, this.database,
|
||||
`ngsw:${config.version}:data`));
|
||||
|
||||
// This keeps backwards compatibility with app versions without navigation urls.
|
||||
// Fix: https://github.com/angular/angular/issues/27209
|
||||
manifest.navigationUrls = manifest.navigationUrls || BACKWARDS_COMPATIBILITY_NAVIGATION_URLS;
|
||||
|
||||
// Create `include`/`exclude` RegExps for the `navigationUrls` declared in the manifest.
|
||||
const includeUrls = manifest.navigationUrls.filter(spec => spec.positive);
|
||||
const excludeUrls = manifest.navigationUrls.filter(spec => !spec.positive);
|
||||
|
Reference in New Issue
Block a user