mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Partially bring suspendTabsUntilReady out of experimental status
This commit will force-reload active tabs at launch for environments not supporting suspend network request listeners, or configured to not suspend network request listeners.
This commit is contained in:
parent
edab87b4bc
commit
a0a9497b4a
@ -304,7 +304,7 @@ const onHiddenSettingsReady = async function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matbe override default cache storage
|
// Maybe override default cache storage
|
||||||
const cacheBackend = await cacheStorage.select(
|
const cacheBackend = await cacheStorage.select(
|
||||||
µb.hiddenSettings.cacheStorageAPI
|
µb.hiddenSettings.cacheStorageAPI
|
||||||
);
|
);
|
||||||
|
@ -1138,7 +1138,7 @@ const webRequest = {
|
|||||||
vAPI.net = new vAPI.Net();
|
vAPI.net = new vAPI.Net();
|
||||||
vAPI.net.suspend();
|
vAPI.net.suspend();
|
||||||
|
|
||||||
return ( ) => {
|
return async ( ) => {
|
||||||
vAPI.net.setSuspendableListener(onBeforeRequest);
|
vAPI.net.setSuspendableListener(onBeforeRequest);
|
||||||
vAPI.net.addListener(
|
vAPI.net.addListener(
|
||||||
'onHeadersReceived',
|
'onHeadersReceived',
|
||||||
@ -1146,7 +1146,21 @@ const webRequest = {
|
|||||||
{ urls: [ 'http://*/*', 'https://*/*' ] },
|
{ urls: [ 'http://*/*', 'https://*/*' ] },
|
||||||
[ 'blocking', 'responseHeaders' ]
|
[ 'blocking', 'responseHeaders' ]
|
||||||
);
|
);
|
||||||
vAPI.net.unsuspend(true);
|
vAPI.net.unsuspend({ force: true });
|
||||||
|
// Mitigation: force-reload active tabs for environments not
|
||||||
|
// supporting suspended network request listeners.
|
||||||
|
if (
|
||||||
|
vAPI.net.canSuspend() !== true ||
|
||||||
|
µb.hiddenSettings.suspendTabsUntilReady === 'no'
|
||||||
|
) {
|
||||||
|
const tabs = await vAPI.tabs.query({
|
||||||
|
active: true,
|
||||||
|
windowType: 'normal',
|
||||||
|
});
|
||||||
|
for ( const tab of tabs ) {
|
||||||
|
vAPI.tabs.reload(tab.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})(),
|
})(),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user