tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 776693692df8f2cc1f69be77d5beabb6b10e2305
parent 21b7c710ace504272ad9fac2ca92f747e9bd9954
Author: Fred Chasen <fchasen@mozilla.com>
Date:   Tue, 18 Nov 2025 00:04:19 +0000

Bug 2000298 - Refetch IPP entitlement without clearing it first in IPPEnrollAndEntitleManager. r=ip-protection-reviewers,kpatenio

Clearing the state when refetching the entitlement was causing the panel to duplicate, to prevent that this updates IPPEnrollAndEntitleManager.refetchEntitlement to just force refetching the entitlement.

Differential Revision: https://phabricator.services.mozilla.com/D272724

Diffstat:
Mbrowser/components/ipprotection/IPPEnrollAndEntitleManager.sys.mjs | 9+++++----
Mbrowser/components/ipprotection/tests/xpcshell/test_IPProtectionService.js | 2+-
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/browser/components/ipprotection/IPPEnrollAndEntitleManager.sys.mjs b/browser/components/ipprotection/IPPEnrollAndEntitleManager.sys.mjs @@ -96,12 +96,12 @@ class IPPEnrollAndEntitleManagerSingleton extends EventTarget { this.maybeEnrollAndEntitle(); } - maybeEnrollAndEntitle() { + maybeEnrollAndEntitle(forceRefetch = false) { if (this.#runningPromise) { return this.#runningPromise; } - if (this.#entitlement) { + if (this.#entitlement && !forceRefetch) { return Promise.resolve({ isEnrolledAndEntitled: true }); } @@ -109,6 +109,8 @@ class IPPEnrollAndEntitleManagerSingleton extends EventTarget { const data = await IPPEnrollAndEntitleManagerSingleton.#maybeEnrollAndEntitle(); if (!data.entitlement) { + // Unset the entitlement if not available. + this.#setEntitlement(null); return { isEnrolledAndEntitled: false, error: data.error }; } @@ -221,8 +223,7 @@ class IPPEnrollAndEntitleManagerSingleton extends EventTarget { } async refetchEntitlement() { - this.#setEntitlement(null); - await this.maybeEnrollAndEntitle(); + await this.maybeEnrollAndEntitle(true); } resetEntitlement() { diff --git a/browser/components/ipprotection/tests/xpcshell/test_IPProtectionService.js b/browser/components/ipprotection/tests/xpcshell/test_IPProtectionService.js @@ -141,7 +141,7 @@ add_task( ); /** - * Tests that refetchEntlement returns errors if no linked VPN is found and + * Tests that refetchEntitlement returns errors if no linked VPN is found and * sends an event. */ add_task(