1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-22 18:32:45 +01:00

Time when main listener was installed is enough

This commit is contained in:
Raymond Hill 2023-04-12 18:24:30 -04:00
parent 86477dd4e5
commit 0575567d2a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1252,7 +1252,7 @@ vAPI.Net = class {
this.listenerMap = new WeakMap();
this.suspendDepth = 0;
this.unprocessedTabs = new Map();
this.lastUnprocessedRequestTime = Number.MAX_SAFE_INTEGER;
this.processRequestStartTime = Number.MAX_SAFE_INTEGER;
browser.webRequest.onBeforeRequest.addListener(
details => {
@ -1335,6 +1335,7 @@ vAPI.Net = class {
}
return this.deferredSuspendableListener(details);
};
this.processRequestStartTime = Date.now();
}
this.suspendableListener = listener;
vAPI.setDefaultIcon('', '');
@ -1367,11 +1368,10 @@ vAPI.Net = class {
this.unprocessedTabs.set(tabId, (requests = []));
}
requests.push(Object.assign({}, details));
this.lastUnprocessedRequestTime = Date.now();
}
hasUnprocessedRequest(tabId) {
if ( this.unprocessedTabs.size === 0 ) { return false; }
if ( (Date.now() - this.lastUnprocessedRequestTime) > 60000 ) {
if ( (Date.now() - this.processRequestStartTime) > 60000 ) {
this.removeUnprocessedRequest();
}
return this.unprocessedTabs.has(tabId);