Skip to content

Commit

Permalink
Bug 1864534 - remove firefox-view-next pref and update about AboutRed…
Browse files Browse the repository at this point in the history
…irector r=fxview-reviewers,Gijs

- removes `about:firefoxview-next` route
- `about:firefoxview` now points to `firefoxview-next.html` (until we rename)
- remove pref for `browser.tabs.firefox-view-next`
- preserve pref for `browser.tabs.firefox-view-newIcon` as part of firefoxViewNext feature manifest (until experiment is over)
- whitelist unreferenced files in `browser_all_files_referenced.js` as they will be removed in child Bug 1869833

Differential Revision: https://phabricator.services.mozilla.com/D196093
  • Loading branch information
nikk15 committed Jan 4, 2024
1 parent 5c87cc2 commit cd901e4
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 118 deletions.
1 change: 0 additions & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ pref("browser.tabs.tooltipsShowPidAndActiveness", false);
#endif

pref("browser.tabs.firefox-view", true);
pref("browser.tabs.firefox-view-next", true);
pref("browser.tabs.firefox-view-newIcon", true);
pref("browser.tabs.firefox-view.logLevel", "Warn");
pref("browser.tabs.firefox-view.notify-for-tabs", false);
Expand Down
22 changes: 4 additions & 18 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ var gInitialPages = [
"about:blank",
"about:home",
"about:firefoxview",
"about:firefoxview-next",
"about:newtab",
"about:privatebrowsing",
"about:sessionrestore",
Expand Down Expand Up @@ -9963,7 +9962,6 @@ var FirefoxViewHandler = {
this._updateEnabledState = this._updateEnabledState.bind(this);
this._updateEnabledState();
NimbusFeatures.majorRelease2022.onUpdate(this._updateEnabledState);
NimbusFeatures.firefoxViewNext.onUpdate(this._updateEnabledState);

ChromeUtils.defineESModuleGetters(this, {
SyncedTabs: "resource://services-sync/SyncedTabs.sys.mjs",
Expand All @@ -9974,12 +9972,9 @@ var FirefoxViewHandler = {
CustomizableUI.removeListener(this);
Services.obs.removeObserver(this, "firefoxview-notification-dot-update");
NimbusFeatures.majorRelease2022.offUpdate(this._updateEnabledState);
NimbusFeatures.firefoxViewNext.offUpdate(this._updateEnabledState);
},
_updateEnabledState() {
this._enabled =
NimbusFeatures.majorRelease2022.getVariable("firefoxView") ||
NimbusFeatures.firefoxViewNext.getVariable("enabled");
this._enabled = NimbusFeatures.majorRelease2022.getVariable("firefoxView");
// We use a root attribute because there's no guarantee the button is in the
// DOM, and visibility changes need to take effect even if it isn't in the DOM
// right now.
Expand Down Expand Up @@ -10014,9 +10009,7 @@ var FirefoxViewHandler = {
CustomizableUI.getPlacementOfWidget("tabbrowser-tabs").position
);
}
const viewURL = NimbusFeatures.firefoxViewNext.getVariable("enabled")
? "about:firefoxview-next"
: "about:firefoxview";
const viewURL = "about:firefoxview";
// Need to account for navigation to Firefox View pages
if (
this.tab &&
Expand Down Expand Up @@ -10111,18 +10104,11 @@ var FirefoxViewHandler = {
const PREF_NAME = "browser.firefox-view.view-count";
const MAX_VIEW_COUNT = 10;
let viewCount = Services.prefs.getIntPref(PREF_NAME, 0);
let isFirefoxViewNext = Services.prefs.getBoolPref(
"browser.tabs.firefox-view-next",
false
);

// Record telemetry
Services.telemetry.setEventRecordingEnabled(
isFirefoxViewNext ? "firefoxview_next" : "firefoxview",
true
);
Services.telemetry.setEventRecordingEnabled("firefoxview_next", true);
Services.telemetry.recordEvent(
isFirefoxViewNext ? "firefoxview_next" : "firefoxview",
"firefoxview_next",
"tab_selected",
"toolbarbutton",
null,
Expand Down
10 changes: 10 additions & 0 deletions browser/base/content/test/static/browser_all_files_referenced.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ var allowlist = [
{ file: "chrome://browser/content/screenshots/copy.svg" },
{ file: "chrome://browser/content/screenshots/download.svg" },
{ file: "chrome://browser/content/screenshots/download-white.svg" },

// Files removed in child patch for Bug 1869833
{ file: "chrome://browser/content/firefoxview/firefoxview.css" },
{ file: "chrome://browser/content/firefoxview/firefoxview.html" },
{ file: "chrome://browser/content/firefoxview/firefoxview.mjs" },
{ file: "chrome://browser/content/firefoxview/recently-closed-empty.svg" },
{ file: "chrome://browser/content/firefoxview/recently-closed-tabs.mjs" },
{ file: "chrome://browser/content/firefoxview/tab-pickup-container.mjs" },
{ file: "chrome://browser/content/firefoxview/tab-pickup-empty.svg" },
{ file: "chrome://browser/content/firefoxview/tab-pickup-list.mjs" },
];

if (AppConstants.platform != "win") {
Expand Down
1 change: 0 additions & 1 deletion browser/components/BrowserGlue.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ let JSWINDOWACTORS = {
"chrome://browser/content/places/historySidebar.xhtml",
"chrome://browser/content/places/bookmarksSidebar.xhtml",
"about:firefoxview",
"about:firefoxview-next",
],
},

Expand Down
5 changes: 1 addition & 4 deletions browser/components/about/AboutRedirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::IS_SECURE_CHROME_UI},
{"firefoxview", "chrome://browser/content/firefoxview/firefoxview.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"firefoxview-next",
{"firefoxview",
"chrome://browser/content/firefoxview/firefoxview-next.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI |
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
Expand Down
4 changes: 2 additions & 2 deletions browser/components/firefoxview/card-container.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class CardContainer extends MozLitElement {
<slot name="secondary-header"></slot>
</span>
<a
href="about:firefoxview-next#${this.shortPageName}"
href="about:firefoxview#${this.shortPageName}"
@click=${this.viewAllClicked}
class="view-all-link"
data-l10n-id="firefoxview-view-all-link"
Expand Down Expand Up @@ -188,7 +188,7 @@ class CardContainer extends MozLitElement {
<slot name="header"></slot>
</summary>
<a
href="about:firefoxview-next#${this.shortPageName}"
href="about:firefoxview#${this.shortPageName}"
@click=${this.viewAllClicked}
class="view-all-link"
data-l10n-id="firefoxview-view-all-link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ function openTabInWindow(window, url) {
switchToTabHavingURI(url, true, {});
}

function isFirefoxViewNext(window) {
return window.location.pathname === "firefoxview-next";
}

export const TabsSetupFlowManager = new (class {
constructor() {
this.QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
Expand Down Expand Up @@ -621,10 +617,12 @@ export const TabsSetupFlowManager = new (class {
);
this.didFxaTabOpen = true;
openTabInWindow(window, url, true);
const category = isFirefoxViewNext(window)
? "firefoxview_next"
: "firefoxview";
Services.telemetry.recordEvent(category, "fxa_continue", "sync", null);
Services.telemetry.recordEvent(
"firefoxview_next",
"fxa_continue",
"sync",
null
);
}

async openFxAPairDevice(window) {
Expand All @@ -633,12 +631,15 @@ export const TabsSetupFlowManager = new (class {
});
this.didFxaTabOpen = true;
openTabInWindow(window, url, true);
const category = isFirefoxViewNext(window)
? "firefoxview_next"
: "firefoxview";
Services.telemetry.recordEvent(category, "fxa_mobile", "sync", null, {
has_devices: this.secondaryDeviceConnected.toString(),
});
Services.telemetry.recordEvent(
"firefoxview_next",
"fxa_mobile",
"sync",
null,
{
has_devices: this.secondaryDeviceConnected.toString(),
}
);
}

syncOpenTabs(containerElem) {
Expand Down
2 changes: 1 addition & 1 deletion browser/components/firefoxview/recentlyclosed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class RecentlyClosedTabsInView extends ViewPage {
"firefoxview-recentlyclosed-empty-description-two",
];
descriptionLink = {
url: "about:firefoxview-next#history",
url: "about:firefoxview#history",
name: "history-url",
sameTarget: "true",
};
Expand Down
2 changes: 1 addition & 1 deletion browser/components/firefoxview/syncedtabs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ class SyncedTabsInView extends ViewPage {
sendTabTelemetry(numTabs) {
/*
Services.telemetry.recordEvent(
"firefoxview-next",
"firefoxview_next",
"synced_tabs",
"tabs",
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ function init(scope) {
}

function getFirefoxViewURL() {
return Services.prefs.getBoolPref("browser.tabs.firefox-view-next", true)
? "about:firefoxview-next"
: "about:firefoxview";
return "about:firefoxview";
}

function assertFirefoxViewTab(win) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,12 @@

/* import-globals-from ../head.js */

const FXVIEW_NEXT_ENABLED_PREF = "browser.tabs.firefox-view-next";
const FXVIEW_ENABLED_PREF = "browser.tabs.firefox-view";

add_task(async function about_firefoxview_next_pref() {
// Verify pref enables new Firefox view
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, true]] });
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
});
// Verify pref enables new Firefox view even when old is disabled
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_ENABLED_PREF, false]] });
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
});
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_ENABLED_PREF, true]] });
// Verify pref disables new Firefox view
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, false]] });
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview");
});
});

add_task(async function test_aria_roles() {
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, true]] });
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
is(document.location.href, "about:firefoxview");

is(
document.querySelector("main").getAttribute("role"),
Expand Down Expand Up @@ -99,12 +75,6 @@ add_task(async function test_aria_roles() {
"Focus should be on button element of the synced tabs empty state"
);
});
// Verify pref disables new Firefox view
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, false]] });
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview");
});
});

add_task(async function firefoxview_next_icon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

/* import-globals-from ../head.js */

const FXVIEW_NEXT_ENABLED_PREF = "browser.tabs.firefox-view-next";
const CARD_COLLAPSED_EVENT = [
["firefoxview_next", "card_collapsed", "card_container", undefined],
];
Expand All @@ -26,7 +25,6 @@ let enteredTelemetry = [
];

add_setup(async () => {
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, true]] });
registerCleanupFunction(async () => {
await SpecialPowers.popPrefEnv();
clearHistory();
Expand All @@ -39,7 +37,7 @@ add_task(async function firefox_view_entered_telemetry() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);
let enteredAndTabSelectedEvents = [tabSelectedTelemetry, enteredTelemetry];
Expand Down Expand Up @@ -71,7 +69,7 @@ add_task(async function test_collapse_and_expand_card() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);

Expand Down Expand Up @@ -113,7 +111,7 @@ add_task(async function test_change_page_telemetry() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);
let changePageEvent = [
Expand Down Expand Up @@ -152,13 +150,12 @@ add_task(async function test_change_page_telemetry() {
});

add_task(async function test_browser_context_menu_telemetry() {
await SpecialPowers.pushPrefEnv({ set: [[FXVIEW_NEXT_ENABLED_PREF, true]] });
const menu = document.getElementById("contentAreaContextMenu");
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);
await clearAllParentTelemetryEvents();
Expand Down Expand Up @@ -209,7 +206,7 @@ add_task(async function test_context_menu_new_window_telemetry() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);

Expand Down Expand Up @@ -265,7 +262,7 @@ add_task(async function test_context_menu_private_window_telemetry() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);

Expand Down Expand Up @@ -333,7 +330,7 @@ add_task(async function test_context_menu_delete_from_history_telemetry() {
const { document } = browser.contentWindow;
is(
document.location.href,
"about:firefoxview-next",
"about:firefoxview",
"The Recent browsing page is showing."
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* import-globals-from ../head.js */

const URL_BASE = "about:firefoxview-next#";
const URL_BASE = "about:firefoxview#";

function assertCorrectPage(document, name, event) {
is(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const SHOW_ALL_HISTORY_EVENT = [
["firefoxview_next", "show_all_history", "tabs", undefined],
];

const FXVIEW_NEXT_ENABLED_PREF = "browser.tabs.firefox-view-next";
const NEVER_REMEMBER_HISTORY_PREF = "browser.privatebrowsing.autostart";
const DAY_MS = 24 * 60 * 60 * 1000;
const today = new Date();
Expand Down Expand Up @@ -153,10 +152,7 @@ async function addHistoryItems(dateAdded) {

add_setup(async () => {
await SpecialPowers.pushPrefEnv({
set: [
[FXVIEW_NEXT_ENABLED_PREF, true],
["browser.firefox-view.search.enabled", true],
],
set: [["browser.firefox-view.search.enabled", true]],
});
registerCleanupFunction(async () => {
await SpecialPowers.popPrefEnv();
Expand All @@ -174,7 +170,7 @@ add_task(async function test_list_ordering() {
await addHistoryItems(oneMonthAgo);
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
is(document.location.href, "about:firefoxview");

await navigateToCategoryAndWait(document, "history");

Expand Down Expand Up @@ -268,7 +264,7 @@ add_task(async function test_empty_states() {
await PlacesUtils.history.clear();
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
is(document.location.href, "about:firefoxview");

await navigateToCategoryAndWait(document, "history");

Expand Down Expand Up @@ -406,7 +402,7 @@ add_task(async function test_show_all_history_telemetry() {
await addHistoryItems(oneMonthAgo);
await withFirefoxView({}, async browser => {
const { document } = browser.contentWindow;
is(document.location.href, "about:firefoxview-next");
is(document.location.href, "about:firefoxview");

await navigateToCategoryAndWait(document, "history");

Expand Down
Loading

0 comments on commit cd901e4

Please sign in to comment.