You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pouchdb.apache.org by ja...@apache.org on 2026/05/16 09:39:25 UTC
(pouchdb) 12/18: fix: ignore browser extensions in serviceworker
This is an automated email from the ASF dual-hosted git repository.
janl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pouchdb.git
commit 4b2a17553bc3ad99d84ad81fb604a89cddf48fa7
Author: Alex Feyerke <al...@neighbourhood.ie>
AuthorDate: Mon May 4 14:36:24 2026 +0200
fix: ignore browser extensions in serviceworker
---
docs/serviceWorker.js.liquid | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/docs/serviceWorker.js.liquid b/docs/serviceWorker.js.liquid
index 7cd76c4f3..2e797acc5 100644
--- a/docs/serviceWorker.js.liquid
+++ b/docs/serviceWorker.js.liquid
@@ -78,18 +78,21 @@ self.addEventListener('activate', function (event) {
});
self.addEventListener('fetch', function (event) {
- // Try the cache, if it's not in there try the network, then cache that response
- // if that network request fails show the offline.html page.
- event.respondWith(
- caches.open(newCacheName).then(function (cache) {
- return cache.match(event.request).then(function (response) {
- return response || fetch(event.request).then(function (response) {
- cache.put(event.request, response.clone());
- return response;
- }).catch(function () {
- return cache.match('/offline.html');
+ // Ignore requests from browser extensions etc
+ if ((event.request.url.indexOf('http') === 0)) {
+ // Try the cache, if it's not in there try the network, then cache that response
+ // if that network request fails show the offline.html page.
+ event.respondWith(
+ caches.open(newCacheName).then(function (cache) {
+ return cache.match(event.request).then(function (response) {
+ return response || fetch(event.request).then(function (response) {
+ cache.put(event.request, response.clone());
+ return response;
+ }).catch(function () {
+ return cache.match('/offline.html');
+ });
});
- });
- })
- );
+ })
+ );
+ }
});