tor-browser

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

commit f1d33027498e2ca1c9383edb46768467d5c0e908
parent 5644eaf736fa90ab53d1a25c79812099ded74d3e
Author: Meg Viar <lmegviar@gmail.com>
Date:   Tue, 30 Sep 2025 20:58:02 +0000

Bug 1985861 - Clear the pref used to target the restore from backup screen r=omc-reviewers,jprickett

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

Diffstat:
Mbrowser/components/aboutwelcome/content-src/components/EmbeddedBackupRestore.jsx | 14+++++++++++++-
Mbrowser/components/aboutwelcome/content/aboutwelcome.bundle.js | 15+++++++++++++++
Mbrowser/components/aboutwelcome/tests/unit/ContentTiles.test.jsx | 1+
Mbrowser/components/aboutwelcome/tests/unit/EmbeddedBackupRestore.test.jsx | 11+++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/browser/components/aboutwelcome/content-src/components/EmbeddedBackupRestore.jsx b/browser/components/aboutwelcome/content-src/components/EmbeddedBackupRestore.jsx @@ -2,11 +2,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -import React, { useRef } from "react"; +import React, { useRef, useEffect } from "react"; +import { AboutWelcomeUtils } from "../lib/aboutwelcome-utils.mjs"; export const EmbeddedBackupRestore = () => { const ref = useRef(); + useEffect(() => { + // Clear the pref used to target the restore screen so that users will not + // automatically see it again the next time they visit about:welcome. + AboutWelcomeUtils.handleUserAction({ + type: "SET_PREF", + data: { + pref: { name: "showRestoreFromBackup", value: false }, + }, + }); + }, []); + return ( <restore-from-backup aboutWelcomeEmbedded="true" diff --git a/browser/components/aboutwelcome/content/aboutwelcome.bundle.js b/browser/components/aboutwelcome/content/aboutwelcome.bundle.js @@ -3447,13 +3447,28 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _lib_aboutwelcome_utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ + const EmbeddedBackupRestore = () => { const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + // Clear the pref used to target the restore screen so that users will not + // automatically see it again the next time they visit about:welcome. + _lib_aboutwelcome_utils_mjs__WEBPACK_IMPORTED_MODULE_1__.AboutWelcomeUtils.handleUserAction({ + type: "SET_PREF", + data: { + pref: { + name: "showRestoreFromBackup", + value: false + } + } + }); + }, []); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("restore-from-backup", { aboutWelcomeEmbedded: "true", labelFontWeight: "600", diff --git a/browser/components/aboutwelcome/tests/unit/ContentTiles.test.jsx b/browser/components/aboutwelcome/tests/unit/ContentTiles.test.jsx @@ -90,6 +90,7 @@ describe("ContentTiles component", () => { globals.set({ AWSendToDeviceEmailsSupported: () => Promise.resolve(), }); + globals.set({ AWSendToParent: sandbox.stub() }); wrapper = shallow( <ContentTiles content={TEST_CONTENT} diff --git a/browser/components/aboutwelcome/tests/unit/EmbeddedBackupRestore.test.jsx b/browser/components/aboutwelcome/tests/unit/EmbeddedBackupRestore.test.jsx @@ -1,11 +1,22 @@ import React from "react"; import { mount } from "enzyme"; import { EmbeddedBackupRestore } from "content-src/components/EmbeddedBackupRestore"; +import { GlobalOverrider } from "asrouter/tests/unit/utils"; describe("EmbeddedBackupRestore component", () => { let wrapper; + let globals; + let sandbox; + + beforeEach(() => { + sandbox = sinon.createSandbox(); + globals = new GlobalOverrider(); + globals.set({ AWSendToParent: sandbox.stub() }); + }); afterEach(() => { + sandbox.restore(); + globals.restore(); if (wrapper) { wrapper.unmount(); }