summaryrefslogtreecommitdiffstats
path: root/browser/components/reportbrokensite
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/reportbrokensite')
-rw-r--r--browser/components/reportbrokensite/ReportBrokenSite.sys.mjs2
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_back_buttons.js41
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_keyboard_navigation.js60
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js2
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_reason_dropdown.js194
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_report_site_issue_fallback.js13
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_send_more_info.js29
-rw-r--r--browser/components/reportbrokensite/test/browser/browser_tab_key_order.js13
-rw-r--r--browser/components/reportbrokensite/test/browser/head.js2
9 files changed, 166 insertions, 190 deletions
diff --git a/browser/components/reportbrokensite/ReportBrokenSite.sys.mjs b/browser/components/reportbrokensite/ReportBrokenSite.sys.mjs
index ef1f4e1270..836908c7b4 100644
--- a/browser/components/reportbrokensite/ReportBrokenSite.sys.mjs
+++ b/browser/components/reportbrokensite/ReportBrokenSite.sys.mjs
@@ -594,7 +594,7 @@ export var ReportBrokenSite = new (class ReportBrokenSite {
const expectedBrowser = tabbrowser.getBrowserForTab(tab);
return new Promise(resolve => {
const listener = {
- onLocationChange(browser, webProgress, request, uri, flags) {
+ onLocationChange(browser, webProgress, request, uri) {
if (
browser == expectedBrowser &&
uri.spec == url &&
diff --git a/browser/components/reportbrokensite/test/browser/browser_back_buttons.js b/browser/components/reportbrokensite/test/browser/browser_back_buttons.js
index b8de5f8e95..c004442c24 100644
--- a/browser/components/reportbrokensite/test/browser/browser_back_buttons.js
+++ b/browser/components/reportbrokensite/test/browser/browser_back_buttons.js
@@ -12,26 +12,23 @@ add_common_setup();
add_task(async function testBackButtonsAreAdded() {
ensureReportBrokenSitePreffedOn();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- let rbs = await AppMenu().openReportBrokenSite();
- rbs.isBackButtonEnabled();
- await rbs.clickBack();
- await rbs.close();
-
- rbs = await HelpMenu().openReportBrokenSite();
- ok(!rbs.backButton, "Back button is not shown for Help Menu");
- await rbs.close();
-
- rbs = await ProtectionsPanel().openReportBrokenSite();
- rbs.isBackButtonEnabled();
- await rbs.clickBack();
- await rbs.close();
-
- rbs = await HelpMenu().openReportBrokenSite();
- ok(!rbs.backButton, "Back button is not shown for Help Menu");
- await rbs.close();
- }
- );
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ let rbs = await AppMenu().openReportBrokenSite();
+ rbs.isBackButtonEnabled();
+ await rbs.clickBack();
+ await rbs.close();
+
+ rbs = await HelpMenu().openReportBrokenSite();
+ ok(!rbs.backButton, "Back button is not shown for Help Menu");
+ await rbs.close();
+
+ rbs = await ProtectionsPanel().openReportBrokenSite();
+ rbs.isBackButtonEnabled();
+ await rbs.clickBack();
+ await rbs.close();
+
+ rbs = await HelpMenu().openReportBrokenSite();
+ ok(!rbs.backButton, "Back button is not shown for Help Menu");
+ await rbs.close();
+ });
});
diff --git a/browser/components/reportbrokensite/test/browser/browser_keyboard_navigation.js b/browser/components/reportbrokensite/test/browser/browser_keyboard_navigation.js
index 4c37866628..3bf9278e46 100644
--- a/browser/components/reportbrokensite/test/browser/browser_keyboard_navigation.js
+++ b/browser/components/reportbrokensite/test/browser/browser_keyboard_navigation.js
@@ -12,34 +12,31 @@ add_common_setup();
requestLongerTimeout(2);
async function testPressingKey(key, tabToMatch, makePromise, followUp) {
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- for (const menu of [AppMenu(), ProtectionsPanel(), HelpMenu()]) {
- info(
- `Opening RBS to test pressing ${key} for ${tabToMatch} on ${menu.menuDescription}`
- );
- const rbs = await menu.openReportBrokenSite();
- const promise = makePromise(rbs);
- if (tabToMatch) {
- if (await tabTo(tabToMatch)) {
- await pressKeyAndAwait(promise, key);
- followUp && (await followUp(rbs));
- await rbs.close();
- ok(true, `was able to activate ${tabToMatch} with keyboard`);
- } else {
- await rbs.close();
- ok(false, `could not tab to ${tabToMatch}`);
- }
- } else {
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ for (const menu of [AppMenu(), ProtectionsPanel(), HelpMenu()]) {
+ info(
+ `Opening RBS to test pressing ${key} for ${tabToMatch} on ${menu.menuDescription}`
+ );
+ const rbs = await menu.openReportBrokenSite();
+ const promise = makePromise(rbs);
+ if (tabToMatch) {
+ if (await tabTo(tabToMatch)) {
await pressKeyAndAwait(promise, key);
followUp && (await followUp(rbs));
await rbs.close();
- ok(true, `was able to use keyboard`);
+ ok(true, `was able to activate ${tabToMatch} with keyboard`);
+ } else {
+ await rbs.close();
+ ok(false, `could not tab to ${tabToMatch}`);
}
+ } else {
+ await pressKeyAndAwait(promise, key);
+ followUp && (await followUp(rbs));
+ await rbs.close();
+ ok(true, `was able to use keyboard`);
}
}
- );
+ });
}
add_task(async function testSendMoreInfo() {
@@ -98,16 +95,13 @@ add_task(async function testESCOnSent() {
add_task(async function testBackButtons() {
ensureReportBrokenSitePreffedOn();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- for (const menu of [AppMenu(), ProtectionsPanel()]) {
- await menu.openReportBrokenSite();
- await tabTo("#report-broken-site-popup-mainView .subviewbutton-back");
- const promise = BrowserTestUtils.waitForEvent(menu.popup, "ViewShown");
- await pressKeyAndAwait(promise, "KEY_Enter");
- menu.close();
- }
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ for (const menu of [AppMenu(), ProtectionsPanel()]) {
+ await menu.openReportBrokenSite();
+ await tabTo("#report-broken-site-popup-mainView .subviewbutton-back");
+ const promise = BrowserTestUtils.waitForEvent(menu.popup, "ViewShown");
+ await pressKeyAndAwait(promise, "KEY_Enter");
+ menu.close();
}
- );
+ });
});
diff --git a/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js b/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js
index 7097a662e5..68aeae911e 100644
--- a/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js
+++ b/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js
@@ -33,7 +33,7 @@ add_task(async function testReportSentViewBGColor() {
await SpecialPowers.pushPrefEnv({ set: HIGH_CONTRAST_MODE_OFF });
const rbs = await menu.openReportBrokenSite();
const { mainView, sentView } = rbs;
- mainView.style.backgroundColor = "var(--color-background-success)";
+ mainView.style.backgroundColor = "var(--background-color-success)";
const expectedReportSentBGColor =
defaultView.getComputedStyle(mainView).backgroundColor;
mainView.style.backgroundColor = "";
diff --git a/browser/components/reportbrokensite/test/browser/browser_reason_dropdown.js b/browser/components/reportbrokensite/test/browser/browser_reason_dropdown.js
index 0f5545fcc4..e6e6967919 100644
--- a/browser/components/reportbrokensite/test/browser/browser_reason_dropdown.js
+++ b/browser/components/reportbrokensite/test/browser/browser_reason_dropdown.js
@@ -29,45 +29,42 @@ async function clickSendAndCheckPing(rbs, expectedReason = null) {
add_task(async function testReasonDropdown() {
ensureReportBrokenSitePreffedOn();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- ensureReasonDisabled();
-
- let rbs = await AppMenu().openReportBrokenSite();
- await rbs.isReasonHidden();
- await rbs.isSendButtonEnabled();
- await clickSendAndCheckPing(rbs);
- await rbs.clickOkay();
-
- ensureReasonOptional();
- rbs = await AppMenu().openReportBrokenSite();
- await rbs.isReasonOptional();
- await rbs.isSendButtonEnabled();
- await clickSendAndCheckPing(rbs);
- await rbs.clickOkay();
-
- rbs = await AppMenu().openReportBrokenSite();
- await rbs.isReasonOptional();
- rbs.chooseReason("slow");
- await rbs.isSendButtonEnabled();
- await clickSendAndCheckPing(rbs, "slow");
- await rbs.clickOkay();
-
- ensureReasonRequired();
- rbs = await AppMenu().openReportBrokenSite();
- await rbs.isReasonRequired();
- await rbs.isSendButtonEnabled();
- const selectPromise = BrowserTestUtils.waitForSelectPopupShown(window);
- EventUtils.synthesizeMouseAtCenter(rbs.sendButton, {}, window);
- await selectPromise;
- rbs.chooseReason("media");
- await rbs.dismissDropdownPopup();
- await rbs.isSendButtonEnabled();
- await clickSendAndCheckPing(rbs, "media");
- await rbs.clickOkay();
- }
- );
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ ensureReasonDisabled();
+
+ let rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isReasonHidden();
+ await rbs.isSendButtonEnabled();
+ await clickSendAndCheckPing(rbs);
+ await rbs.clickOkay();
+
+ ensureReasonOptional();
+ rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isReasonOptional();
+ await rbs.isSendButtonEnabled();
+ await clickSendAndCheckPing(rbs);
+ await rbs.clickOkay();
+
+ rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isReasonOptional();
+ rbs.chooseReason("slow");
+ await rbs.isSendButtonEnabled();
+ await clickSendAndCheckPing(rbs, "slow");
+ await rbs.clickOkay();
+
+ ensureReasonRequired();
+ rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isReasonRequired();
+ await rbs.isSendButtonEnabled();
+ const selectPromise = BrowserTestUtils.waitForSelectPopupShown(window);
+ EventUtils.synthesizeMouseAtCenter(rbs.sendButton, {}, window);
+ await selectPromise;
+ rbs.chooseReason("media");
+ await rbs.dismissDropdownPopup();
+ await rbs.isSendButtonEnabled();
+ await clickSendAndCheckPing(rbs, "media");
+ await rbs.clickOkay();
+ });
});
async function getListItems(rbs) {
@@ -90,72 +87,69 @@ add_task(async function testReasonDropdownRandomized() {
undefined
);
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- // confirm that the default order is initially used
- Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
- const rbs = await AppMenu().openReportBrokenSite();
- const defaultOrder = [
- "choose",
- "slow",
- "media",
- "content",
- "account",
- "adblockers",
- "other",
- ];
- Assert.deepEqual(
- await getListItems(rbs),
- defaultOrder,
- "non-random order is correct"
- );
-
- // confirm that a random order happens per user
- let randomOrder;
- let isRandomized = false;
- Services.prefs.setBoolPref(RANDOMIZE_PREF, true);
-
- // This becomes ClientEnvironment.randomizationId, which we can set to
- // any value which results in a different order from the default ordering.
- Services.prefs.setCharPref("app.normandy.user_id", "dummy");
-
- // clicking cancel triggers a reset, which is when the randomization
- // logic is called. so we must click cancel after pref-changes here.
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ // confirm that the default order is initially used
+ Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
+ const rbs = await AppMenu().openReportBrokenSite();
+ const defaultOrder = [
+ "choose",
+ "slow",
+ "media",
+ "content",
+ "account",
+ "adblockers",
+ "other",
+ ];
+ Assert.deepEqual(
+ await getListItems(rbs),
+ defaultOrder,
+ "non-random order is correct"
+ );
+
+ // confirm that a random order happens per user
+ let randomOrder;
+ let isRandomized = false;
+ Services.prefs.setBoolPref(RANDOMIZE_PREF, true);
+
+ // This becomes ClientEnvironment.randomizationId, which we can set to
+ // any value which results in a different order from the default ordering.
+ Services.prefs.setCharPref("app.normandy.user_id", "dummy");
+
+ // clicking cancel triggers a reset, which is when the randomization
+ // logic is called. so we must click cancel after pref-changes here.
+ rbs.clickCancel();
+ await AppMenu().openReportBrokenSite();
+ randomOrder = await getListItems(rbs);
+ Assert.ok(
+ randomOrder != defaultOrder,
+ "options are randomized with pref on"
+ );
+
+ // confirm that the order doesn't change per user
+ isRandomized = false;
+ for (let attempt = 0; attempt < 5; ++attempt) {
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
- randomOrder = await getListItems(rbs);
- Assert.ok(
- randomOrder != defaultOrder,
- "options are randomized with pref on"
- );
+ const order = await getListItems(rbs);
- // confirm that the order doesn't change per user
- isRandomized = false;
- for (let attempt = 0; attempt < 5; ++attempt) {
- rbs.clickCancel();
- await AppMenu().openReportBrokenSite();
- const order = await getListItems(rbs);
-
- if (order != randomOrder) {
- isRandomized = true;
- break;
- }
+ if (order != randomOrder) {
+ isRandomized = true;
+ break;
}
- Assert.ok(!isRandomized, "options keep the same order per user");
-
- // confirm that the order reverts to the default if pref flipped to false
- Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
- rbs.clickCancel();
- await AppMenu().openReportBrokenSite();
- Assert.deepEqual(
- defaultOrder,
- await getListItems(rbs),
- "reverts to non-random order correctly"
- );
- rbs.clickCancel();
}
- );
+ Assert.ok(!isRandomized, "options keep the same order per user");
+
+ // confirm that the order reverts to the default if pref flipped to false
+ Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
+ rbs.clickCancel();
+ await AppMenu().openReportBrokenSite();
+ Assert.deepEqual(
+ defaultOrder,
+ await getListItems(rbs),
+ "reverts to non-random order correctly"
+ );
+ rbs.clickCancel();
+ });
Services.prefs.setCharPref(USER_ID_PREF, origNormandyUserID);
});
diff --git a/browser/components/reportbrokensite/test/browser/browser_report_site_issue_fallback.js b/browser/components/reportbrokensite/test/browser/browser_report_site_issue_fallback.js
index 26101d77b9..98c6c740a5 100644
--- a/browser/components/reportbrokensite/test/browser/browser_report_site_issue_fallback.js
+++ b/browser/components/reportbrokensite/test/browser/browser_report_site_issue_fallback.js
@@ -40,14 +40,11 @@ async function testEnabledForValidURLs(menu) {
ensureReportBrokenSitePreffedOff();
ensureReportSiteIssuePreffedOn();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- await menu.open();
- menu.isReportSiteIssueEnabled();
- await menu.close();
- }
- );
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ await menu.open();
+ menu.isReportSiteIssueEnabled();
+ await menu.close();
+ });
}
// AppMenu help sub-menu
diff --git a/browser/components/reportbrokensite/test/browser/browser_send_more_info.js b/browser/components/reportbrokensite/test/browser/browser_send_more_info.js
index edce03e0e0..9306f5161e 100644
--- a/browser/components/reportbrokensite/test/browser/browser_send_more_info.js
+++ b/browser/components/reportbrokensite/test/browser/browser_send_more_info.js
@@ -24,22 +24,19 @@ requestLongerTimeout(2);
add_task(async function testSendMoreInfoPref() {
ensureReportBrokenSitePreffedOn();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- await changeTab(gBrowser.selectedTab, REPORTABLE_PAGE_URL);
-
- ensureSendMoreInfoDisabled();
- let rbs = await AppMenu().openReportBrokenSite();
- await rbs.isSendMoreInfoHidden();
- await rbs.close();
-
- ensureSendMoreInfoEnabled();
- rbs = await AppMenu().openReportBrokenSite();
- await rbs.isSendMoreInfoShown();
- await rbs.close();
- }
- );
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ await changeTab(gBrowser.selectedTab, REPORTABLE_PAGE_URL);
+
+ ensureSendMoreInfoDisabled();
+ let rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isSendMoreInfoHidden();
+ await rbs.close();
+
+ ensureSendMoreInfoEnabled();
+ rbs = await AppMenu().openReportBrokenSite();
+ await rbs.isSendMoreInfoShown();
+ await rbs.close();
+ });
});
add_task(async function testSendingMoreInfo() {
diff --git a/browser/components/reportbrokensite/test/browser/browser_tab_key_order.js b/browser/components/reportbrokensite/test/browser/browser_tab_key_order.js
index 3a50c9aa51..e02c6a8394 100644
--- a/browser/components/reportbrokensite/test/browser/browser_tab_key_order.js
+++ b/browser/components/reportbrokensite/test/browser/browser_tab_key_order.js
@@ -124,12 +124,9 @@ add_task(async function testTabOrdering() {
ensureReportBrokenSitePreffedOn();
ensureSendMoreInfoEnabled();
- await BrowserTestUtils.withNewTab(
- REPORTABLE_PAGE_URL,
- async function (browser) {
- await testTabOrder(AppMenu());
- await testTabOrder(ProtectionsPanel());
- await testTabOrder(HelpMenu());
- }
- );
+ await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
+ await testTabOrder(AppMenu());
+ await testTabOrder(ProtectionsPanel());
+ await testTabOrder(HelpMenu());
+ });
});
diff --git a/browser/components/reportbrokensite/test/browser/head.js b/browser/components/reportbrokensite/test/browser/head.js
index 7cc1d51a21..84aa0f56dc 100644
--- a/browser/components/reportbrokensite/test/browser/head.js
+++ b/browser/components/reportbrokensite/test/browser/head.js
@@ -833,7 +833,7 @@ async function tabTo(match, win = window) {
return undefined;
}
-async function setupStrictETP(fn) {
+async function setupStrictETP() {
await UrlClassifierTestUtils.addTestTrackers();
registerCleanupFunction(() => {
UrlClassifierTestUtils.cleanupTestTrackers();