mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Fix tabs.executeScript() not resolving in due time
Related feedback:
- 6efd8eb84a
This commit is contained in:
parent
0f5384ee0d
commit
d59eeba8e2
@ -609,6 +609,10 @@ const onMessage = function(request, sender, callback) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/commit/6efd8eb#commitcomment-107523558
|
||||||
|
// Important: for whatever reason, not using `document_start` causes the
|
||||||
|
// Promise returned by `tabs.executeScript()` to resolve only when the
|
||||||
|
// associated tab is closed.
|
||||||
case 'launchReporter': {
|
case 'launchReporter': {
|
||||||
const pageStore = µb.pageStoreFromTabId(request.tabId);
|
const pageStore = µb.pageStoreFromTabId(request.tabId);
|
||||||
if ( pageStore === null ) { break; }
|
if ( pageStore === null ) { break; }
|
||||||
@ -619,6 +623,7 @@ const onMessage = function(request, sender, callback) {
|
|||||||
allFrames: true,
|
allFrames: true,
|
||||||
file: '/js/scriptlets/cosmetic-report.js',
|
file: '/js/scriptlets/cosmetic-report.js',
|
||||||
matchAboutBlank: true,
|
matchAboutBlank: true,
|
||||||
|
runAt: 'document_start',
|
||||||
}).then(results => {
|
}).then(results => {
|
||||||
const filters = results.reduce((a, v) => {
|
const filters = results.reduce((a, v) => {
|
||||||
if ( Array.isArray(v) ) { a.push(...v); }
|
if ( Array.isArray(v) ) { a.push(...v); }
|
||||||
|
Loading…
Reference in New Issue
Block a user