1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-26 12:22:50 +01:00

Minor code review

This commit is contained in:
Raymond Hill 2023-04-12 12:13:31 -04:00
parent df318a4fe6
commit a1619a118d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -288,7 +288,7 @@ vAPI.Tabs = class {
});
}
browser.tabs.onRemoved.addListener((tabId, details) => {
if ( vAPI.net ) {
if ( vAPI.net && vAPI.net.hasUnprocessedRequest(tabId) ) {
vAPI.net.removeUnprocessedRequest(tabId);
}
this.onRemovedHandler(tabId, details);
@ -1375,9 +1375,9 @@ vAPI.Net = class {
// - Aggressively clear the unprocessed-request status of all tabs as
// soon as there is a call to clear for one tab.
removeUnprocessedRequest() {
if ( this.unprocessedTabs.size === 0 ) { return true; }
this.unprocessedTabs.clear();
if ( this.deferredSuspendableListener === undefined ) { return true; }
if ( this.unprocessedTabs.size !== 0 ) { return false; }
this.suspendableListener = this.deferredSuspendableListener;
this.deferredSuspendableListener = undefined;
return true;