diff --git a/infra/testing/validator/service-worker-runtime.js b/infra/testing/validator/service-worker-runtime.js index 9534df85e..f99e56344 100644 --- a/infra/testing/validator/service-worker-runtime.js +++ b/infra/testing/validator/service-worker-runtime.js @@ -47,7 +47,7 @@ function setupSpiesAndContext() { }, precaching: { // To make testing easier, hardcode this fake URL return value. - getCacheKeyForUrl: sinon.stub().returns('/urlWithCacheKey'), + getCacheKeyForURL: sinon.stub().returns('/urlWithCacheKey'), precacheAndRoute: sinon.spy(), cleanupOutdatedCaches: sinon.spy(), }, @@ -80,7 +80,7 @@ function setupSpiesAndContext() { cacheExpirationPlugin: cacheExpirationPluginSpy, CacheFirst: workbox.strategies.CacheFirst, clientsClaim: workbox.core.clientsClaim, - getCacheKeyForUrl: workbox.precaching.getCacheKeyForUrl, + getCacheKeyForURL: workbox.precaching.getCacheKeyForURL, googleAnalyticsInitialize: workbox.googleAnalytics.initialize, NetworkFirst: workbox.strategies.NetworkFirst, precacheAndRoute: workbox.precaching.precacheAndRoute, diff --git a/packages/workbox-build/src/templates/sw-template.js b/packages/workbox-build/src/templates/sw-template.js index fe99fe3cd..aa00252e0 100644 --- a/packages/workbox-build/src/templates/sw-template.js +++ b/packages/workbox-build/src/templates/sw-template.js @@ -48,7 +48,7 @@ if (Array.isArray(self.__precacheManifest)) { } <% } %> <% if (cleanupOutdatedCaches) { %>workbox.precaching.cleanupOutdatedCaches();<% } %> -<% if (navigateFallback) { %>workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForUrl(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackWhitelist || navigateFallbackBlacklist) { %>, { +<% if (navigateFallback) { %>workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL(<%= JSON.stringify(navigateFallback) %>)<% if (navigateFallbackWhitelist || navigateFallbackBlacklist) { %>, { <% if (navigateFallbackWhitelist) { %>whitelist: [<%= navigateFallbackWhitelist %>],<% } %> <% if (navigateFallbackBlacklist) { %>blacklist: [<%= navigateFallbackBlacklist %>],<% } %> }<% } %>);<% } %> diff --git a/test/workbox-build/node/entry-points/generate-sw-string.js b/test/workbox-build/node/entry-points/generate-sw-string.js index 707c138fe..fba450a4e 100644 --- a/test/workbox-build/node/entry-points/generate-sw-string.js +++ b/test/workbox-build/node/entry-points/generate-sw-string.js @@ -210,7 +210,7 @@ describe(`[workbox-build] entry-points/generate-sw-string.js (End to End)`, func const {swString, warnings} = await generateSWString(options); expect(warnings).to.be.empty; await validateServiceWorkerRuntime({swString, expectedMethodCalls: { - getCacheKeyForUrl: [[navigateFallback]], + getCacheKeyForURL: [[navigateFallback]], importScripts: [[...DEFAULT_IMPORT_SCRIPTS]], precacheAndRoute: [[[], {}]], registerNavigationRoute: [['/urlWithCacheKey']], @@ -228,7 +228,7 @@ describe(`[workbox-build] entry-points/generate-sw-string.js (End to End)`, func const {swString, warnings} = await generateSWString(options); expect(warnings).to.be.empty; await validateServiceWorkerRuntime({swString, expectedMethodCalls: { - getCacheKeyForUrl: [[navigateFallback]], + getCacheKeyForURL: [[navigateFallback]], importScripts: [[...DEFAULT_IMPORT_SCRIPTS]], precacheAndRoute: [[[], {}]], registerNavigationRoute: [['/urlWithCacheKey', { diff --git a/test/workbox-build/node/entry-points/generate-sw.js b/test/workbox-build/node/entry-points/generate-sw.js index f3cc096df..8e050c391 100644 --- a/test/workbox-build/node/entry-points/generate-sw.js +++ b/test/workbox-build/node/entry-points/generate-sw.js @@ -366,7 +366,7 @@ describe(`[workbox-build] entry-points/generate-sw.js (End to End)`, function() expect(count).to.eql(6); expect(size).to.eql(2604); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - getCacheKeyForUrl: [[navigateFallback]], + getCacheKeyForURL: [[navigateFallback]], importScripts: [[WORKBOX_SW_CDN_URL]], precacheAndRoute: [[[{ url: 'index.html',