Backed out changeset cbafd2e6cf53 (bug 1587809) for browser_asrouter_cfr.js failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2019-10-17 13:31:33 +03:00
parent cef8adf998
commit 3f1e57d343
7 changed files with 21 additions and 55 deletions

View File

@ -129,9 +129,7 @@ const CFR_MESSAGES = [
layout: "addon_recommendation",
category: "cfrAddons",
bucket_id: "CFR_M1",
notification_text: {
string_id: "cfr-doorhanger-extension-notification2",
},
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-extension-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -200,9 +198,7 @@ const CFR_MESSAGES = [
layout: "addon_recommendation",
category: "cfrAddons",
bucket_id: "CFR_M1",
notification_text: {
string_id: "cfr-doorhanger-extension-notification2",
},
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-extension-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -272,9 +268,7 @@ const CFR_MESSAGES = [
layout: "addon_recommendation",
category: "cfrAddons",
bucket_id: "CFR_M1",
notification_text: {
string_id: "cfr-doorhanger-extension-notification2",
},
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-extension-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -345,9 +339,7 @@ const CFR_MESSAGES = [
layout: "addon_recommendation",
category: "cfrAddons",
bucket_id: "CFR_M1",
notification_text: {
string_id: "cfr-doorhanger-extension-notification2",
},
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-extension-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -421,9 +413,7 @@ const CFR_MESSAGES = [
layout: "addon_recommendation",
category: "cfrAddons",
bucket_id: "CFR_M1",
notification_text: {
string_id: "cfr-doorhanger-extension-notification2",
},
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-extension-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -493,7 +483,7 @@ const CFR_MESSAGES = [
layout: "message_and_animation",
category: "cfrFeatures",
bucket_id: "CFR_PIN_TAB",
notification_text: { string_id: "cfr-doorhanger-feature-notification" },
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-pintab-heading" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },
@ -607,7 +597,7 @@ const CFR_MESSAGES = [
sumo_path: "extensionrecommendations",
},
notification_text: {
string_id: "cfr-doorhanger-feature-notification",
string_id: "cfr-doorhanger-extension-notification",
},
category: "cfrFeatures",
},

View File

@ -182,18 +182,13 @@ class PageAction {
async showAddressBarNotifier(recommendation, shouldExpand = false) {
this.container.hidden = false;
let notificationText = await this.getStrings(
this.label.value = await this.getStrings(
recommendation.content.notification_text
);
this.label.value = notificationText;
this.button.setAttribute(
"tooltiptext",
notificationText.attributes.tooltiptext
);
// For a11y, we want the more descriptive text.
this.container.setAttribute(
"aria-label",
notificationText.attributes.tooltiptext
await this.getStrings(recommendation.content.notification_text)
);
this.button.setAttribute(
"data-cfr-icon",
@ -221,11 +216,6 @@ class PageAction {
this.addImpression(recommendation);
}
this.window.A11yUtils.announce({
raw: notificationText.attributes["a11y-announcement"],
source: this.container,
});
}
hideAddressBarNotifier() {

View File

@ -143,7 +143,7 @@ const MESSAGES = () => [
content: {
layout: "icon_and_message",
category: "cfrFeatures",
notification_text: { string_id: "cfr-doorhanger-feature-notification" },
notification_text: { string_id: "cfr-doorhanger-extension-notification" },
heading_text: { string_id: "cfr-doorhanger-sync-bookmarks-header" },
info_icon: {
label: { string_id: "cfr-doorhanger-extension-sumo-link" },

View File

@ -2476,7 +2476,6 @@ describe("ASRouter", () => {
document: { getElementById },
promiseDocumentFlushed: sandbox.stub().resolves([{ width: 0 }]),
setTimeout: sandbox.stub(),
A11yUtils: { announce: sandbox.stub() },
};
const firstMessage = { ...FAKE_RECOMMENDATION, id: "first_message" };
const secondMessage = { ...FAKE_RECOMMENDATION, id: "second_message" };

View File

@ -12,7 +12,6 @@ describe("CFRPageActions", () => {
let globals;
let containerElem;
let elements;
let announceStub;
const elementIDs = [
"urlbar",
@ -42,8 +41,6 @@ describe("CFRPageActions", () => {
sandbox = sinon.createSandbox();
clock = sandbox.useFakeTimers();
announceStub = sandbox.stub();
const A11yUtils = { announce: announceStub };
fakeRecommendation = { ...FAKE_RECOMMENDATION };
fakeHost = "mozilla.org";
fakeBrowser = {
@ -67,7 +64,6 @@ describe("CFRPageActions", () => {
},
PrivateBrowsingUtils: { isWindowPrivate: sandbox.stub().returns(false) },
gBrowser: { selectedBrowser: fakeBrowser },
A11yUtils,
});
document.createXULElement = document.createElement;
@ -98,19 +94,22 @@ describe("CFRPageActions", () => {
describe("PageAction", () => {
let pageAction;
let getStringsStub;
beforeEach(() => {
pageAction = new PageAction(window, dispatchStub);
getStringsStub = sandbox.stub(pageAction, "getStrings").resolves("");
});
describe("#showAddressBarNotifier", () => {
it("should un-hideAddressBarNotifier the element and set the right label value", async () => {
const FAKE_NOTIFICATION_TEXT = "FAKE_NOTIFICATION_TEXT";
getStringsStub
.withArgs(fakeRecommendation.content.notification_text)
.resolves(FAKE_NOTIFICATION_TEXT);
await pageAction.showAddressBarNotifier(fakeRecommendation);
assert.isFalse(pageAction.container.hidden);
assert.equal(
pageAction.label.value,
fakeRecommendation.content.notification_text
);
assert.equal(pageAction.label.value, FAKE_NOTIFICATION_TEXT);
});
it("should wait for the document layout to flush", async () => {
sandbox.spy(pageAction.label, "getClientRects");
@ -357,6 +356,7 @@ describe("CFRPageActions", () => {
];
beforeEach(() => {
getStringsStub.restore();
formatMessagesStub = sandbox
.stub()
.withArgs({ id: "hello_world" })
@ -433,7 +433,6 @@ describe("CFRPageActions", () => {
describe("#_showPopupOnClick", () => {
let translateElementsStub;
let setAttributesStub;
let getStringsStub;
beforeEach(async () => {
CFRPageActions.PageActionMap.set(fakeBrowser.ownerGlobal, pageAction);
await CFRPageActions.addRecommendation(
@ -442,7 +441,6 @@ describe("CFRPageActions", () => {
fakeRecommendation,
dispatchStub
);
getStringsStub = sandbox.stub(pageAction, "getStrings").resolves("");
getStringsStub
.callsFake(async a => a) // eslint-disable-line max-nested-callbacks
.withArgs({ string_id: "primary_button_id" })

View File

@ -81,16 +81,13 @@ export const FAKE_REMOTE_SETTINGS_PROVIDER = {
enabled: true,
};
const notificationText = new String("Fake notification text"); // eslint-disable-line
notificationText.attributes = { tooltiptext: "Fake tooltip text" };
export const FAKE_RECOMMENDATION = {
id: "fake_id",
template: "cfr_doorhanger",
content: {
category: "cfrDummy",
bucket_id: "fake_bucket_id",
notification_text: notificationText,
notification_text: "Fake Notification Text",
info_icon: {
label: "Fake Info Icon Label",
sumo_path: "a_help_path_fragment",

View File

@ -35,15 +35,7 @@ cfr-doorhanger-extension-author = by { $name }
# This is a notification displayed in the address bar.
# When clicked it opens a panel with a message for the user.
cfr-doorhanger-extension-notification2 = Recommendation
.tooltiptext = Extension recommendation
.a11y-announcement = Extension recommendation available
# This is a notification displayed in the address bar.
# When clicked it opens a panel with a message for the user.
cfr-doorhanger-feature-notification = Recommendation
.tooltiptext = Feature recommendation
.a11y-announcement = Feature recommendation available
cfr-doorhanger-extension-notification = Recommendation
## Add-on statistics
## These strings are used to display the total number of