tor-browser

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

commit 9580a4e11372acab390407faa42d3d6e498f8873
parent 21de203cc48e5a6bf6b65370928138f5c3f1a799
Author: Mike Conley <mconley@mozilla.com>
Date:   Thu, 18 Dec 2025 17:24:37 +0000

Bug 1999334 - Part 1: Get rid of search handoff preference, and non-handoff support in newtab. r=home-newtab-reviewers,nbarrett

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

Diffstat:
Mbrowser/components/newtab/metrics.yaml | 24------------------------
Mbrowser/extensions/newtab/content-src/components/Base/Base.jsx | 2--
Mbrowser/extensions/newtab/content-src/components/Search/Search.jsx | 112++++++++++++++++++++-----------------------------------------------------------
Mbrowser/extensions/newtab/content-src/components/Search/_Search.scss | 150+------------------------------------------------------------------------------
Mbrowser/extensions/newtab/css/activity-stream.css | 112++-----------------------------------------------------------------------------
Mbrowser/extensions/newtab/data/content/activity-stream.bundle.js | 93+++++--------------------------------------------------------------------------
Mbrowser/extensions/newtab/lib/PrefsFeed.sys.mjs | 10----------
Mbrowser/extensions/newtab/lib/TelemetryFeed.sys.mjs | 12------------
Mbrowser/extensions/newtab/test/browser/browser.toml | 2--
Mbrowser/extensions/newtab/test/browser/browser_as_render.js | 24------------------------
Dbrowser/extensions/newtab/test/browser/browser_newtab_glean.js | 28----------------------------
Mbrowser/extensions/newtab/test/unit/content-src/components/Search.test.jsx | 65+++++------------------------------------------------------------
12 files changed, 41 insertions(+), 593 deletions(-)

diff --git a/browser/components/newtab/metrics.yaml b/browser/components/newtab/metrics.yaml @@ -1243,30 +1243,6 @@ newtab.search: send_in_pings: - newtab -newtab.handoff_preference: - enabled: - lifetime: application - type: boolean - description: > - Records whether the - browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar preference is - enabled or disabled - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1864496 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1892148 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1940643 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1978995 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1864496 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1892148 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1940643 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1978995 - data_sensitivity: - - interaction - expires: 151 - notification_emails: - - fx-search-telemetry@mozilla.com - topsites: enabled: lifetime: application diff --git a/browser/extensions/newtab/content-src/components/Base/Base.jsx b/browser/extensions/newtab/content-src/components/Base/Base.jsx @@ -678,7 +678,6 @@ export class BaseContent extends React.PureComponent { !prefs["feeds.topsites"] && !pocketEnabled && filteredSections.filter(section => section.enabled).length === 0; - const searchHandoffEnabled = prefs["improvesearch.handoffToAwesomebar"]; const enabledSections = { topSitesEnabled: prefs["feeds.topsites"], pocketEnabled: prefs["feeds.section.topstories"], @@ -846,7 +845,6 @@ export class BaseContent extends React.PureComponent { showLogo={ noSectionsEnabled || prefs["logowordmark.alwaysVisible"] } - handoffEnabled={searchHandoffEnabled} {...props.Search} /> </ErrorBoundary> diff --git a/browser/extensions/newtab/content-src/components/Search/Search.jsx b/browser/extensions/newtab/content-src/components/Search/Search.jsx @@ -2,22 +2,19 @@ * 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/. */ -/* globals ContentSearchUIController, ContentSearchHandoffUIController */ +/* globals ContentSearchHandoffUIController */ import { actionCreators as ac, actionTypes as at } from "common/Actions.mjs"; import { connect } from "react-redux"; -import { IS_NEWTAB } from "content-src/lib/constants"; import { Logo } from "content-src/components/Logo/Logo"; import React from "react"; export class _Search extends React.PureComponent { constructor(props) { super(props); - this.onSearchClick = this.onSearchClick.bind(this); this.onSearchHandoffClick = this.onSearchHandoffClick.bind(this); this.onSearchHandoffPaste = this.onSearchHandoffPaste.bind(this); this.onSearchHandoffDrop = this.onSearchHandoffDrop.bind(this); - this.onInputMount = this.onInputMount.bind(this); this.onInputMountHandoff = this.onInputMountHandoff.bind(this); this.onSearchHandoffButtonMount = this.onSearchHandoffButtonMount.bind(this); @@ -30,10 +27,6 @@ export class _Search extends React.PureComponent { } } - onSearchClick(event) { - window.gContentSearchController.search(event); - } - doSearchHandoff(text) { this.props.dispatch( ac.OnlyToMain({ type: at.HANDOFF_SEARCH_TO_AWESOMEBAR, data: { text } }) @@ -86,34 +79,6 @@ export class _Search extends React.PureComponent { } } - componentWillUnmount() { - delete window.gContentSearchController; - } - - onInputMount(input) { - if (input) { - // The "healthReportKey" and needs to be "newtab" or "abouthome" so that - // BrowserUsageTelemetry.sys.mjs knows to handle events with this name, and - // can add the appropriate telemetry probes for search. Without the correct - // name, certain tests like browser_UsageTelemetry_content.js will fail - // (See github ticket #2348 for more details) - const healthReportKey = IS_NEWTAB ? "newtab" : "abouthome"; - - // gContentSearchController needs to exist as a global so that tests for - // the existing about:home can find it; and so it allows these tests to pass. - // In the future, when activity stream is default about:home, this can be renamed - window.gContentSearchController = new ContentSearchUIController( - input, - input.parentNode, - healthReportKey - ); - addEventListener("ContentSearchClient", this); - } else { - window.gContentSearchController = null; - removeEventListener("ContentSearchClient", this); - } - } - onInputMountHandoff(input) { if (input) { // The handoff UI controller helps us set the search icon and reacts to @@ -142,55 +107,34 @@ export class _Search extends React.PureComponent { .join(" "); return ( - <> - <div className={wrapperClassName}> - {this.props.showLogo && <Logo />} - {!this.props.handoffEnabled && ( - <div className="search-inner-wrapper no-handoff"> - <input - id="newtab-search-text" - data-l10n-id="newtab-search-box-input" - maxLength="256" - ref={this.onInputMount} - type="search" - /> - <button - id="searchSubmit" - className="search-button" - data-l10n-id="newtab-search-box-search-button" - onClick={this.onSearchClick} - /> - </div> - )} - {this.props.handoffEnabled && ( - <div className="search-inner-wrapper"> - <button - className="search-handoff-button" - ref={this.onSearchHandoffButtonMount} - onClick={this.onSearchHandoffClick} - tabIndex="-1" - > - <div className="fake-textbox" /> - <input - type="search" - className="fake-editable" - tabIndex="-1" - aria-hidden="true" - onDrop={this.onSearchHandoffDrop} - onPaste={this.onSearchHandoffPaste} - ref={this.onInputMountHandoff} - /> - <div - className="fake-caret" - ref={el => { - this.fakeCaret = el; - }} - /> - </button> - </div> - )} + <div className={wrapperClassName}> + {this.props.showLogo && <Logo />} + <div className="search-inner-wrapper"> + <button + className="search-handoff-button" + ref={this.onSearchHandoffButtonMount} + onClick={this.onSearchHandoffClick} + tabIndex="-1" + > + <div className="fake-textbox" /> + <input + type="search" + className="fake-editable" + tabIndex="-1" + aria-hidden="true" + onDrop={this.onSearchHandoffDrop} + onPaste={this.onSearchHandoffPaste} + ref={this.onInputMountHandoff} + /> + <div + className="fake-caret" + ref={el => { + this.fakeCaret = el; + }} + /> + </button> </div> - </> + </div> ); } } diff --git a/browser/extensions/newtab/content-src/components/Search/_Search.scss b/browser/extensions/newtab/content-src/components/Search/_Search.scss @@ -54,15 +54,6 @@ $glyph-forward: url('chrome://browser/skin/forward.svg'); @media (min-width: $break-point-widest) { width: 720px; } - - // Bug 1966715: Offset padding of the submit button so the reset button is visible - &.no-handoff { - input { - // Bug 1967304 - calc ($var) - padding-inline-end: calc($search-button-width + var(--space-medium)); // stylelint-disable-line declaration-property-value-disallowed-list - } - } - } .search-inner-wrapper:has(.trending-searches-pill-wrapper) { @@ -72,17 +63,9 @@ $glyph-forward: url('chrome://browser/skin/forward.svg'); .search-handoff-button { height: 52px; } - - &.no-handoff { - #newtab-search-text, - .search-button { - height: 52px; - } - } } - .search-handoff-button, - input { + .search-handoff-button { background: var(--newtab-background-color-secondary) var(--newtab-search-icon) $search-icon-padding center no-repeat; background-size: $search-icon-size; // Bug 1967304 - $variable @@ -102,47 +85,6 @@ $glyph-forward: url('chrome://browser/skin/forward.svg'); } } - .search-inner-wrapper:active input, - input:focus { - border: 1px solid var(--newtab-primary-action-background); - outline: 0; - box-shadow: $shadow-focus; - } - - .search-button { - background: $glyph-forward no-repeat center center; - background-size: 16px 16px; - border: 0; - border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0; - -moz-context-properties: fill; - fill: var(--newtab-text-secondary-color); - height: 100%; - inset-inline-end: 0; - position: absolute; - width: $search-button-width; - - &:focus, - &:hover { - background-color: var(--newtab-element-hover-color); - cursor: pointer; - } - - &:focus { - outline: 0; - box-shadow: $shadow-focus; - border: 1px solid var(--newtab-primary-action-background); - border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0; - } - - &:active { - background-color: var(--newtab-element-hover-color); - } - - &:dir(rtl) { - transform: scaleX(-1); - } - } - &.fake-focus:not(.search.disabled) { .search-handoff-button { border: 1px solid var(--newtab-primary-action-background); @@ -394,15 +336,6 @@ $glyph-forward: url('chrome://browser/skin/forward.svg'); min-height: $search-height; } - input { - background-position-x: $search-icon-padding; - background-size: $search-icon-size; - - &:dir(rtl) { - background-position-x: right $search-icon-padding; - } - } - .search-handoff-button .fake-caret { inset-block-start: var(--space-large); } @@ -426,84 +359,3 @@ $glyph-forward: url('chrome://browser/skin/forward.svg'); } } } - -@at-root { - - // Adjust the style of the contentSearchUI-generated table - .contentSearchSuggestionTable { - border: 0; - box-shadow: $context-menu-shadow; - transform: translateY($textbox-shadow-size); - background-color: var(--newtab-background-color); - - .contentSearchHeader { - color: var(--newtab-text-secondary-color); - background-color: var(--newtab-background-color-secondary); - } - - .contentSearchHeader, - .contentSearchSettingsButton { - border-color: var(--border-color); - } - - .contentSearchSuggestionsList { - color: var(--newtab-text-primary-color); - border: 0; - } - - .contentSearchOneOffsTable { - border-block-start: solid 1px var(--border-color); - background-color: var(--newtab-background-color); - } - - .contentSearchSearchWithHeaderSearchText { - color: var(--newtab-text-primary-color); - } - - .contentSearchSuggestionRow { - &.selected { - background: var(--newtab-element-hover-color); - color: var(--newtab-text-primary-color); - - &:active { - background: var(--newtab-element-active-color); - } - - .historyIcon { - fill: var(--newtab-text-secondary-color); - } - } - } - - .contentSearchOneOffItem { - // Make the border slightly shorter by offsetting from the top and bottom - $border-offset: 18%; - - background-image: none; - border-image: linear-gradient(transparent $border-offset, var(--border-color) $border-offset, var(--border-color) 100% - $border-offset, transparent 100% - $border-offset) 1; - border-inline-end: 1px solid; - position: relative; - - &.selected { - background: var(--newtab-element-hover-color); - } - - &:active { - background: var(--newtab-element-active-color); - } - } - - .contentSearchSettingsButton { - &:hover { - background: var(--newtab-element-hover-color); - color: var(--newtab-text-primary-color); - } - } - } - - .contentSearchHeaderRow > td > img, - .contentSearchSuggestionRow > td > .historyIcon { - margin-inline-start: var(--space-small); - margin-inline-end: var(--space-large); - } -} diff --git a/browser/extensions/newtab/css/activity-stream.css b/browser/extensions/newtab/css/activity-stream.css @@ -1522,9 +1522,6 @@ main section { width: 720px; } } -.search-wrapper .search-inner-wrapper.no-handoff input { - padding-inline-end: calc(var(--size-item-xlarge) + var(--space-medium)); -} .search-wrapper .search-inner-wrapper:has(.trending-searches-pill-wrapper) { display: flex; flex-direction: column; @@ -1532,12 +1529,7 @@ main section { .search-wrapper .search-inner-wrapper:has(.trending-searches-pill-wrapper) .search-handoff-button { height: 52px; } -.search-wrapper .search-inner-wrapper:has(.trending-searches-pill-wrapper).no-handoff #newtab-search-text, -.search-wrapper .search-inner-wrapper:has(.trending-searches-pill-wrapper).no-handoff .search-button { - height: 52px; -} -.search-wrapper .search-handoff-button, -.search-wrapper input { +.search-wrapper .search-handoff-button { background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat; background-size: 24px; padding-inline-start: 52px; @@ -1551,44 +1543,9 @@ main section { -moz-context-properties: fill; fill: var(--newtab-text-secondary-color); } -.search-wrapper .search-handoff-button:dir(rtl), -.search-wrapper input:dir(rtl) { +.search-wrapper .search-handoff-button:dir(rtl) { background-position-x: right 16px; } -.search-wrapper .search-inner-wrapper:active input, -.search-wrapper input:focus { - border: 1px solid var(--newtab-primary-action-background); - outline: 0; - box-shadow: 0 0 0 2px var(--newtab-primary-action-background-dimmed); -} -.search-wrapper .search-button { - background: url("chrome://browser/skin/forward.svg") no-repeat center center; - background-size: 16px 16px; - border: 0; - border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0; - -moz-context-properties: fill; - fill: var(--newtab-text-secondary-color); - height: 100%; - inset-inline-end: 0; - position: absolute; - width: var(--size-item-xlarge); -} -.search-wrapper .search-button:focus, .search-wrapper .search-button:hover { - background-color: var(--newtab-element-hover-color); - cursor: pointer; -} -.search-wrapper .search-button:focus { - outline: 0; - box-shadow: 0 0 0 2px var(--newtab-primary-action-background-dimmed); - border: 1px solid var(--newtab-primary-action-background); - border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0; -} -.search-wrapper .search-button:active { - background-color: var(--newtab-element-hover-color); -} -.search-wrapper .search-button:dir(rtl) { - transform: scaleX(-1); -} .search-wrapper.fake-focus:not(.search.disabled) .search-handoff-button { border: 1px solid var(--newtab-primary-action-background); box-shadow: 0 0 0 2px var(--newtab-primary-action-background-dimmed); @@ -1798,13 +1755,6 @@ main section { .activity-stream .fixed-search .search-wrapper .search-inner-wrapper { min-height: 52px; } - .activity-stream .fixed-search .search-wrapper input { - background-position-x: 16px; - background-size: 24px; - } - .activity-stream .fixed-search .search-wrapper input:dir(rtl) { - background-position-x: right 16px; - } .activity-stream .fixed-search .search-wrapper .search-handoff-button .fake-caret { inset-block-start: var(--space-large); } @@ -1822,64 +1772,6 @@ main section { inset-block-start: var(--space-small); } } -.contentSearchSuggestionTable { - border: 0; - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.2); - transform: translateY(4px); - background-color: var(--newtab-background-color); -} -.contentSearchSuggestionTable .contentSearchHeader { - color: var(--newtab-text-secondary-color); - background-color: var(--newtab-background-color-secondary); -} -.contentSearchSuggestionTable .contentSearchHeader, -.contentSearchSuggestionTable .contentSearchSettingsButton { - border-color: var(--border-color); -} -.contentSearchSuggestionTable .contentSearchSuggestionsList { - color: var(--newtab-text-primary-color); - border: 0; -} -.contentSearchSuggestionTable .contentSearchOneOffsTable { - border-block-start: solid 1px var(--border-color); - background-color: var(--newtab-background-color); -} -.contentSearchSuggestionTable .contentSearchSearchWithHeaderSearchText { - color: var(--newtab-text-primary-color); -} -.contentSearchSuggestionTable .contentSearchSuggestionRow.selected { - background: var(--newtab-element-hover-color); - color: var(--newtab-text-primary-color); -} -.contentSearchSuggestionTable .contentSearchSuggestionRow.selected:active { - background: var(--newtab-element-active-color); -} -.contentSearchSuggestionTable .contentSearchSuggestionRow.selected .historyIcon { - fill: var(--newtab-text-secondary-color); -} -.contentSearchSuggestionTable .contentSearchOneOffItem { - background-image: none; - border-image: linear-gradient(transparent 18%, var(--border-color) 18%, var(--border-color) 82%, transparent 82%) 1; - border-inline-end: 1px solid; - position: relative; -} -.contentSearchSuggestionTable .contentSearchOneOffItem.selected { - background: var(--newtab-element-hover-color); -} -.contentSearchSuggestionTable .contentSearchOneOffItem:active { - background: var(--newtab-element-active-color); -} -.contentSearchSuggestionTable .contentSearchSettingsButton:hover { - background: var(--newtab-element-hover-color); - color: var(--newtab-text-primary-color); -} - -.contentSearchHeaderRow > td > img, -.contentSearchSuggestionRow > td > .historyIcon { - margin-inline-start: var(--space-small); - margin-inline-end: var(--space-large); -} - /* stylelint-disable max-nesting-depth */ .context-menu { background: var(--newtab-background-color-secondary); diff --git a/browser/extensions/newtab/data/content/activity-stream.bundle.js b/browser/extensions/newtab/data/content/activity-stream.bundle.js @@ -14810,46 +14810,6 @@ class _CustomizeMenu extends (external_React_default()).PureComponent { const CustomizeMenu = (0,external_ReactRedux_namespaceObject.connect)(state => ({ DiscoveryStream: state.DiscoveryStream }))(_CustomizeMenu); -;// CONCATENATED MODULE: ./content-src/lib/constants.mjs -/* 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 IS_NEWTAB = - globalThis.document && globalThis.document.documentURI === "about:newtab"; -const NEWTAB_DARK_THEME = { - ntp_background: { - r: 42, - g: 42, - b: 46, - a: 1, - }, - ntp_card_background: { - r: 66, - g: 65, - b: 77, - a: 1, - }, - ntp_text: { - r: 249, - g: 249, - b: 250, - a: 1, - }, - sidebar: { - r: 56, - g: 56, - b: 61, - a: 1, - }, - sidebar_text: { - r: 249, - g: 249, - b: 250, - a: 1, - }, -}; - ;// CONCATENATED MODULE: ./content-src/components/Logo/Logo.jsx /* 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, @@ -14875,8 +14835,7 @@ function Logo() { * 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/. */ -/* globals ContentSearchUIController, ContentSearchHandoffUIController */ - +/* globals ContentSearchHandoffUIController */ @@ -14885,11 +14844,9 @@ function Logo() { class _Search extends (external_React_default()).PureComponent { constructor(props) { super(props); - this.onSearchClick = this.onSearchClick.bind(this); this.onSearchHandoffClick = this.onSearchHandoffClick.bind(this); this.onSearchHandoffPaste = this.onSearchHandoffPaste.bind(this); this.onSearchHandoffDrop = this.onSearchHandoffDrop.bind(this); - this.onInputMount = this.onInputMount.bind(this); this.onInputMountHandoff = this.onInputMountHandoff.bind(this); this.onSearchHandoffButtonMount = this.onSearchHandoffButtonMount.bind(this); } @@ -14901,9 +14858,6 @@ class _Search extends (external_React_default()).PureComponent { })); } } - onSearchClick(event) { - window.gContentSearchController.search(event); - } doSearchHandoff(text) { this.props.dispatch(actionCreators.OnlyToMain({ type: actionTypes.HANDOFF_SEARCH_TO_AWESOMEBAR, @@ -14956,28 +14910,6 @@ class _Search extends (external_React_default()).PureComponent { caret.style.setProperty("--caret-blink-time", caretBlinkTime > 0 ? `${caretBlinkTime * 2}ms` : `${1134}ms`); } } - componentWillUnmount() { - delete window.gContentSearchController; - } - onInputMount(input) { - if (input) { - // The "healthReportKey" and needs to be "newtab" or "abouthome" so that - // BrowserUsageTelemetry.sys.mjs knows to handle events with this name, and - // can add the appropriate telemetry probes for search. Without the correct - // name, certain tests like browser_UsageTelemetry_content.js will fail - // (See github ticket #2348 for more details) - const healthReportKey = IS_NEWTAB ? "newtab" : "abouthome"; - - // gContentSearchController needs to exist as a global so that tests for - // the existing about:home can find it; and so it allows these tests to pass. - // In the future, when activity stream is default about:home, this can be renamed - window.gContentSearchController = new ContentSearchUIController(input, input.parentNode, healthReportKey); - addEventListener("ContentSearchClient", this); - } else { - window.gContentSearchController = null; - removeEventListener("ContentSearchClient", this); - } - } onInputMountHandoff(input) { if (input) { // The handoff UI controller helps us set the search icon and reacts to @@ -14997,22 +14929,9 @@ class _Search extends (external_React_default()).PureComponent { */ render() { const wrapperClassName = ["search-wrapper", this.props.disable && "search-disabled", this.props.fakeFocus && "fake-focus"].filter(v => v).join(" "); - return /*#__PURE__*/external_React_default().createElement((external_React_default()).Fragment, null, /*#__PURE__*/external_React_default().createElement("div", { + return /*#__PURE__*/external_React_default().createElement("div", { className: wrapperClassName - }, this.props.showLogo && /*#__PURE__*/external_React_default().createElement(Logo, null), !this.props.handoffEnabled && /*#__PURE__*/external_React_default().createElement("div", { - className: "search-inner-wrapper no-handoff" - }, /*#__PURE__*/external_React_default().createElement("input", { - id: "newtab-search-text", - "data-l10n-id": "newtab-search-box-input", - maxLength: "256", - ref: this.onInputMount, - type: "search" - }), /*#__PURE__*/external_React_default().createElement("button", { - id: "searchSubmit", - className: "search-button", - "data-l10n-id": "newtab-search-box-search-button", - onClick: this.onSearchClick - })), this.props.handoffEnabled && /*#__PURE__*/external_React_default().createElement("div", { + }, this.props.showLogo && /*#__PURE__*/external_React_default().createElement(Logo, null), /*#__PURE__*/external_React_default().createElement("div", { className: "search-inner-wrapper" }, /*#__PURE__*/external_React_default().createElement("button", { className: "search-handoff-button", @@ -15034,7 +14953,7 @@ class _Search extends (external_React_default()).PureComponent { ref: el => { this.fakeCaret = el; } - }))))); + })))); } } const Search_Search = (0,external_ReactRedux_namespaceObject.connect)(state => ({ @@ -16168,7 +16087,6 @@ class BaseContent extends (external_React_default()).PureComponent { let filteredSections = props.Sections.filter(section => section.id !== "topstories"); const pocketEnabled = prefs["feeds.section.topstories"] && prefs["feeds.system.topstories"]; const noSectionsEnabled = !prefs["feeds.topsites"] && !pocketEnabled && filteredSections.filter(section => section.enabled).length === 0; - const searchHandoffEnabled = prefs["improvesearch.handoffToAwesomebar"]; const enabledSections = { topSitesEnabled: prefs["feeds.topsites"], pocketEnabled: prefs["feeds.section.topstories"], @@ -16254,8 +16172,7 @@ class BaseContent extends (external_React_default()).PureComponent { }, prefs.showSearch && /*#__PURE__*/external_React_default().createElement("div", { className: "non-collapsible-section" }, /*#__PURE__*/external_React_default().createElement(ErrorBoundary, null, /*#__PURE__*/external_React_default().createElement(Search_Search, Base_extends({ - showLogo: noSectionsEnabled || prefs["logowordmark.alwaysVisible"], - handoffEnabled: searchHandoffEnabled + showLogo: noSectionsEnabled || prefs["logowordmark.alwaysVisible"] }, props.Search)))), !prefs.showSearch && !noSectionsEnabled && /*#__PURE__*/external_React_default().createElement(Logo, null), /*#__PURE__*/external_React_default().createElement("div", { className: `body-wrapper${initialized ? " on" : ""}` }, isDiscoveryStream ? /*#__PURE__*/external_React_default().createElement(ErrorBoundary, { diff --git a/browser/extensions/newtab/lib/PrefsFeed.sys.mjs b/browser/extensions/newtab/lib/PrefsFeed.sys.mjs @@ -321,16 +321,6 @@ export class PrefsFeed { "browser.topsites.useRemoteSetting" ); - // Read the pref for search hand-off from firefox.js and store it - // in our internal list of prefs to watch - let handoffToAwesomebarPrefValue = Services.prefs.getBoolPref( - "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" - ); - values["improvesearch.handoffToAwesomebar"] = handoffToAwesomebarPrefValue; - this._prefMap.set("improvesearch.handoffToAwesomebar", { - value: handoffToAwesomebarPrefValue, - }); - // Add experiment values and default values values.featureConfig = lazy.NimbusFeatures.newtab.getAllVariables() || {}; values.pocketConfig = diff --git a/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs b/browser/extensions/newtab/lib/TelemetryFeed.sys.mjs @@ -48,15 +48,6 @@ ChromeUtils.defineESModuleGetters(lazy, { NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", }); -XPCOMUtils.defineLazyPreferenceGetter( - lazy, - "handoffToAwesomebarPrefValue", - "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", - false, - (preference, previousValue, new_value) => - Glean.newtabHandoffPreference.enabled.set(new_value) -); - export const PREF_IMPRESSION_ID = "impressionId"; export const TELEMETRY_PREF = "telemetry"; export const EVENTS_TELEMETRY_PREF = "telemetry.ut.events"; @@ -275,9 +266,6 @@ export class TelemetryFeed { ); } Glean.newtab.locale.set(Services.locale.appLocaleAsBCP47); - Glean.newtabHandoffPreference.enabled.set( - lazy.handoffToAwesomebarPrefValue - ); } getOrCreateImpressionId() { diff --git a/browser/extensions/newtab/test/browser/browser.toml b/browser/extensions/newtab/test/browser/browser.toml @@ -57,8 +57,6 @@ skip-if = [ "os == 'linux' && os_version == '24.04' && arch == 'x86_64' && display == 'x11' && opt && socketprocess_networking", # Bug 1846916 ] -["browser_newtab_glean.js"] - ["browser_newtab_header.js"] skip-if = [ "os == 'linux' && os_version == '24.04' && arch == 'x86_64' && display == 'x11' && opt && socketprocess_networking", # Bug 1945649 diff --git a/browser/extensions/newtab/test/browser/browser_as_render.js b/browser/extensions/newtab/test/browser/browser_as_render.js @@ -1,30 +1,6 @@ "use strict"; test_newtab({ - async before({ pushPrefs }) { - await pushPrefs([ - "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", - false, - ]); - }, - test: function test_render_search() { - let search = content.document.getElementById("newtab-search-text"); - ok(search, "Got the search box"); - isnot( - search.placeholder, - "search_web_placeholder", - "Search box is localized" - ); - }, -}); - -test_newtab({ - async before({ pushPrefs }) { - await pushPrefs([ - "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", - true, - ]); - }, test: function test_render_search_handoff() { let search = content.document.querySelector(".search-handoff-button"); ok(search, "Got the search handoff button"); diff --git a/browser/extensions/newtab/test/browser/browser_newtab_glean.js b/browser/extensions/newtab/test/browser/browser_newtab_glean.js @@ -1,28 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -requestLongerTimeout(10); - -const TELEMETRY_PREF = - "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar"; - -add_task(async function test_newtab_handoff_performance_telemetry() { - await SpecialPowers.pushPrefEnv({ - set: [[TELEMETRY_PREF, true]], - }); - - Services.fog.testResetFOG(); - let TelemetryFeed = - AboutNewTab.activityStream.store.feeds.get("feeds.telemetry"); - TelemetryFeed.init(); // INIT action doesn't happen by default. - - Assert.equal(true, Glean.newtabHandoffPreference.enabled.testGetValue()); - - await SpecialPowers.pushPrefEnv({ - set: [[TELEMETRY_PREF, false]], - }); - Assert.equal(false, Glean.newtabHandoffPreference.enabled.testGetValue()); - await SpecialPowers.popPrefEnv(); -}); diff --git a/browser/extensions/newtab/test/unit/content-src/components/Search.test.jsx b/browser/extensions/newtab/test/unit/content-src/components/Search.test.jsx @@ -31,55 +31,6 @@ describe("<Search>", () => { assert.equal(wrapper.find("form").length, 0); }); - it("should listen for ContentSearchClient on render", () => { - const spy = globals.set("addEventListener", sandbox.spy()); - - const wrapper = mount(<Search {...DEFAULT_PROPS} />); - - assert.calledOnce(spy.withArgs("ContentSearchClient", wrapper.instance())); - }); - it("should stop listening for ContentSearchClient on unmount", () => { - const spy = globals.set("removeEventListener", sandbox.spy()); - const wrapper = mount(<Search {...DEFAULT_PROPS} />); - // cache the instance as we can't call this method after unmount is called - const instance = wrapper.instance(); - - wrapper.unmount(); - - assert.calledOnce(spy.withArgs("ContentSearchClient", instance)); - }); - it("should add gContentSearchController as a global", () => { - // current about:home tests need gContentSearchController to exist as a global - // so let's test it here too to ensure we don't break this behaviour - mount(<Search {...DEFAULT_PROPS} />); - assert.property(window, "gContentSearchController"); - assert.ok(window.gContentSearchController); - }); - it("should pass along search when clicking the search button", () => { - const wrapper = mount(<Search {...DEFAULT_PROPS} />); - - wrapper.find(".search-button").simulate("click"); - - const { search } = window.gContentSearchController; - assert.calledOnce(search); - assert.propertyVal(search.firstCall.args[0], "type", "click"); - }); - it("should send a UserEvent action", () => { - global.ContentSearchUIController.prototype.search = () => { - dispatchEvent( - new CustomEvent("ContentSearchClient", { detail: { type: "Search" } }) - ); - }; - const dispatch = sinon.spy(); - const wrapper = mount(<Search {...DEFAULT_PROPS} dispatch={dispatch} />); - - wrapper.find(".search-button").simulate("click"); - - assert.calledOnce(dispatch); - const [action] = dispatch.firstCall.args; - assert.isUserEventAction(action); - assert.propertyVal(action.data, "event", "SEARCH"); - }); it("should show our logo when the prop exists.", () => { const showLogoProps = Object.assign({}, DEFAULT_PROPS, { showLogo: true }); const wrapper = shallow(<Search {...showLogoProps} />); @@ -94,17 +45,15 @@ describe("<Search>", () => { }); describe("Search Hand-off", () => { - it("should render a Search element when hand-off is enabled", () => { - const wrapper = shallow( - <Search {...DEFAULT_PROPS} handoffEnabled={true} /> - ); + it("should render a Search hand-off element", () => { + const wrapper = shallow(<Search {...DEFAULT_PROPS} />); assert.ok(wrapper.exists()); assert.equal(wrapper.find(".search-handoff-button").length, 1); }); it("should hand-off search when button is clicked", () => { const dispatch = sinon.spy(); const wrapper = shallow( - <Search {...DEFAULT_PROPS} handoffEnabled={true} dispatch={dispatch} /> + <Search {...DEFAULT_PROPS} dispatch={dispatch} /> ); wrapper .find(".search-handoff-button") @@ -126,9 +75,7 @@ describe("<Search>", () => { }); it("should hand-off search on paste", () => { const dispatch = sinon.spy(); - const wrapper = mount( - <Search {...DEFAULT_PROPS} handoffEnabled={true} dispatch={dispatch} /> - ); + const wrapper = mount(<Search {...DEFAULT_PROPS} dispatch={dispatch} />); wrapper.instance()._searchHandoffButton = { contains: () => true }; wrapper.instance().onSearchHandoffPaste({ clipboardData: { @@ -153,9 +100,7 @@ describe("<Search>", () => { }); it("should properly handle drop events", () => { const dispatch = sinon.spy(); - const wrapper = mount( - <Search {...DEFAULT_PROPS} handoffEnabled={true} dispatch={dispatch} /> - ); + const wrapper = mount(<Search {...DEFAULT_PROPS} dispatch={dispatch} />); const preventDefault = sinon.spy(); wrapper.find(".fake-editable").simulate("drop", { dataTransfer: { getData: () => "dropped text" },