mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Backed out changeset 91a18abcd0e2 (bug 1810739) for causing bc failures at browser_UsageTelemetry.js on a CLOSED TREE
This commit is contained in:
parent
73dfe7d3e8
commit
d4f69748d1
@ -29,7 +29,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
clearTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
setInterval: "resource://gre/modules/Timer.sys.mjs",
|
||||
setTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
@ -456,11 +455,6 @@ let BrowserUsageTelemetry = {
|
||||
() => this._recordContentProcessCount(),
|
||||
CONTENT_PROCESS_COUNT_INTERVAL_MS
|
||||
);
|
||||
|
||||
this._onTabsOpenedTask = new lazy.DeferredTask(
|
||||
this._onTabsOpened.bind(this),
|
||||
0
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -531,7 +525,7 @@ let BrowserUsageTelemetry = {
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "TabOpen":
|
||||
this._onTabOpen();
|
||||
this._onTabOpen(getOpenTabsAndWinsCounts());
|
||||
break;
|
||||
case "TabPinned":
|
||||
this._onTabPinned();
|
||||
@ -1032,22 +1026,11 @@ let BrowserUsageTelemetry = {
|
||||
|
||||
/**
|
||||
* Updates the tab counts.
|
||||
* @param {Object} [counts] The counts returned by `getOpenTabsAndWindowCounts`.
|
||||
*/
|
||||
_onTabOpen() {
|
||||
_onTabOpen({ tabCount, loadedTabCount }) {
|
||||
// Update the "tab opened" count and its maximum.
|
||||
Services.telemetry.scalarAdd(TAB_OPEN_EVENT_COUNT_SCALAR_NAME, 1);
|
||||
|
||||
// In the case of opening multiple tabs at once, avoid enumerating all open
|
||||
// tabs and windows each time a tab opens.
|
||||
this._onTabsOpenedTask.disarm();
|
||||
this._onTabsOpenedTask.arm();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update tab counts after opening multiple tabs.
|
||||
*/
|
||||
_onTabsOpened() {
|
||||
const { tabCount, loadedTabCount } = getOpenTabsAndWinsCounts();
|
||||
Services.telemetry.scalarSetMaximum(MAX_TAB_COUNT_SCALAR_NAME, tabCount);
|
||||
|
||||
this._recordTabCounts({ tabCount, loadedTabCount });
|
||||
|
@ -22,10 +22,6 @@ ChromeUtils.defineModuleGetter(
|
||||
"resource:///modules/BrowserUsageTelemetry.jsm"
|
||||
);
|
||||
|
||||
const { ObjectUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/ObjectUtils.jsm"
|
||||
);
|
||||
|
||||
// Reset internal URI counter in case URIs were opened by other tests.
|
||||
Services.obs.notifyObservers(null, TELEMETRY_SUBSESSION_TOPIC);
|
||||
|
||||
@ -487,8 +483,16 @@ add_task(async function test_loadedTabsHistogram() {
|
||||
];
|
||||
|
||||
// There are two tabs open: the mochi.test tab and the foreground tab.
|
||||
const snapshot = loadedTabCount.snapshot();
|
||||
checkTabCountHistogram(snapshot, { 1: 0, 2: 1, 3: 0 }, "TAB_COUNT - new tab");
|
||||
checkTabCountHistogram(
|
||||
tabCount.snapshot(),
|
||||
{ 1: 0, 2: 1, 3: 0 },
|
||||
"TAB_COUNT - new tab"
|
||||
);
|
||||
checkTabCountHistogram(
|
||||
loadedTabCount.snapshot(),
|
||||
{ 1: 0, 2: 1, 3: 0 },
|
||||
"TAB_COUNT - new tab"
|
||||
);
|
||||
|
||||
// Open a pending tab, as if by session restore.
|
||||
resetTimestamps();
|
||||
@ -497,10 +501,6 @@ add_task(async function test_loadedTabsHistogram() {
|
||||
});
|
||||
tabs.push(lazyTab);
|
||||
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => !ObjectUtils.deepEqual(snapshot, tabCount.snapshot())
|
||||
);
|
||||
|
||||
checkTabCountHistogram(
|
||||
tabCount.snapshot(),
|
||||
{ 1: 0, 2: 1, 3: 1, 4: 0 },
|
||||
|
Loading…
Reference in New Issue
Block a user