mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Clear unprocessed requests status on webNavigation reload event
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/discussions/2564
This commit is contained in:
parent
a6071565a5
commit
0b09155268
1 changed files with 14 additions and 4 deletions
|
@ -211,6 +211,12 @@ vAPI.Tabs = class {
|
|||
this.onCreatedNavigationTargetHandler(details);
|
||||
});
|
||||
browser.webNavigation.onCommitted.addListener(details => {
|
||||
const { frameId, tabId } = details;
|
||||
if ( frameId === 0 && tabId > 0 && details.transitionType === 'reload' ) {
|
||||
if ( vAPI.net && vAPI.net.hasUnprocessedRequest(tabId) ) {
|
||||
vAPI.net.removeUnprocessedRequest(tabId);
|
||||
}
|
||||
}
|
||||
this.onCommittedHandler(details);
|
||||
});
|
||||
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
|
@ -1268,10 +1274,7 @@ vAPI.Net = class {
|
|||
listener = details => {
|
||||
const { tabId, type } = details;
|
||||
if ( type === 'main_frame' && this.unprocessedTabs.has(tabId) ) {
|
||||
this.unprocessedTabs.delete(tabId);
|
||||
if ( this.unprocessedTabs.size === 0 ) {
|
||||
this.suspendableListener = this.deferredSuspendableListener;
|
||||
this.deferredSuspendableListener = undefined;
|
||||
if ( this.removeUnprocessedRequest(tabId) ) {
|
||||
return this.suspendableListener(details);
|
||||
}
|
||||
}
|
||||
|
@ -1311,6 +1314,13 @@ vAPI.Net = class {
|
|||
return this.unprocessedTabs.size !== 0 &&
|
||||
this.unprocessedTabs.has(tabId);
|
||||
}
|
||||
removeUnprocessedRequest(tabId) {
|
||||
this.unprocessedTabs.delete(tabId);
|
||||
if ( this.unprocessedTabs.size !== 0 ) { return false; }
|
||||
this.suspendableListener = this.deferredSuspendableListener;
|
||||
this.deferredSuspendableListener = undefined;
|
||||
return true;
|
||||
}
|
||||
suspendOneRequest() {
|
||||
}
|
||||
unsuspendAllRequests() {
|
||||
|
|
Loading…
Reference in a new issue