Skip to content

Commit a0a9497

Browse files
committed
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.
1 parent edab87b commit a0a9497

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/js/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const onHiddenSettingsReady = async function() {
304304
});
305305
}
306306

307-
// Matbe override default cache storage
307+
// Maybe override default cache storage
308308
const cacheBackend = await cacheStorage.select(
309309
µb.hiddenSettings.cacheStorageAPI
310310
);

src/js/traffic.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,15 +1138,29 @@ const webRequest = {
11381138
vAPI.net = new vAPI.Net();
11391139
vAPI.net.suspend();
11401140

1141-
return ( ) => {
1141+
return async ( ) => {
11421142
vAPI.net.setSuspendableListener(onBeforeRequest);
11431143
vAPI.net.addListener(
11441144
'onHeadersReceived',
11451145
onHeadersReceived,
11461146
{ urls: [ 'http://*/*', 'https://*/*' ] },
11471147
[ 'blocking', 'responseHeaders' ]
11481148
);
1149-
vAPI.net.unsuspend(true);
1149+
vAPI.net.unsuspend({ force: true });
1150+
// Mitigation: force-reload active tabs for environments not
1151+
// supporting suspended network request listeners.
1152+
if (
1153+
vAPI.net.canSuspend() !== true ||
1154+
µb.hiddenSettings.suspendTabsUntilReady === 'no'
1155+
) {
1156+
const tabs = await vAPI.tabs.query({
1157+
active: true,
1158+
windowType: 'normal',
1159+
});
1160+
for ( const tab of tabs ) {
1161+
vAPI.tabs.reload(tab.id);
1162+
}
1163+
}
11501164
};
11511165
})(),
11521166

0 commit comments

Comments
 (0)