Skip to content

Commit

Permalink
dom overrides: add noop overrides for Cache objects, along with Cache…
Browse files Browse the repository at this point in the history
…Storage, to ensure APIs don't fail (eg. in extension domain)

bump to 3.8.5
  • Loading branch information
ikreymer committed Nov 15, 2024
1 parent 2dc83bb commit d82ec25
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webrecorder/wombat",
"version": "3.8.4",
"version": "3.8.5",
"main": "index.js",
"license": "AGPL-3.0-or-later",
"author": "Ilya Kreymer, Webrecorder Software",
Expand Down
34 changes: 34 additions & 0 deletions src/wombat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6245,6 +6245,39 @@ Wombat.prototype.initIndexedDBOverride = function() {
};

Wombat.prototype.initCachesOverride = function() {
if (!this.$wbwindow.Cache) {
return;
}

var proto = this.$wbwindow.Cache.prototype;

proto.match = function() {
return Promise.resolve(undefined);
}

Check failure on line 6256 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

proto.matchAll = function() {
return Promise.resolve([]);
}

Check failure on line 6260 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

proto.add = function() {
return Promise.resolve(undefined);
}

Check failure on line 6264 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

proto.put = function() {
return Promise.resolve(undefined);
}

Check failure on line 6268 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

proto.delete = function() {
return Promise.resolve(false);
}

Check failure on line 6272 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon

proto.keys = function() {
return Promise.resolve([]);
}

Check failure on line 6276 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
}

Check failure on line 6277 in src/wombat.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon


Wombat.prototype.initCacheStorageOverride = function() {
if (!this.$wbwindow.CacheStorage) {
return;
}
Expand Down Expand Up @@ -6972,6 +7005,7 @@ Wombat.prototype.wombatInit = function() {
this.initStorageOverride();

// wrap caches to ensure only host sandboxed caches are available
this.initCacheStorageOverride();
this.initCachesOverride();

// wraps indexeddb access to ensure only host sandboxed dbs are available
Expand Down

0 comments on commit d82ec25

Please sign in to comment.