mirror of https://github.com/gorhill/uBlock.git
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(
|
||||
µb.hiddenSettings.cacheStorageAPI
|
||||
);
|
||||
|
|
|
@ -1138,7 +1138,7 @@ const webRequest = {
|
|||
vAPI.net = new vAPI.Net();
|
||||
vAPI.net.suspend();
|
||||
|
||||
return ( ) => {
|
||||
return async ( ) => {
|
||||
vAPI.net.setSuspendableListener(onBeforeRequest);
|
||||
vAPI.net.addListener(
|
||||
'onHeadersReceived',
|
||||
|
@ -1146,7 +1146,21 @@ const webRequest = {
|
|||
{ urls: [ 'http://*/*', 'https://*/*' ] },
|
||||
[ '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