Backed out changeset 646fc6fe1859 (bug 1961955) for causing bc failures on browser_all_files_referenced.js. CLOSED TREE

This commit is contained in:
Iulian Moraru
2025-04-30 04:33:43 +03:00
parent b32b545e8a
commit 6951b54b38
7 changed files with 187 additions and 3 deletions

View File

@@ -871,6 +871,9 @@ pref("browser.shopping.experience2023.showKeepSidebarClosedMessage", true);
// the custom shopping sidebar.
pref("browser.shopping.experience2023.integratedSidebar", false);
// Adds the Review Checker tool to the sidebar if the integratedSidebar pref is enabled.
pref("sidebar.newTool.migration.reviewchecker", '{"visibilityPref": "browser.shopping.experience2023.integratedSidebar"}');
// If true, users have already seen a card in the Review Checker sidebar panel
// notifying users of the feature's new location and asking if they want to
// move the sidebar to the left or right side. Else if false, users are yet to

View File

@@ -8,6 +8,9 @@
* and provides APIs for sidebar extensions, etc.
*/
var { ShoppingUtils } = ChromeUtils.importESModule(
"resource:///modules/ShoppingUtils.sys.mjs"
);
const { DeferredTask } = ChromeUtils.importESModule(
"resource://gre/modules/DeferredTask.sys.mjs"
);
@@ -17,6 +20,7 @@ const toolsNameMap = {
viewTabsSidebar: "syncedtabs",
viewHistorySidebar: "history",
viewBookmarksSidebar: "bookmarks",
viewReviewCheckerSidebar: "reviewchecker",
viewCPMSidebar: "passwords",
};
const EXPAND_ON_HOVER_DEBOUNCE_RATE_MS = 200;
@@ -167,6 +171,24 @@ var SidebarController = {
}
);
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
this.registerPrefSidebar(
"browser.shopping.experience2023.integratedSidebar",
"viewReviewCheckerSidebar",
{
elementId: "sidebar-switcher-review-checker",
url: "chrome://browser/content/shopping/review-checker.xhtml",
menuId: "menu_reviewCheckerSidebar",
menuL10nId: "menu-view-review-checker",
revampL10nId: "sidebar-menu-review-checker-label",
iconUrl: "chrome://browser/content/shopping/assets/shopping.svg",
gleanEvent: Glean.shopping.sidebarToggle,
gleanClickEvent: Glean.sidebar.shoppingReviewCheckerIconClick,
recordSidebarVersion: true,
}
);
}
this.registerPrefSidebar(
"browser.contextual-password-manager.enabled",
"viewCPMSidebar",

View File

@@ -243,6 +243,26 @@ sidebar:
addon_id:
type: string
description: The extension's ID.
shopping_review_checker_icon_click:
type: event
description: >
The Review Checker icon was clicked.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1951175
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1951175
data_sensitivity:
- interaction
expires: 147
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
extra_keys:
sidebar_open:
type: boolean
description: Whether the sidebar is expanded or collapsed.
keyboard_shortcut:
type: event
description: >
@@ -288,6 +308,30 @@ history:
version:
type: string
description: The active version of sidebar (either "old" or "new").
shopping:
sidebar_toggle:
type: event
description: >
The Review Checker sidebar panel was loaded or unloaded.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1941047
data_reviews:
- https://phabricator.services.mozilla.com/D235052
data_sensitivity:
- interaction
expires: 147
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
extra_keys:
opened:
type: boolean
description: New/current state of sidebar is open.
version:
type: string
description: The active version of sidebar (either "old" or "new").
synced_tabs:
sidebar_toggle:
type: event
@@ -477,6 +521,26 @@ sidebar.customize:
checked:
type: boolean
description: Whether the box was checked.
shopping_review_checker_enabled:
type: event
description: >
User clicked on the checkbox corresponding to Review Checker on sidebar customization settings.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1938428
data_reviews:
- https://phabricator.services.mozilla.com/D235053
data_sensitivity:
- interaction
expires: 147
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
extra_keys:
checked:
type: boolean
description: Whether the box was checked.
extensions_clicked:
type: event
description: >

View File

@@ -12,6 +12,7 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const l10nMap = new Map([
["viewGenaiChatSidebar", "sidebar-menu-genai-chat-label"],
["viewReviewCheckerSidebar", "sidebar-menu-review-checker-label"],
["viewHistorySidebar", "sidebar-menu-history-label"],
["viewTabsSidebar", "sidebar-menu-synced-tabs-label"],
["viewBookmarksSidebar", "sidebar-menu-bookmarks-label"],
@@ -147,6 +148,11 @@ export class SidebarCustomize extends SidebarPage {
checked: e.target.checked,
});
break;
case "viewReviewCheckerSidebar":
Glean.sidebarCustomize.shoppingReviewCheckerEnabled.record({
checked: e.target.checked,
});
break;
case "viewCPMSidebar":
Glean.contextualManager.passwordsEnabled.record({
checked: e.target.checked,

View File

@@ -232,6 +232,18 @@ add_task(async function test_extension_sidebar_toggle() {
Assert.equal(events?.length, 2, "Two events were reported.");
});
add_task(async function test_review_checker_sidebar_toggle() {
const gleanEvent = Glean.shopping.sidebarToggle;
await testSidebarToggle("viewReviewCheckerSidebar", gleanEvent);
for (const { extra } of gleanEvent.testGetValue()) {
Assert.equal(
extra.version,
getExpectedVersionString(),
"Event has the correct sidebar version."
);
}
});
add_task(async function test_contextual_manager_toggle() {
await SpecialPowers.pushPrefEnv({
set: [["browser.contextual-password-manager.enabled", true]],
@@ -353,6 +365,18 @@ add_task(async function test_customize_bookmarks_enabled() {
);
});
add_task(async function test_customize_review_checker_enabled() {
await SpecialPowers.pushPrefEnv({
set: [["browser.shopping.experience2023.integratedSidebar", true]],
});
await testCustomizeToggle(
"viewReviewCheckerSidebar",
Glean.sidebarCustomize.shoppingReviewCheckerEnabled
);
await SpecialPowers.popPrefEnv();
await SidebarController.waitUntilStable();
});
add_task(async function test_customize_extensions_clicked() {
info("Load an extension.");
const extension = ExtensionTestUtils.loadExtension({ ...extData });
@@ -560,6 +584,7 @@ async function testIconClick(expanded) {
await SpecialPowers.pushPrefEnv({
set: [
["browser.ml.chat.enabled", true],
["browser.shopping.experience2023.integratedSidebar", true],
[VERTICAL_TABS_PREF, true],
],
});
@@ -567,6 +592,7 @@ async function testIconClick(expanded) {
const { sidebarMain } = SidebarController;
const gleanEvents = new Map([
["viewReviewCheckerSidebar", Glean.sidebar.shoppingReviewCheckerIconClick],
["viewGenaiChatSidebar", Glean.sidebar.chatbotIconClick],
["viewTabsSidebar", Glean.sidebar.syncedTabsIconClick],
["viewHistorySidebar", Glean.sidebar.historyIconClick],
@@ -653,6 +679,43 @@ async function testIconClick(expanded) {
Services.fog.testResetFOG();
}
async function testIconClickReviewChecker(expanded) {
const { sidebarMain } = SidebarController;
await SidebarController.initializeUIState({
launcherVisible: true,
launcherExpanded: expanded,
command: "",
});
Assert.equal(
SidebarController.sidebarMain.expanded,
expanded,
`The launcher is ${expanded ? "expanded" : "collapsed"}`
);
Assert.ok(!SidebarController._state.panelOpen, "No panel is open");
let reviewCheckerButton = sidebarMain.shadowRoot.querySelector(
"moz-button[view='viewReviewCheckerSidebar']"
);
EventUtils.synthesizeMouseAtCenter(reviewCheckerButton, {});
let event = Glean.sidebar.shoppingReviewCheckerIconClick.testGetValue();
Assert.equal(event?.length, 1, "One event was reported.");
Assert.deepEqual(
event?.[0].extra,
{ sidebar_open: `${expanded}` },
`Event indicates the sidebar was ${expanded ? "expanded" : "collapsed"}.`
);
await SpecialPowers.popPrefEnv();
await SidebarController.initializeUIState({
launcherExpanded: false,
launcherVisible: true,
command: "",
});
Services.fog.testResetFOG();
}
add_task(async function test_icon_click_collapsed_sidebar() {
await testIconClick(false);
});
@@ -660,3 +723,21 @@ add_task(async function test_icon_click_collapsed_sidebar() {
add_task(async function test_icon_click_expanded_sidebar() {
await testIconClick(true);
});
add_task(async function test_review_checker_icon_click_collapsed_sidebar() {
await SpecialPowers.pushPrefEnv({
set: [["browser.shopping.experience2023.integratedSidebar", true]],
});
await testIconClickReviewChecker(false);
await SpecialPowers.popPrefEnv();
await SidebarController.waitUntilStable();
});
add_task(async function test_review_checker_icon_click_expanded_sidebar() {
await SpecialPowers.pushPrefEnv({
set: [["browser.shopping.experience2023.integratedSidebar", true]],
});
await testIconClickReviewChecker(true);
await SpecialPowers.popPrefEnv();
await SidebarController.waitUntilStable();
});

View File

@@ -7,8 +7,8 @@ add_setup(async () => {
[VERTICAL_TABS_PREF, true],
[SIDEBAR_VISIBILITY_PREF, "always-show"],
["browser.ml.chat.enabled", true],
["browser.contextual-password-manager.enabled", true],
["sidebar.main.tools", "aichat,passwords,syncedtabs,history"],
["browser.shopping.experience2023.integratedSidebar", true],
["sidebar.main.tools", "aichat,reviewchecker,syncedtabs,history"],
],
});
});
@@ -41,7 +41,10 @@ add_task(async function test_tools_overflow() {
await SpecialPowers.pushPrefEnv({
set: [
["sidebar.main.tools", "aichat,passwords,syncedtabs,history,bookmarks"],
[
"sidebar.main.tools",
"aichat,reviewchecker,syncedtabs,history,bookmarks",
],
],
});
await sidebar.updateComplete;

View File

@@ -5,6 +5,9 @@
menu-view-genai-chat =
.label = AI Chatbot
menu-view-review-checker =
.label = Review Checker
menu-view-contextual-password-manager =
.label = Passwords
@@ -121,6 +124,8 @@ sidebar-menu-bookmarks-label =
.label = Bookmarks
sidebar-menu-customize-label =
.label = Customize sidebar
sidebar-menu-review-checker-label =
.label = Review Checker
sidebar-menu-contextual-password-manager-label =
.label = Passwords