mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Forcefully clear unprocessed-request status after a minute
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/2589#issuecomment-1507084473
This commit is contained in:
parent
e5e8e0d443
commit
c97d0ab062
@ -890,7 +890,7 @@ if ( webext.browserAction instanceof Object ) {
|
|||||||
});
|
});
|
||||||
browserAction.setBadgeText({ text });
|
browserAction.setBadgeText({ text });
|
||||||
browserAction.setBadgeBackgroundColor({
|
browserAction.setBadgeBackgroundColor({
|
||||||
color: text === '!' ? '#FFCC00' : '#666'
|
color: text === '!' ? '#FC0' : '#666'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1252,7 +1252,6 @@ vAPI.Net = class {
|
|||||||
this.listenerMap = new WeakMap();
|
this.listenerMap = new WeakMap();
|
||||||
this.suspendDepth = 0;
|
this.suspendDepth = 0;
|
||||||
this.unprocessedTabs = new Map();
|
this.unprocessedTabs = new Map();
|
||||||
this.processRequestStartTime = Number.MAX_SAFE_INTEGER;
|
|
||||||
|
|
||||||
browser.webRequest.onBeforeRequest.addListener(
|
browser.webRequest.onBeforeRequest.addListener(
|
||||||
details => {
|
details => {
|
||||||
@ -1335,7 +1334,6 @@ vAPI.Net = class {
|
|||||||
}
|
}
|
||||||
return this.deferredSuspendableListener(details);
|
return this.deferredSuspendableListener(details);
|
||||||
};
|
};
|
||||||
this.processRequestStartTime = Date.now();
|
|
||||||
}
|
}
|
||||||
this.suspendableListener = listener;
|
this.suspendableListener = listener;
|
||||||
vAPI.setDefaultIcon('', '');
|
vAPI.setDefaultIcon('', '');
|
||||||
@ -1371,9 +1369,7 @@ vAPI.Net = class {
|
|||||||
}
|
}
|
||||||
hasUnprocessedRequest(tabId) {
|
hasUnprocessedRequest(tabId) {
|
||||||
if ( this.unprocessedTabs.size === 0 ) { return false; }
|
if ( this.unprocessedTabs.size === 0 ) { return false; }
|
||||||
if ( (Date.now() - this.processRequestStartTime) > 60000 ) {
|
if ( tabId === undefined ) { return true; }
|
||||||
this.removeUnprocessedRequest();
|
|
||||||
}
|
|
||||||
return this.unprocessedTabs.has(tabId);
|
return this.unprocessedTabs.has(tabId);
|
||||||
}
|
}
|
||||||
removeUnprocessedRequest(tabId) {
|
removeUnprocessedRequest(tabId) {
|
||||||
|
@ -982,7 +982,7 @@ const injectCSP = function(fctxt, pageStore, responseHeaders) {
|
|||||||
|
|
||||||
if ( cspSubsets.length === 0 ) { return; }
|
if ( cspSubsets.length === 0 ) { return; }
|
||||||
|
|
||||||
µb.updateToolbarIcon(fctxt.tabId, 0x02);
|
µb.updateToolbarIcon(fctxt.tabId, 0b0010);
|
||||||
|
|
||||||
// Use comma to merge CSP directives.
|
// Use comma to merge CSP directives.
|
||||||
// Ref.: https://www.w3.org/TR/CSP2/#implementation-considerations
|
// Ref.: https://www.w3.org/TR/CSP2/#implementation-considerations
|
||||||
@ -1133,6 +1133,14 @@ const webRequest = {
|
|||||||
urls: [ 'http://*/*', 'https://*/*' ]
|
urls: [ 'http://*/*', 'https://*/*' ]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
vAPI.defer.once({ min: 1 }).then(( ) => {
|
||||||
|
if ( vAPI.net.hasUnprocessedRequest() === false ) { return; }
|
||||||
|
vAPI.net.removeUnprocessedRequest();
|
||||||
|
vAPI.tabs.getCurrent().then(tab => {
|
||||||
|
if ( tab === null ) { return; }
|
||||||
|
µb.updateToolbarIcon(tab.id, 0b0110);
|
||||||
|
});
|
||||||
|
});
|
||||||
vAPI.net.unsuspend({ all: true });
|
vAPI.net.unsuspend({ all: true });
|
||||||
};
|
};
|
||||||
})(),
|
})(),
|
||||||
|
Loading…
Reference in New Issue
Block a user