mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 01:29:39 +02: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
@ -211,6 +211,12 @@ vAPI.Tabs = class {
|
|||||||
this.onCreatedNavigationTargetHandler(details);
|
this.onCreatedNavigationTargetHandler(details);
|
||||||
});
|
});
|
||||||
browser.webNavigation.onCommitted.addListener(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);
|
this.onCommittedHandler(details);
|
||||||
});
|
});
|
||||||
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||||
@ -1268,10 +1274,7 @@ vAPI.Net = class {
|
|||||||
listener = details => {
|
listener = details => {
|
||||||
const { tabId, type } = details;
|
const { tabId, type } = details;
|
||||||
if ( type === 'main_frame' && this.unprocessedTabs.has(tabId) ) {
|
if ( type === 'main_frame' && this.unprocessedTabs.has(tabId) ) {
|
||||||
this.unprocessedTabs.delete(tabId);
|
if ( this.removeUnprocessedRequest(tabId) ) {
|
||||||
if ( this.unprocessedTabs.size === 0 ) {
|
|
||||||
this.suspendableListener = this.deferredSuspendableListener;
|
|
||||||
this.deferredSuspendableListener = undefined;
|
|
||||||
return this.suspendableListener(details);
|
return this.suspendableListener(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1311,6 +1314,13 @@ vAPI.Net = class {
|
|||||||
return this.unprocessedTabs.size !== 0 &&
|
return this.unprocessedTabs.size !== 0 &&
|
||||||
this.unprocessedTabs.has(tabId);
|
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() {
|
suspendOneRequest() {
|
||||||
}
|
}
|
||||||
unsuspendAllRequests() {
|
unsuspendAllRequests() {
|
||||||
|
Loading…
Reference in New Issue
Block a user