/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ /* 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/. */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { ClientID: "resource://gre/modules/ClientID.sys.mjs", CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs", DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", PageActions: "resource:///modules/PageActions.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", SearchSERPTelemetry: "resource:///modules/SearchSERPTelemetry.sys.mjs", SearchSERPTelemetryUtils: "resource:///modules/SearchSERPTelemetry.sys.mjs", WindowsInstallsInfo: "resource://gre/modules/components-utils/WindowsInstallsInfo.sys.mjs", clearTimeout: "resource://gre/modules/Timer.sys.mjs", setTimeout: "resource://gre/modules/Timer.sys.mjs", }); // This pref is in seconds! XPCOMUtils.defineLazyPreferenceGetter( lazy, "gRecentVisitedOriginsExpiry", "browser.engagement.recent_visited_origins.expiry" ); // The upper bound for the count of the visited unique domain names. const MAX_UNIQUE_VISITED_DOMAINS = 100; // Observed topic names. const TAB_RESTORING_TOPIC = "SSTabRestoring"; const TELEMETRY_SUBSESSIONSPLIT_TOPIC = "internal-telemetry-after-subsession-split"; const DOMWINDOW_OPENED_TOPIC = "domwindowopened"; // Probe names. const MAX_TAB_COUNT_SCALAR_NAME = "browser.engagement.max_concurrent_tab_count"; const MAX_WINDOW_COUNT_SCALAR_NAME = "browser.engagement.max_concurrent_window_count"; const TAB_OPEN_EVENT_COUNT_SCALAR_NAME = "browser.engagement.tab_open_event_count"; const MAX_TAB_PINNED_COUNT_SCALAR_NAME = "browser.engagement.max_concurrent_tab_pinned_count"; const TAB_PINNED_EVENT_COUNT_SCALAR_NAME = "browser.engagement.tab_pinned_event_count"; const WINDOW_OPEN_EVENT_COUNT_SCALAR_NAME = "browser.engagement.window_open_event_count"; const UNIQUE_DOMAINS_COUNT_SCALAR_NAME = "browser.engagement.unique_domains_count"; const TOTAL_URI_COUNT_SCALAR_NAME = "browser.engagement.total_uri_count"; const UNFILTERED_URI_COUNT_SCALAR_NAME = "browser.engagement.unfiltered_uri_count"; const TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE_SCALAR_NAME = "browser.engagement.total_uri_count_normal_and_private_mode"; export const MINIMUM_TAB_COUNT_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes, in ms // The elements we consider to be interactive. const UI_TARGET_ELEMENTS = [ "menuitem", "toolbarbutton", "key", "command", "checkbox", "input", "button", "image", "radio", "richlistitem", ]; // The containers of interactive elements that we care about and their pretty // names. These should be listed in order of most-specific to least-specific, // when iterating JavaScript will guarantee that ordering and so we will find // the most specific area first. const BROWSER_UI_CONTAINER_IDS = { "toolbar-menubar": "menu-bar", TabsToolbar: "tabs-bar", PersonalToolbar: "bookmarks-bar", "appMenu-popup": "app-menu", tabContextMenu: "tabs-context", contentAreaContextMenu: "content-context", "widget-overflow-list": "overflow-menu", "widget-overflow-fixed-list": "pinned-overflow-menu", "page-action-buttons": "pageaction-urlbar", pageActionPanel: "pageaction-panel", "unified-extensions-area": "unified-extensions-area", "allTabsMenu-allTabsView": "alltabs-menu", // This should appear last as some of the above are inside the nav bar. "nav-bar": "nav-bar", }; const ENTRYPOINT_TRACKED_CONTEXT_MENU_IDS = { [BROWSER_UI_CONTAINER_IDS.tabContextMenu]: "tabs-context-entrypoint", }; // A list of the expected panes in about:preferences const PREFERENCES_PANES = [ "paneHome", "paneGeneral", "panePrivacy", "paneSearch", "paneSearchResults", "paneSync", "paneContainers", "paneExperimental", "paneMoreFromMozilla", ]; const IGNORABLE_EVENTS = new WeakMap(); const KNOWN_ADDONS = []; // Buttons that, when clicked, set a preference to true. The convention // is that the preference is named: // // browser.engagement.