Skip to content

Commit

Permalink
fix: invalidate cache on restart after upgrade, Firefox loads scripts…
Browse files Browse the repository at this point in the history
… from the startup cache (closes #359)
  • Loading branch information
onemen committed Nov 13, 2024
1 parent 371e595 commit 52218e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion addon/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ function restartApplication() {
return undefined;
}

let invalidateCachesOnRestart = false;

/** @type {Bootstarp.showRestartNotification} */
function showRestartNotification(verb, window) {
if (!window.gBrowser.selectedBrowser) {
Expand All @@ -92,13 +94,16 @@ function showRestartNotification(verb, window) {
label: 'Restart Now',
accessKey: 'R',
callback() {
Services.appinfo.invalidateCachesOnRestart();
restartApplication();
}
},
[{
label: 'Not Now',
accessKey: 'N',
callback: () => { },
callback: () => {
invalidateCachesOnRestart = true;
},
}],
{
popupIconURL: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIgogICAgIHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgdmlld0JveD0iMCAwIDY0IDY0Ij4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLnN0eWxlLXB1enpsZS1waWVjZSB7CiAgICAgICAgZmlsbDogdXJsKCcjZ3JhZGllbnQtbGluZWFyLXB1enpsZS1waWVjZScpOwogICAgICAgIGZpbGwtb3BhY2l0eTogLjI1OwogICAgICB9CiAgICAgIC5zdHlsZS1wdXp6bGUtcGllY2Utb3V0bGluZSB7CiAgICAgICAgZmlsbDogbm9uZTsKICAgICAgICBzdHJva2Utd2lkdGg6IDI7CiAgICAgICAgc3Ryb2tlOiAjNTJiMzNlOwogICAgICAgIHN0cm9rZS1kYXNoYXJyYXk6IDQgMjsK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NsYXNzPSJzdHlsZS1iYWRnZS1pY29uIiBkPSJNMjEsMTVoLTZsMi40LTIuNGMtMC42LTAuNC0xLjItMC42LTEuOS0wLjZjLTIsMC0zLjUsMS42LTMuNSwzLjUgYzAsMiwxLjYsMy41LDMuNSwzLjVjMSwwLDItMC41LDIuNi0xLjJsMS43LDFjLTEsMS4zLTIuNiwyLjEtNC4zLDIuMWMtMywwLTUuNS0yLjUtNS41LTUuNWMwLTMsMi41LTUuNSw1LjUtNS41IGMxLjMsMCwyLjQsMC40LDMuMywxLjJMMjEsOVYxNXoiLz4KICA8L3N2Zz4KPC9zdmc+Cg==',
Expand Down Expand Up @@ -217,6 +222,9 @@ function shutdown(data, reason) {
showRestartNotification("disabled", window);
} else if (reason === ADDON_UNINSTALL /* && window.Tabmix */) {
showRestartNotification("uninstalled", window);
} else if (invalidateCachesOnRestart) {
Services.appinfo.invalidateCachesOnRestart();
invalidateCachesOnRestart = false;
}

TabmixWidgets.destroy(reason === ADDON_UNINSTALL);
Expand Down

0 comments on commit 52218e0

Please sign in to comment.