--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -22,37 +22,40 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "UITour",
"resource:///modules/UITour.jsm");
XPCOMUtils.defineLazyGetter(this, "Timer", function() {
let timer = {};
Cu.import("resource://gre/modules/Timer.jsm", timer);
return timer;
});
+XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure", "browser.photon.structure.enabled");
+
const MS_SECOND = 1000;
const MS_MINUTE = MS_SECOND * 60;
const MS_HOUR = MS_MINUTE * 60;
+const LEGACY_PANEL_PLACEMENTS = [
+ "edit-controls",
+ "zoom-controls",
+ "new-window-button",
+ "privatebrowsing-button",
+ "save-page-button",
+ "print-button",
+ "history-panelmenu",
+ "fullscreen-button",
+ "find-button",
+ "preferences-button",
+ "add-ons-button",
+ "sync-button",
+ "developer-button"
+];
+
XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREA_PLACEMENTS", function() {
let result = {
- "PanelUI-contents": [
- "edit-controls",
- "zoom-controls",
- "new-window-button",
- "privatebrowsing-button",
- "save-page-button",
- "print-button",
- "history-panelmenu",
- "fullscreen-button",
- "find-button",
- "preferences-button",
- "add-ons-button",
- "sync-button",
- "developer-button",
- ],
"nav-bar": [
"urlbar-container",
"search-container",
"bookmarks-menu-button",
"pocket-button",
"downloads-button",
"home-button",
"social-share-button",
@@ -68,27 +71,32 @@ XPCOMUtils.defineLazyGetter(this, "DEFAU
"new-tab-button",
"alltabs-button",
],
"PersonalToolbar": [
"personal-bookmarks",
],
};
- let showCharacterEncoding = Services.prefs.getComplexValue(
- "browser.menu.showCharacterEncoding",
- Ci.nsIPrefLocalizedString
- ).data;
- if (showCharacterEncoding == "true") {
- result["PanelUI-contents"].push("characterencoding-button");
- }
+ if (gPhotonStructure) {
+ result["widget-overflow-fixed-list"] = [];
+ } else {
+ result["PanelUI-contents"] = LEGACY_PANEL_PLACEMENTS;
+ let showCharacterEncoding = Services.prefs.getComplexValue(
+ "browser.menu.showCharacterEncoding",
+ Ci.nsIPrefLocalizedString
+ ).data;
+ if (showCharacterEncoding == "true") {
+ result["PanelUI-contents"].push("characterencoding-button");
+ }
- if (!AppConstants.RELEASE_OR_BETA) {
- if (Services.prefs.getBoolPref("extensions.webcompat-reporter.enabled")) {
- result["PanelUI-contents"].push("webcompat-reporter-button");
+ if (!AppConstants.RELEASE_OR_BETA) {
+ if (Services.prefs.getBoolPref("extensions.webcompat-reporter.enabled")) {
+ result["PanelUI-contents"].push("webcompat-reporter-button");
+ }
}
}
return result;
});
XPCOMUtils.defineLazyGetter(this, "DEFAULT_AREAS", function() {
return Object.keys(DEFAULT_AREA_PLACEMENTS);
@@ -99,17 +107,20 @@ XPCOMUtils.defineLazyGetter(this, "PALET
"open-file-button",
"developer-button",
"feed-button",
"email-link-button",
"containers-panelmenu",
];
let panelPlacements = DEFAULT_AREA_PLACEMENTS["PanelUI-contents"];
- if (panelPlacements.indexOf("characterencoding-button") == -1) {
+ if (!panelPlacements) {
+ result.push(... LEGACY_PANEL_PLACEMENTS);
+ }
+ if (!panelPlacements || !panelPlacements.includes("characterencoding-button")) {
result.push("characterencoding-button");
}
if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
result.push("panic-button");
}
return result;
@@ -463,34 +474,34 @@ this.BrowserUITelemetry = {
if (item.id == "bookmarks-menu-button" ||
getIDBasedOnFirstIDedAncestor(item) == "bookmarks-menu-button") {
this._bookmarksMenuButtonMouseUp(aEvent);
return;
}
// Perhaps we're seeing one of the default toolbar items
// being clicked.
- if (ALL_BUILTIN_ITEMS.indexOf(item.id) != -1) {
+ if (ALL_BUILTIN_ITEMS.includes(item.id)) {
// Base case - we clicked directly on one of our built-in items,
// and we can go ahead and register that click.
this._countMouseUpEvent("click-builtin-item", item.id, aEvent.button);
return;
}
// If not, we need to check if the item's anonid is in our list
// of built-in items to check.
- if (ALL_BUILTIN_ITEMS.indexOf(item.getAttribute("anonid")) != -1) {
+ if (ALL_BUILTIN_ITEMS.includes(item.getAttribute("anonid"))) {
this._countMouseUpEvent("click-builtin-item", item.getAttribute("anonid"), aEvent.button);
return;
}
// If not, we need to check if one of the ancestors of the clicked
// item is in our list of built-in items to check.
let candidate = getIDBasedOnFirstIDedAncestor(item);
- if (ALL_BUILTIN_ITEMS.indexOf(candidate) != -1) {
+ if (ALL_BUILTIN_ITEMS.includes(candidate)) {
this._countMouseUpEvent("click-builtin-item", candidate, aEvent.button);
}
},
_getWindowMeasurements(aWindow, searchResult) {
let document = aWindow.document;
let result = {};