Backed out changeset 8e5aa4b063cc (bug 1901261) for causing py3 failures on make-schemas.py. CLOSED TREE
This commit is contained in:
@@ -4691,13 +4691,8 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fxms-bmb-button is a Firefox Messaging System Bookmarks bar button
|
||||
let removable = !toolbarItem?.classList?.contains("fxms-bmb-button");
|
||||
let movable =
|
||||
toolbarItem?.id &&
|
||||
removable &&
|
||||
!toolbarItem?.classList?.contains("fxms-bmb-button") &&
|
||||
CustomizableUI.isWidgetRemovable(toolbarItem);
|
||||
toolbarItem?.id && CustomizableUI.isWidgetRemovable(toolbarItem);
|
||||
if (movable) {
|
||||
if (CustomizableUI.isSpecialWidget(toolbarItem.id)) {
|
||||
moveToPanel.setAttribute("disabled", true);
|
||||
@@ -4706,10 +4701,8 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
|
||||
}
|
||||
removeFromToolbar.removeAttribute("disabled");
|
||||
} else {
|
||||
if (removable) {
|
||||
removeFromToolbar.setAttribute("disabled", true);
|
||||
}
|
||||
moveToPanel.setAttribute("disabled", true);
|
||||
removeFromToolbar.setAttribute("disabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,10 +94,6 @@ async function getMessageValidators(skipValidation) {
|
||||
);
|
||||
|
||||
const messageValidators = {
|
||||
bookmarks_bar_button: await getValidator(
|
||||
"./content-src/templates/OnboardingMessage/BookmarksBarButton.schema.json",
|
||||
{ common: true }
|
||||
),
|
||||
cfr_doorhanger: await getValidator(
|
||||
"./content-src/templates/CFR/templates/ExtensionDoorhanger.schema.json",
|
||||
{ common: true }
|
||||
|
||||
@@ -1131,7 +1131,6 @@
|
||||
"type": "string",
|
||||
"description": "Which messaging template this message is using.",
|
||||
"enum": [
|
||||
"bookmarks_bar_button",
|
||||
"cfr_urlbar_chiclet",
|
||||
"cfr_doorhanger",
|
||||
"milestone_message",
|
||||
|
||||
@@ -63,9 +63,6 @@ SCHEMAS = [
|
||||
schema_id="chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json",
|
||||
schema_path=Path("MessagingExperiment.schema.json"),
|
||||
message_types={
|
||||
"BookmarksBarButton": (
|
||||
SCHEMA_DIR / "OnboardingMessage" / "BookmarksBarButton.schema.json"
|
||||
),
|
||||
"CFRUrlbarChiclet": (
|
||||
SCHEMA_DIR / "CFR" / "templates" / "CFRUrlbarChiclet.schema.json"
|
||||
),
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
||||
"$id": "file:///BookmarksBarButton.schema.json",
|
||||
"title": "BookmarksBarButton",
|
||||
"description": "A template with a label and a special message action (currently only supports OPEN_URL)",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "file:///FxMSCommon.schema.json#/$defs/Message"
|
||||
}
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "string",
|
||||
"const": "bookmarks_bar_button"
|
||||
},
|
||||
"content": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Action dispatched by the button."
|
||||
},
|
||||
"data": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["type"],
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
"required": ["targeting"]
|
||||
}
|
||||
@@ -35,7 +35,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ASRouterTriggerListeners:
|
||||
"resource:///modules/asrouter/ASRouterTriggerListeners.sys.mjs",
|
||||
AttributionCode: "resource:///modules/AttributionCode.sys.mjs",
|
||||
BookmarksBarButton: "resource:///modules/asrouter/BookmarksBarButton.sys.mjs",
|
||||
Downloader: "resource://services-settings/Attachments.sys.mjs",
|
||||
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
|
||||
FeatureCalloutBroker:
|
||||
@@ -1478,9 +1477,6 @@ export class _ASRouter {
|
||||
this.dispatchCFRAction
|
||||
);
|
||||
break;
|
||||
case "bookmarks_bar_button":
|
||||
lazy.BookmarksBarButton.showBookmarksBarButton(browser, message);
|
||||
break;
|
||||
}
|
||||
|
||||
return { message };
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/* 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 lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
|
||||
SpecialMessageActions:
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs",
|
||||
ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs",
|
||||
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.sys.mjs",
|
||||
});
|
||||
|
||||
export const BookmarksBarButton = {
|
||||
async showBookmarksBarButton(browser, message) {
|
||||
const { label, action } = message.content;
|
||||
let { gBrowser } = browser.ownerGlobal;
|
||||
const surfaceName = "fxms-bmb-button";
|
||||
const widgetId = message.id;
|
||||
|
||||
const fxmsBookmarksBarBtn = {
|
||||
id: widgetId,
|
||||
l10nId: label?.string_id,
|
||||
label: label?.raw,
|
||||
tooltiptext: label?.tooltiptext,
|
||||
defaultArea: lazy.CustomizableUI.AREA_BOOKMARKS,
|
||||
type: "button",
|
||||
|
||||
onCreated(aNode) {
|
||||
aNode.className = `bookmark-item chromeclass-toolbar-additional ${surfaceName}`;
|
||||
|
||||
lazy.BrowserUsageTelemetry.recordWidgetChange(
|
||||
widgetId,
|
||||
lazy.CustomizableUI.AREA_BOOKMARKS,
|
||||
"create"
|
||||
);
|
||||
lazy.ASRouter.addImpression(message);
|
||||
},
|
||||
|
||||
onCommand() {
|
||||
// Currently only supports OPEN_URL action
|
||||
if (action.type === "OPEN_URL") {
|
||||
// Click telemetry is handled in BrowserUsageTelemetry, see
|
||||
// _recordCommand()
|
||||
lazy.SpecialMessageActions.handleAction(action, gBrowser);
|
||||
}
|
||||
if (action.navigate || action.dismiss) {
|
||||
lazy.CustomizableUI.destroyWidget(widgetId);
|
||||
}
|
||||
},
|
||||
|
||||
onWidgetRemoved() {
|
||||
lazy.CustomizableUI.destroyWidget(widgetId);
|
||||
},
|
||||
|
||||
onDestroyed() {
|
||||
lazy.CustomizableUI.removeListener(this);
|
||||
lazy.BrowserUsageTelemetry.recordWidgetChange(
|
||||
widgetId,
|
||||
null,
|
||||
"destroy"
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
lazy.CustomizableUI.addListener(fxmsBookmarksBarBtn);
|
||||
lazy.CustomizableUI.createWidget(fxmsBookmarksBarBtn);
|
||||
},
|
||||
};
|
||||
@@ -38,5 +38,4 @@ export const MESSAGING_EXPERIMENTS_DEFAULT_FEATURES = [
|
||||
"pbNewtab",
|
||||
"spotlight",
|
||||
"featureCallout",
|
||||
"bookmarksBarButton",
|
||||
];
|
||||
|
||||
@@ -94,28 +94,6 @@ const MESSAGES = () => [
|
||||
patterns: ["*://*/*.pdf"],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "TEST_BMB_BUTTON",
|
||||
groups: [],
|
||||
template: "bookmarks_bar_button",
|
||||
content: {
|
||||
label: {
|
||||
raw: "Getting Started",
|
||||
tooltiptext: "Getting started with Firefox",
|
||||
},
|
||||
action: {
|
||||
type: "OPEN_URL",
|
||||
data: {
|
||||
args: "https://www.mozilla.org",
|
||||
where: "tab",
|
||||
},
|
||||
navigate: true,
|
||||
},
|
||||
},
|
||||
frequency: { lifetime: 100 },
|
||||
trigger: { id: "defaultBrowserCheck" },
|
||||
targeting: "true",
|
||||
},
|
||||
{
|
||||
id: "MULTISTAGE_SPOTLIGHT_MESSAGE",
|
||||
groups: ["panel-test-provider"],
|
||||
|
||||
@@ -23,7 +23,6 @@ EXTRA_JS_MODULES.asrouter += [
|
||||
"modules/ASRouterPreferences.sys.mjs",
|
||||
"modules/ASRouterTargeting.sys.mjs",
|
||||
"modules/ASRouterTriggerListeners.sys.mjs",
|
||||
"modules/BookmarksBarButton.sys.mjs",
|
||||
"modules/CFRMessageProvider.sys.mjs",
|
||||
"modules/CFRPageActions.sys.mjs",
|
||||
"modules/FeatureCallout.sys.mjs",
|
||||
@@ -54,7 +53,6 @@ TESTING_JS_MODULES += [
|
||||
"content-src/templates/CFR/templates/CFRUrlbarChiclet.schema.json",
|
||||
"content-src/templates/CFR/templates/ExtensionDoorhanger.schema.json",
|
||||
"content-src/templates/CFR/templates/InfoBar.schema.json",
|
||||
"content-src/templates/OnboardingMessage/BookmarksBarButton.schema.json",
|
||||
"content-src/templates/OnboardingMessage/Spotlight.schema.json",
|
||||
"content-src/templates/OnboardingMessage/ToolbarBadgeMessage.schema.json",
|
||||
"content-src/templates/OnboardingMessage/UpdateAction.schema.json",
|
||||
|
||||
@@ -38,8 +38,6 @@ tags = "remote-settings"
|
||||
tags = "remote-settings"
|
||||
skip-if = ["a11y_checks"] # Bug 1854515 and 1858041 to investigate intermittent a11y_checks results (fails on Autoland, passes on Try)
|
||||
|
||||
["browser_bookmarks_bar_button.js"]
|
||||
|
||||
["browser_feature_callout_in_chrome.js"]
|
||||
skip-if = [
|
||||
"os == 'mac' && debug", # Bug 1804349
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { BookmarksBarButton } = ChromeUtils.importESModule(
|
||||
"resource:///modules/asrouter/BookmarksBarButton.sys.mjs"
|
||||
);
|
||||
const { SpecialMessageActions } = ChromeUtils.importESModule(
|
||||
"resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
|
||||
);
|
||||
|
||||
const surfaceName = "fxms-bmb-button";
|
||||
|
||||
function getTestMessage() {
|
||||
return {
|
||||
id: "TEST_BMB_BAR_BUTTON",
|
||||
groups: [],
|
||||
template: "bookmarks_bar_button",
|
||||
content: {
|
||||
label: {
|
||||
raw: "Getting Started",
|
||||
tooltiptext: "Getting started with Firefox",
|
||||
},
|
||||
action: {
|
||||
type: "OPEN_URL",
|
||||
data: {
|
||||
args: "https://www.mozilla.org",
|
||||
where: "tab",
|
||||
},
|
||||
navigate: true,
|
||||
},
|
||||
},
|
||||
trigger: { id: "defaultBrowserCheck" },
|
||||
frequency: {
|
||||
lifetime: 100,
|
||||
},
|
||||
targeting: "true",
|
||||
};
|
||||
}
|
||||
|
||||
async function assertTelemetryScalars(expectedScalars) {
|
||||
let processScalars =
|
||||
Services.telemetry.getSnapshotForKeyedScalars("main", true)?.parent ?? {};
|
||||
let expectedKeys = Object.keys(expectedScalars);
|
||||
|
||||
//key is something like "browser.ui.customized_widgets"
|
||||
for (const key of expectedKeys) {
|
||||
const expectedEvents = expectedScalars[key];
|
||||
const actualEvents = processScalars[key];
|
||||
|
||||
for (const eventKey of Object.keys(expectedEvents)) {
|
||||
Assert.equal(
|
||||
expectedEvents[eventKey],
|
||||
actualEvents[eventKey],
|
||||
`Expected to see the correct value for scalar ${eventKey}, got ${actualEvents[eventKey]}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function showButton() {
|
||||
const message = getTestMessage();
|
||||
const ID = message.id;
|
||||
const sandbox = sinon.createSandbox();
|
||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const browser = win.gBrowser.selectedBrowser;
|
||||
const doc = win.document;
|
||||
|
||||
await BookmarksBarButton.showBookmarksBarButton(browser, message);
|
||||
|
||||
info("WAITING TO SHOW BOOKMARKS BAR BUTTON");
|
||||
|
||||
ok(doc.querySelector(".fxms-bmb-button"), "Bookmarks Bar Button exists");
|
||||
|
||||
// Check Keyed Scalars for Telemetry
|
||||
const expectedScalars = {
|
||||
"TEST-BMB-BAR-BUTTON_add_na_bookmarks-bar_create": 1,
|
||||
"TEST-BMB-BAR-BUTTON_remove_bookmarks-bar_na_destroy": 1,
|
||||
};
|
||||
|
||||
assertTelemetryScalars(expectedScalars);
|
||||
|
||||
CustomizableUI.destroyWidget(ID);
|
||||
await CustomizableUI.reset();
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
add_task(async function clickButton() {
|
||||
const message = getTestMessage();
|
||||
const Id2 = "TEST_BMB_BAR_BUTTON_2";
|
||||
message.id = Id2;
|
||||
const sandbox = sinon.createSandbox();
|
||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const browser = win.gBrowser.selectedBrowser;
|
||||
const doc = win.document;
|
||||
const handleActionStub = sandbox.stub(SpecialMessageActions, "handleAction");
|
||||
|
||||
await BookmarksBarButton.showBookmarksBarButton(browser, message);
|
||||
|
||||
info("WAITING TO SHOW BOOKMARKS BAR BUTTON");
|
||||
|
||||
ok(doc.querySelector(".fxms-bmb-button"), "Bookmarks Bar Button exists");
|
||||
|
||||
win.document.querySelector(".fxms-bmb-button").click();
|
||||
|
||||
ok(
|
||||
handleActionStub.calledWith(message.content.action),
|
||||
"handleAction should be called with correct Args"
|
||||
);
|
||||
ok(!doc.querySelector(".fxms-bmb-button"), "button should be removed");
|
||||
|
||||
// Check Keyed Scalars for Telemetry
|
||||
const expectedClickScalars = {
|
||||
"browser.ui.customized_widgets": {
|
||||
"TEST-BMB-BAR-BUTTON-2_remove_bookmarks-bar_na_destroy": 1,
|
||||
"TEST-BMB-BAR-BUTTON-2_add_na_bookmarks-bar_create": 1,
|
||||
},
|
||||
"browser.ui.interaction.bookmarks_bar": {
|
||||
"TEST-BMB-BAR-BUTTON-2": 1,
|
||||
},
|
||||
};
|
||||
|
||||
assertTelemetryScalars(expectedClickScalars);
|
||||
|
||||
CustomizableUI.destroyWidget(Id2);
|
||||
await CustomizableUI.reset();
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
sandbox.restore();
|
||||
});
|
||||
@@ -49,10 +49,6 @@ async function makeValidators() {
|
||||
);
|
||||
|
||||
const messageValidators = {
|
||||
bookmarks_bar_button: await schemaValidatorFor(
|
||||
"resource://testing-common/BookmarksBarButton.schema.json",
|
||||
{ common: true }
|
||||
),
|
||||
cfr_doorhanger: await schemaValidatorFor(
|
||||
"resource://testing-common/ExtensionDoorhanger.schema.json",
|
||||
{ common: true }
|
||||
|
||||
@@ -26,7 +26,6 @@ add_task(async function test_PanelTestProvider() {
|
||||
feature_callout: 2,
|
||||
pb_newtab: 2,
|
||||
toast_notification: 3,
|
||||
bookmarks_bar_button: 1,
|
||||
};
|
||||
|
||||
const EXPECTED_TOTAL_MESSAGE_COUNT = Object.values(
|
||||
|
||||
@@ -9,7 +9,6 @@ const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
|
||||
BookmarksBarButton: "resource:///modules/asrouter/BookmarksBarButton.sys.mjs",
|
||||
CFRPageActions: "resource:///modules/asrouter/CFRPageActions.sys.mjs",
|
||||
FeatureCalloutBroker:
|
||||
"resource:///modules/asrouter/FeatureCalloutBroker.sys.mjs",
|
||||
@@ -57,10 +56,6 @@ export class AboutMessagePreviewParent extends JSWindowActorParent {
|
||||
lazy.Spotlight.showSpotlightDialog(browser, message, () => {});
|
||||
}
|
||||
|
||||
showBookmarksBarButton(message, browser) {
|
||||
lazy.BookmarksBarButton.showBookmarksBarButton(message, browser);
|
||||
}
|
||||
|
||||
showCFR(message, browser) {
|
||||
lazy.CFRPageActions.forceRecommendation(
|
||||
browser,
|
||||
@@ -144,9 +139,6 @@ export class AboutMessagePreviewParent extends JSWindowActorParent {
|
||||
case "feature_callout":
|
||||
this.showFeatureCallout(message, browser);
|
||||
return;
|
||||
case "bookmarks_bar_button":
|
||||
this.showBookmarksBarButton(message, browser);
|
||||
return;
|
||||
default:
|
||||
console.error(`Unsupported message template ${message.template}`);
|
||||
}
|
||||
|
||||
@@ -458,7 +458,6 @@ body {
|
||||
}
|
||||
|
||||
toolbarpaletteitem > #personal-bookmarks > #PlacesToolbar,
|
||||
toolbarpaletteitem:has(> toolbarbutton.fxms-bmb-button),
|
||||
#personal-bookmarks:is([overflowedItem=true], [cui-areatype="panel"]) > #PlacesToolbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,3 @@
|
||||
stroke: var(--toolbarbutton-icon-fill);
|
||||
list-style-image: url("chrome://global/skin/icons/content-analysis.svg");
|
||||
}
|
||||
|
||||
.fxms-bmb-button {
|
||||
list-style-image: url("chrome://branding/content/about-logo.png");
|
||||
}
|
||||
|
||||
@@ -531,7 +531,6 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
|
||||
#PlacesToolbarItems > .bookmark-item > .toolbarbutton-icon[label]:not([label=""]),
|
||||
#PersonalToolbar #import-button > .toolbarbutton-icon,
|
||||
#PersonalToolbar #aboutwelcome-button > .toolbarbutton-icon,
|
||||
#PersonalToolbar .fxms-bmb-button > .toolbarbutton-icon,
|
||||
#OtherBookmarks.bookmark-item[container] > .toolbarbutton-icon {
|
||||
margin-inline-end: 4px;
|
||||
}
|
||||
|
||||
@@ -3452,15 +3452,3 @@ crlite:
|
||||
pref: security.pki.crlite_mode
|
||||
description: >-
|
||||
How CRLite results will be interpreted.
|
||||
|
||||
fxms_bmb_button:
|
||||
description: A feature for the Firefox Messaging System Bookmarks Bar button surface
|
||||
owner: omc@mozilla.com
|
||||
hasExposure: true
|
||||
exposureDescription: >-
|
||||
Exposure is sent if the message is about to be shown after trigger and
|
||||
targeting conditions on the message matched.
|
||||
schema:
|
||||
uri: chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json
|
||||
path: browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json
|
||||
variables: {}
|
||||
|
||||
@@ -1505,7 +1505,6 @@ messaging_experiments:
|
||||
"infobar",
|
||||
"spotlight",
|
||||
"featureCallout",
|
||||
"fxms_bmb_button",
|
||||
"fxms_message_1",
|
||||
"fxms_message_2",
|
||||
"fxms_message_3",
|
||||
|
||||
Reference in New Issue
Block a user