From e21e5ed16dd2390cee104e38df8b23d4c1d4d06d Mon Sep 17 00:00:00 2001 From: Ashvin Jangid <142579833+ashvwinn@users.noreply.github.com> Date: Tue, 21 Jul 2026 04:41:54 +0530 Subject: [PATCH] gh-14461: Fix boost size override not persisting (gh-14664) --- src/zen/boosts/ZenBoostsEditor.mjs | 5 ++++- src/zen/boosts/actors/ZenBoostsChild.sys.mjs | 21 +++--------------- src/zen/boosts/actors/ZenBoostsParent.sys.mjs | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/zen/boosts/ZenBoostsEditor.mjs b/src/zen/boosts/ZenBoostsEditor.mjs index f67ad0fa3..2f37a99a5 100644 --- a/src/zen/boosts/ZenBoostsEditor.mjs +++ b/src/zen/boosts/ZenBoostsEditor.mjs @@ -659,7 +659,10 @@ ${cssSelector} { this.currentBoostData.sizeOverride = 0.9; } else if (this.currentBoostData.sizeOverride == 0.9) { this.currentBoostData.sizeOverride = 1; - await this.zenBoostsChild.sendQuery("ZenBoost:DisableSizeOverride"); + await this.zenBoostsChild.updateBoostSizeOverride( + this.currentBoostData.sizeOverride, + /* disable: */ true + ); } this.currentBoostData.changeWasMade = true; diff --git a/src/zen/boosts/actors/ZenBoostsChild.sys.mjs b/src/zen/boosts/actors/ZenBoostsChild.sys.mjs index 13551682f..364490698 100644 --- a/src/zen/boosts/actors/ZenBoostsChild.sys.mjs +++ b/src/zen/boosts/actors/ZenBoostsChild.sys.mjs @@ -280,9 +280,6 @@ export class ZenBoostsChild extends JSWindowActorChild { case "ZenBoost:OpenInspector": this.sendAsyncMessage("ZenBoost:OpenInspector"); break; - case "ZenBoost:DisableSizeOverride": - this.disableSizeOverride(); - break; } return null; } @@ -359,13 +356,9 @@ export class ZenBoostsChild extends JSWindowActorChild { this.#loadStyleSheet(boost.styleSheet); } - if ( - boostData.sizeOverride && - isFinite(boostData.sizeOverride) && - boostData.sizeOverride !== 1 - ) { - browsingContext.fullZoom = boostData.sizeOverride; - } + this.sendAsyncMessage("ZenBoost:UpdateBoostSize", { + sizeOverride: boostData.sizeOverride, + }); browsingContext.isZenBoostsInverted = boostData.smartInvert; if (boostData.enableColorBoost) { @@ -552,14 +545,6 @@ export class ZenBoostsChild extends JSWindowActorChild { this.sendNotify("selector-picker-state-update", "ondisable"); } - disableSizeOverride() { - const browsingContext = this.browsingContext; - if (!browsingContext || browsingContext.parent !== null) { - return; - } - browsingContext.fullZoom = 1; - } - sendNotify(topic, msg = null) { this.sendAsyncMessage("ZenBoost:Notify", { topic, msg }); } diff --git a/src/zen/boosts/actors/ZenBoostsParent.sys.mjs b/src/zen/boosts/actors/ZenBoostsParent.sys.mjs index 50e251955..0cffb5a73 100644 --- a/src/zen/boosts/actors/ZenBoostsParent.sys.mjs +++ b/src/zen/boosts/actors/ZenBoostsParent.sys.mjs @@ -72,6 +72,23 @@ export class ZenBoostsParent extends JSWindowActorParent { } } + /** + * Updates the boost size override on webpage + * + * @param {number} sizeOverride - The size to apply on the webpage as a override + * @param {boolean} disable - Whether to disable the override (sets override to the default 1) + */ + updateBoostSizeOverride(sizeOverride, disable = false) { + if ( + sizeOverride && + isFinite(sizeOverride) && + (sizeOverride !== 1 || disable) + ) { + const fullZoom = this.browsingContext.topChromeWindow.FullZoom; + fullZoom.setZoom(sizeOverride); + } + } + /** * Handles messages received from child actors. * Retrieves boost data for a domain when requested. @@ -174,6 +191,11 @@ export class ZenBoostsParent extends JSWindowActorParent { : null, }; } + case "ZenBoost:UpdateBoostSize": { + const { sizeOverride } = message.data; + this.updateBoostSizeOverride(sizeOverride); + break; + } default: { console.warn(`[ZenBoostsParent]: Unknown message: ${message.name}`); break;