diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 72dfd3738b71..9f22b5855e57 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4563,12 +4563,6 @@ function updateFileMenuUserContextUIVisibility(id) { menu.setAttribute("disabled", "true"); } } -function updateTabMenuUserContextUIVisibility(id) { - let menu = document.getElementById(id); - // Visibility of Tab menu item can change frequently. - menu.hidden = !Services.prefs.getBoolPref("privacy.userContext.enabled", false) || - PrivateBrowsingUtils.isWindowPrivate(window); -} /** * Updates the User Context UI indicators if the browser is in a non-default context @@ -4601,44 +4595,6 @@ function updateUserContextUIIndicator() { hbox.hidden = false; } -/** - * Fill 'Reopen in Container' menu. - */ -function createReopenInContainerMenu(event) { - let currentid = TabContextMenu.contextTab.getAttribute("usercontextid"); - - return createUserContextMenu(event, { - isContextMenu: true, - excludeUserContextId: currentid, - }); -} - -/** - * Reopen the tab in another container. - */ -function reopenInContainer(event) { - let userContextId = parseInt(event.target.getAttribute("data-usercontextid")); - let currentTab = TabContextMenu.contextTab; - let isSelected = (gBrowser.selectedTab == currentTab); - let uri = currentTab.linkedBrowser.currentURI.spec; - - let newTab = gBrowser.addTab(uri, { - userContextId, - pinned: currentTab.pinned, - index: currentTab._tPos + 1, - }); - - // Carry over some configuration. - if (isSelected) { - gBrowser.selectedTab = newTab; - } - if (currentTab.muted) { - if (!newTab.muted) { - newTab.toggleMuteAudio(currentTab.muteReason); - } - } -} - /** * Makes the Character Encoding menu enabled or disabled as appropriate. * To be called when the View menu or the app menu is opened. @@ -7843,136 +7799,6 @@ var MenuTouchModeObserver = { }, }; -var TabContextMenu = { - contextTab: null, - _updateToggleMuteMenuItems(aTab, aConditionFn) { - ["muted", "soundplaying"].forEach(attr => { - if (!aConditionFn || aConditionFn(attr)) { - if (aTab.hasAttribute(attr)) { - aTab.toggleMuteMenuItem.setAttribute(attr, "true"); - aTab.toggleMultiSelectMuteMenuItem.setAttribute(attr, "true"); - } else { - aTab.toggleMuteMenuItem.removeAttribute(attr); - aTab.toggleMultiSelectMuteMenuItem.removeAttribute(attr); - } - } - }); - }, - updateContextMenu: function updateContextMenu(aPopupMenu) { - this.contextTab = aPopupMenu.triggerNode.localName == "tab" ? - aPopupMenu.triggerNode : gBrowser.selectedTab; - let disabled = gBrowser.tabs.length == 1; - let multiselectionContext = this.contextTab.multiselected; - - var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple"); - for (let menuItem of menuItems) - menuItem.disabled = disabled; - - if (this.contextTab.hasAttribute("customizemode")) - document.getElementById("context_openTabInWindow").disabled = true; - - disabled = gBrowser.visibleTabs.length == 1; - menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple-visible"); - for (let menuItem of menuItems) - menuItem.disabled = disabled; - - // Session store - document.getElementById("context_undoCloseTab").disabled = - SessionStore.getClosedTabCount(window) == 0; - - // Only one of Reload_Tab/Reload_Selected_Tabs should be visible. - document.getElementById("context_reloadTab").hidden = multiselectionContext; - document.getElementById("context_reloadSelectedTabs").hidden = !multiselectionContext; - - // Only one of pin/unpin/multiselect-pin/multiselect-unpin should be visible - let contextPinTab = document.getElementById("context_pinTab"); - contextPinTab.hidden = this.contextTab.pinned || multiselectionContext; - let contextUnpinTab = document.getElementById("context_unpinTab"); - contextUnpinTab.hidden = !this.contextTab.pinned || multiselectionContext; - let contextPinSelectedTabs = document.getElementById("context_pinSelectedTabs"); - contextPinSelectedTabs.hidden = this.contextTab.pinned || !multiselectionContext; - let contextUnpinSelectedTabs = document.getElementById("context_unpinSelectedTabs"); - contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !multiselectionContext; - - // Disable "Close Tabs to the Right" if there are no tabs - // following it. - document.getElementById("context_closeTabsToTheEnd").disabled = - gBrowser.getTabsToTheEndFrom(this.contextTab).length == 0; - - // Disable "Close other Tabs" if there are no unpinned tabs. - let unpinnedTabsToClose = gBrowser.visibleTabs.length - gBrowser._numPinnedTabs; - if (!this.contextTab.pinned) { - unpinnedTabsToClose--; - } - document.getElementById("context_closeOtherTabs").disabled = unpinnedTabsToClose < 1; - - // Only one of close_tab/close_selected_tabs should be visible - document.getElementById("context_closeTab").hidden = multiselectionContext; - document.getElementById("context_closeSelectedTabs").hidden = !multiselectionContext; - - // Hide "Bookmark All Tabs" for a pinned tab. Update its state if visible. - let bookmarkAllTabs = document.getElementById("context_bookmarkAllTabs"); - bookmarkAllTabs.hidden = this.contextTab.pinned; - if (!bookmarkAllTabs.hidden) - PlacesCommandHook.updateBookmarkAllTabsCommand(); - - let toggleMute = document.getElementById("context_toggleMuteTab"); - let toggleMultiSelectMute = document.getElementById("context_toggleMuteSelectedTabs"); - - // Only one of mute_unmute_tab/mute_unmute_selected_tabs should be visible - toggleMute.hidden = multiselectionContext; - toggleMultiSelectMute.hidden = !multiselectionContext; - - // Adjust the state of the toggle mute menu item. - if (this.contextTab.hasAttribute("activemedia-blocked")) { - toggleMute.label = gNavigatorBundle.getString("playTab.label"); - toggleMute.accessKey = gNavigatorBundle.getString("playTab.accesskey"); - } else if (this.contextTab.hasAttribute("muted")) { - toggleMute.label = gNavigatorBundle.getString("unmuteTab.label"); - toggleMute.accessKey = gNavigatorBundle.getString("unmuteTab.accesskey"); - } else { - toggleMute.label = gNavigatorBundle.getString("muteTab.label"); - toggleMute.accessKey = gNavigatorBundle.getString("muteTab.accesskey"); - } - - // Adjust the state of the toggle mute menu item for multi-selected tabs. - if (this.contextTab.hasAttribute("activemedia-blocked")) { - toggleMultiSelectMute.label = gNavigatorBundle.getString("playTabs.label"); - toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("playTabs.accesskey"); - } else if (this.contextTab.hasAttribute("muted")) { - toggleMultiSelectMute.label = gNavigatorBundle.getString("unmuteSelectedTabs.label"); - toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("unmuteSelectedTabs.accesskey"); - } else { - toggleMultiSelectMute.label = gNavigatorBundle.getString("muteSelectedTabs.label"); - toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("muteSelectedTabs.accesskey"); - } - - this.contextTab.toggleMuteMenuItem = toggleMute; - this.contextTab.toggleMultiSelectMuteMenuItem = toggleMultiSelectMute; - this._updateToggleMuteMenuItems(this.contextTab); - - this.contextTab.addEventListener("TabAttrModified", this); - aPopupMenu.addEventListener("popuphiding", this); - - gSync.updateTabContextMenu(aPopupMenu, this.contextTab); - - updateTabMenuUserContextUIVisibility("context_reopenInContainer"); - }, - handleEvent(aEvent) { - switch (aEvent.type) { - case "popuphiding": - gBrowser.removeEventListener("TabAttrModified", this); - aEvent.target.removeEventListener("popuphiding", this); - break; - case "TabAttrModified": - let tab = aEvent.target; - this._updateToggleMuteMenuItems(tab, - attr => aEvent.detail.changed.includes(attr)); - break; - } - } -}; - // Prompt user to restart the browser in safe mode function safeModeRestart() { if (Services.appinfo.inSafeMode) { diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 8397e1a6873a..922efe9732c6 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -114,8 +114,8 @@ label="&reopenInContainer.label;" accesskey="&reopenInContainer.accesskey;" hidden="true"> - + { + if (!aConditionFn || aConditionFn(attr)) { + if (aTab.hasAttribute(attr)) { + aTab.toggleMuteMenuItem.setAttribute(attr, "true"); + aTab.toggleMultiSelectMuteMenuItem.setAttribute(attr, "true"); + } else { + aTab.toggleMuteMenuItem.removeAttribute(attr); + aTab.toggleMultiSelectMuteMenuItem.removeAttribute(attr); + } + } + }); + }, + updateContextMenu(aPopupMenu) { + this.contextTab = aPopupMenu.triggerNode.localName == "tab" ? + aPopupMenu.triggerNode : gBrowser.selectedTab; + let disabled = gBrowser.tabs.length == 1; + let multiselectionContext = this.contextTab.multiselected; + + var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple"); + for (let menuItem of menuItems) { + menuItem.disabled = disabled; + } + + if (this.contextTab.hasAttribute("customizemode")) { + document.getElementById("context_openTabInWindow").disabled = true; + } + + disabled = gBrowser.visibleTabs.length == 1; + menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple-visible"); + for (let menuItem of menuItems) { + menuItem.disabled = disabled; + } + + // Session store + document.getElementById("context_undoCloseTab").disabled = + SessionStore.getClosedTabCount(window) == 0; + + // Only one of Reload_Tab/Reload_Selected_Tabs should be visible. + document.getElementById("context_reloadTab").hidden = multiselectionContext; + document.getElementById("context_reloadSelectedTabs").hidden = !multiselectionContext; + + // Only one of pin/unpin/multiselect-pin/multiselect-unpin should be visible + let contextPinTab = document.getElementById("context_pinTab"); + contextPinTab.hidden = this.contextTab.pinned || multiselectionContext; + let contextUnpinTab = document.getElementById("context_unpinTab"); + contextUnpinTab.hidden = !this.contextTab.pinned || multiselectionContext; + let contextPinSelectedTabs = document.getElementById("context_pinSelectedTabs"); + contextPinSelectedTabs.hidden = this.contextTab.pinned || !multiselectionContext; + let contextUnpinSelectedTabs = document.getElementById("context_unpinSelectedTabs"); + contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !multiselectionContext; + + // Disable "Close Tabs to the Right" if there are no tabs + // following it. + document.getElementById("context_closeTabsToTheEnd").disabled = + gBrowser.getTabsToTheEndFrom(this.contextTab).length == 0; + + // Disable "Close other Tabs" if there are no unpinned tabs. + let unpinnedTabsToClose = gBrowser.visibleTabs.length - gBrowser._numPinnedTabs; + if (!this.contextTab.pinned) { + unpinnedTabsToClose--; + } + document.getElementById("context_closeOtherTabs").disabled = unpinnedTabsToClose < 1; + + // Only one of close_tab/close_selected_tabs should be visible + document.getElementById("context_closeTab").hidden = multiselectionContext; + document.getElementById("context_closeSelectedTabs").hidden = !multiselectionContext; + + // Hide "Bookmark All Tabs" for a pinned tab. Update its state if visible. + let bookmarkAllTabs = document.getElementById("context_bookmarkAllTabs"); + bookmarkAllTabs.hidden = this.contextTab.pinned; + if (!bookmarkAllTabs.hidden) { + PlacesCommandHook.updateBookmarkAllTabsCommand(); + } + + let toggleMute = document.getElementById("context_toggleMuteTab"); + let toggleMultiSelectMute = document.getElementById("context_toggleMuteSelectedTabs"); + + // Only one of mute_unmute_tab/mute_unmute_selected_tabs should be visible + toggleMute.hidden = multiselectionContext; + toggleMultiSelectMute.hidden = !multiselectionContext; + + // Adjust the state of the toggle mute menu item. + if (this.contextTab.hasAttribute("activemedia-blocked")) { + toggleMute.label = gNavigatorBundle.getString("playTab.label"); + toggleMute.accessKey = gNavigatorBundle.getString("playTab.accesskey"); + } else if (this.contextTab.hasAttribute("muted")) { + toggleMute.label = gNavigatorBundle.getString("unmuteTab.label"); + toggleMute.accessKey = gNavigatorBundle.getString("unmuteTab.accesskey"); + } else { + toggleMute.label = gNavigatorBundle.getString("muteTab.label"); + toggleMute.accessKey = gNavigatorBundle.getString("muteTab.accesskey"); + } + + // Adjust the state of the toggle mute menu item for multi-selected tabs. + if (this.contextTab.hasAttribute("activemedia-blocked")) { + toggleMultiSelectMute.label = gNavigatorBundle.getString("playTabs.label"); + toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("playTabs.accesskey"); + } else if (this.contextTab.hasAttribute("muted")) { + toggleMultiSelectMute.label = gNavigatorBundle.getString("unmuteSelectedTabs.label"); + toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("unmuteSelectedTabs.accesskey"); + } else { + toggleMultiSelectMute.label = gNavigatorBundle.getString("muteSelectedTabs.label"); + toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("muteSelectedTabs.accesskey"); + } + + this.contextTab.toggleMuteMenuItem = toggleMute; + this.contextTab.toggleMultiSelectMuteMenuItem = toggleMultiSelectMute; + this._updateToggleMuteMenuItems(this.contextTab); + + this.contextTab.addEventListener("TabAttrModified", this); + aPopupMenu.addEventListener("popuphiding", this); + + gSync.updateTabContextMenu(aPopupMenu, this.contextTab); + + document.getElementById("context_reopenInContainer").hidden = + !Services.prefs.getBoolPref("privacy.userContext.enabled", false) || + PrivateBrowsingUtils.isWindowPrivate(window); + }, + handleEvent(aEvent) { + switch (aEvent.type) { + case "popuphiding": + gBrowser.removeEventListener("TabAttrModified", this); + aEvent.target.removeEventListener("popuphiding", this); + break; + case "TabAttrModified": + let tab = aEvent.target; + this._updateToggleMuteMenuItems(tab, + attr => aEvent.detail.changed.includes(attr)); + break; + } + }, + createReopenInContainerMenu(event) { + createUserContextMenu(event, { + isContextMenu: true, + excludeUserContextId: this.contextTab.getAttribute("usercontextid"), + }); + }, + reopenInContainer(event) { + let newTab = gBrowser.addTab(this.contextTab.linkedBrowser.currentURI.spec, { + userContextId: parseInt(event.target.getAttribute("data-usercontextid")), + pinned: this.contextTab.pinned, + index: this.contextTab._tPos + 1, + }); + + if (gBrowser.selectedTab == this.contextTab) { + gBrowser.selectedTab = newTab; + } + if (this.contextTab.muted) { + if (!newTab.muted) { + newTab.toggleMuteAudio(this.contextTab.muteReason); + } + } + } +}; + diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 158a47f18728..5e42159ca9f6 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -56,10 +56,8 @@ // Ignore overflow events: // - from nested scrollable elements // - for vertical orientation - // - when the window is tiny initially if (event.originalTarget != this._scrollbox || - event.detail == 0 || - window.outerWidth <= 1) { + event.detail == 0) { return; } diff --git a/browser/base/content/test/sync/browser_contextmenu_sendtab.js b/browser/base/content/test/sync/browser_contextmenu_sendtab.js index e2839dc6cc6c..09e3866ca9ff 100644 --- a/browser/base/content/test/sync/browser_contextmenu_sendtab.js +++ b/browser/base/content/test/sync/browser_contextmenu_sendtab.js @@ -18,7 +18,7 @@ function updateTabContextMenu(tab) { var evt = new Event(""); tab.dispatchEvent(evt); menu.openPopup(tab, "end_after", 0, 0, true, false, evt); - is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab"); + is(window.TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab"); menu.hidePopup(); } diff --git a/browser/base/content/test/tabs/head.js b/browser/base/content/test/tabs/head.js index 8858dc9d5d60..8e4fd7d0509c 100644 --- a/browser/base/content/test/tabs/head.js +++ b/browser/base/content/test/tabs/head.js @@ -5,7 +5,7 @@ function updateTabContextMenu(tab) { var evt = new Event(""); tab.dispatchEvent(evt); menu.openPopup(tab, "end_after", 0, 0, true, false, evt); - is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab"); + is(window.TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab"); menu.hidePopup(); } diff --git a/js/xpconnect/tests/unit/head_watchdog.js b/js/xpconnect/tests/unit/head_watchdog.js index 90abfb133a47..274a2fabe9a9 100644 --- a/js/xpconnect/tests/unit/head_watchdog.js +++ b/js/xpconnect/tests/unit/head_watchdog.js @@ -65,29 +65,33 @@ function executeSoon(fn) { // We wait 3 seconds, just to be safe. // -function checkWatchdog(expectInterrupt, continuation) { +function checkWatchdog(expectInterrupt) { var oldTimeout = setScriptTimeout(1); var lastWatchdogWakeup = Cu.getWatchdogTimestamp("WatchdogWakeup"); - setInterruptCallback(function() { - // If the watchdog didn't actually trigger the operation callback, ignore - // this call. This allows us to test the actual watchdog behavior without - // interference from other sites where we trigger the operation callback. - if (lastWatchdogWakeup == Cu.getWatchdogTimestamp("WatchdogWakeup")) { - return true; - } - Assert.ok(expectInterrupt); - setInterruptCallback(undefined); - setScriptTimeout(oldTimeout); - // Schedule our continuation before we kill this script. - executeSoon(continuation); - return false; - }); - executeSoon(function() { - busyWait(3000); - Assert.ok(!expectInterrupt); - setInterruptCallback(undefined); - setScriptTimeout(oldTimeout); - continuation(); + + return new Promise(resolve => { + setInterruptCallback(function() { + // If the watchdog didn't actually trigger the operation callback, ignore + // this call. This allows us to test the actual watchdog behavior without + // interference from other sites where we trigger the operation callback. + if (lastWatchdogWakeup == Cu.getWatchdogTimestamp("WatchdogWakeup")) { + return true; + } + Assert.ok(expectInterrupt, "Interrupt callback fired"); + setInterruptCallback(undefined); + setScriptTimeout(oldTimeout); + // Schedule the promise for resolution before we kill this script. + executeSoon(resolve); + return false; + }); + + executeSoon(function() { + busyWait(3000); + Assert.ok(!expectInterrupt, "Interrupt callback didn't fire"); + setInterruptCallback(undefined); + setScriptTimeout(oldTimeout); + resolve(); + }); }); } diff --git a/js/xpconnect/tests/unit/test_watchdog_default.js b/js/xpconnect/tests/unit/test_watchdog_default.js index 75e8f0e7632b..4634184f3c40 100644 --- a/js/xpconnect/tests/unit/test_watchdog_default.js +++ b/js/xpconnect/tests/unit/test_watchdog_default.js @@ -2,8 +2,8 @@ * 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/. */ -async function testBody() { +function testBody() { // Check that we properly implement whatever behavior is specified by the // default profile for this configuration. - await checkWatchdog(isWatchdogEnabled()); + return checkWatchdog(isWatchdogEnabled()); } diff --git a/js/xpconnect/tests/unit/test_watchdog_disable.js b/js/xpconnect/tests/unit/test_watchdog_disable.js index 45837dabaf5b..926edf2ffa1f 100644 --- a/js/xpconnect/tests/unit/test_watchdog_disable.js +++ b/js/xpconnect/tests/unit/test_watchdog_disable.js @@ -2,7 +2,7 @@ * 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/. */ -async function testBody() { +function testBody() { setWatchdogEnabled(false); - await checkWatchdog(false); + return checkWatchdog(false); } diff --git a/js/xpconnect/tests/unit/test_watchdog_enable.js b/js/xpconnect/tests/unit/test_watchdog_enable.js index 234e7d76a49c..f39757dfae95 100644 --- a/js/xpconnect/tests/unit/test_watchdog_enable.js +++ b/js/xpconnect/tests/unit/test_watchdog_enable.js @@ -2,7 +2,7 @@ * 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/. */ -async function testBody() { +function testBody() { setWatchdogEnabled(true); - await checkWatchdog(true); + return checkWatchdog(true); } diff --git a/js/xpconnect/tests/unit/test_watchdog_hibernate.js b/js/xpconnect/tests/unit/test_watchdog_hibernate.js index 44e141c8e056..1207e6ff5c98 100644 --- a/js/xpconnect/tests/unit/test_watchdog_hibernate.js +++ b/js/xpconnect/tests/unit/test_watchdog_hibernate.js @@ -15,8 +15,8 @@ async function testBody() { do_log_info("now: " + now / 1000000); do_log_info("startHibernation: " + startHibernation / 1000000); do_log_info("stopHibernation: " + stopHibernation / 1000000); - Assert.ok(startHibernation < now); - Assert.ok(stopHibernation < now); + Assert.ok(startHibernation < now, "startHibernation ok"); + Assert.ok(stopHibernation < now, "stopHibernation ok"); // When the watchdog runs, it hibernates if there's been no activity for the // last 2 seconds, otherwise it sleeps for 1 second. As such, given perfect @@ -44,8 +44,8 @@ async function testBody() { // making sure this behavior is roughly as expected on the macro scale, // so we add a 1 second fuzz factor here. const FUZZ_FACTOR = 1 * 1000 * 1000; - Assert.ok(stateChange > now + 10*1000*1000 - FUZZ_FACTOR); - Assert.ok(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR); - Assert.ok(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR); - Assert.ok(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR); + Assert.ok(stateChange > now + 10*1000*1000 - FUZZ_FACTOR, "stateChange ok"); + Assert.ok(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR, "startHibernation ok"); + Assert.ok(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR, "startHibernation ok"); + Assert.ok(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR, "stopHibernation ok"); } diff --git a/js/xpconnect/tests/unit/test_watchdog_toggle.js b/js/xpconnect/tests/unit/test_watchdog_toggle.js index 1b2c90df9d03..6f43a8b876b9 100644 --- a/js/xpconnect/tests/unit/test_watchdog_toggle.js +++ b/js/xpconnect/tests/unit/test_watchdog_toggle.js @@ -2,9 +2,9 @@ * 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/. */ -async function testBody() { +function testBody() { var defaultBehavior = isWatchdogEnabled(); setWatchdogEnabled(!defaultBehavior); setWatchdogEnabled(defaultBehavior); - await checkWatchdog(defaultBehavior); + return checkWatchdog(defaultBehavior); } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index f22dde175fd5..53af15c8b996 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -9838,6 +9838,8 @@ PaintTelemetry::AutoRecordPaint::~AutoRecordPaint() recordSmall(NS_LITERAL_CSTRING("fr"), frMs); recordSmall(NS_LITERAL_CSTRING("r"), rMs); } + + Telemetry::Accumulate(Telemetry::PAINT_BUILD_LAYERS_TIME, flbMs); } PaintTelemetry::AutoRecord::AutoRecord(Metric aMetric) diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index c91d54ad2094..924a7883ac98 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -3381,6 +3381,16 @@ "high": 1000, "n_buckets": 50 }, + "PAINT_BUILD_LAYERS_TIME" : { + "record_in_processes": ["content"], + "alert_emails": ["gfx-telemetry-alerts@mozilla.com","mwoodrow@mozilla.com"], + "bug_numbers": [1473908], + "expires_in_version": "never", + "description": "Time spent in building layers in milliseconds", + "kind": "exponential", + "high": 1000, + "n_buckets": 50 + }, "PAINT_RASTERIZE_TIME" : { "record_in_processes": ["main", "content"], "expires_in_version": "never", diff --git a/toolkit/content/widgets/scrollbox.xml b/toolkit/content/widgets/scrollbox.xml index 8dbca4e97731..ac669b6eaee7 100644 --- a/toolkit/content/widgets/scrollbox.xml +++ b/toolkit/content/widgets/scrollbox.xml @@ -570,9 +570,7 @@