Force cache bypass reload when no-scripting switch is toggled

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3652
This commit is contained in:
Raymond Hill 2025-06-01 13:48:23 -04:00
parent fad39c6ce5
commit 4affe343dd
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -56,6 +56,7 @@ let dfPaneBuilt = false;
let dfHotspots = null;
const allHostnameRows = [];
let cachedPopupHash = '';
let forceReloadFlag = 0;
// https://github.com/gorhill/uBlock/issues/2550
// Solution inspired from
@ -130,6 +131,7 @@ const hashFromPopupData = function(reset = false) {
const hash = hasher.join('');
if ( reset ) {
cachedPopupHash = hash;
forceReloadFlag = 0;
}
dom.cl.toggle(dom.body, 'needReload',
hash !== cachedPopupHash || popupData.hasUnprocessedRequest === true
@ -1167,7 +1169,7 @@ const reloadTab = function(bypassCache = false) {
tabId: popupData.tabId,
url: popupData.rawURL,
select: vAPI.webextFlavor.soup.has('mobile'),
bypassCache,
bypassCache: bypassCache || forceReloadFlag !== 0,
});
// Polling will take care of refreshing the popup content
@ -1344,6 +1346,10 @@ const toggleHostnameSwitch = async function(ev) {
persist: ev.ctrlKey || ev.metaKey,
});
if ( switchName === 'no-scripting' ) {
forceReloadFlag ^= 1;
}
cachePopupData(response);
hashFromPopupData();