diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 031c1efc684d..4cab7eea9230 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4992,7 +4992,7 @@ var CombinedStopReload = { }, switchToStop(aRequest, aWebProgress) { - if (!this._initialized) + if (!this._initialized || !this._shouldSwitch(aRequest)) return; let shouldAnimate = AppConstants.MOZ_PHOTON_ANIMATIONS && @@ -5010,7 +5010,8 @@ var CombinedStopReload = { }, switchToReload(aRequest, aWebProgress) { - if (!this._initialized) + if (!this._initialized || !this._shouldSwitch(aRequest) || + !this.reload.hasAttribute("displaystop")) return; let shouldAnimate = AppConstants.MOZ_PHOTON_ANIMATIONS && @@ -5047,6 +5048,19 @@ var CombinedStopReload = { }, 650, this); }, + _shouldSwitch(aRequest) { + if (!aRequest || + !aRequest.originalURI || + aRequest.originalURI.spec.startsWith("about:reader")) + return true; + + if (aRequest.originalURI.schemeIs("chrome") || + aRequest.originalURI.schemeIs("about")) + return false; + + return true; + }, + _cancelTransition() { if (this._timer) { clearTimeout(this._timer); diff --git a/browser/base/content/test/about/.eslintrc.js b/browser/base/content/test/about/.eslintrc.js new file mode 100644 index 000000000000..b1c842d8a6db --- /dev/null +++ b/browser/base/content/test/about/.eslintrc.js @@ -0,0 +1,7 @@ +"use strict"; + +module.exports = { + "extends": [ + "plugin:mozilla/browser-test" + ] +}; diff --git a/browser/base/content/test/about/POSTSearchEngine.xml b/browser/base/content/test/about/POSTSearchEngine.xml new file mode 100644 index 000000000000..f2f884cf5120 --- /dev/null +++ b/browser/base/content/test/about/POSTSearchEngine.xml @@ -0,0 +1,6 @@ + + POST Search + + + + diff --git a/browser/base/content/test/general/aboutHome_content_script.js b/browser/base/content/test/about/aboutHome_content_script.js similarity index 100% rename from browser/base/content/test/general/aboutHome_content_script.js rename to browser/base/content/test/about/aboutHome_content_script.js diff --git a/browser/base/content/test/about/browser.ini b/browser/base/content/test/about/browser.ini new file mode 100644 index 000000000000..0c398e8337b5 --- /dev/null +++ b/browser/base/content/test/about/browser.ini @@ -0,0 +1,21 @@ +[DEFAULT] +support-files = + aboutHome_content_script.js + head.js + healthreport_pingData.js + healthreport_testRemoteCommands.html + print_postdata.sjs + searchSuggestionEngine.sjs + searchSuggestionEngine.xml + test_bug959531.html + POSTSearchEngine.xml + +[browser_aboutCertError.js] +[browser_aboutStopReload.js] +[browser_aboutNetError.js] +[browser_aboutSupport.js] +[browser_aboutSupport_newtab_security_state.js] +[browser_aboutHealthReport.js] +skip-if = os == "linux" # Bug 924307 +[browser_aboutHome.js] +[browser_aboutHome_wrapsCorrectly.js] diff --git a/browser/base/content/test/general/browser_aboutCertError.js b/browser/base/content/test/about/browser_aboutCertError.js similarity index 100% rename from browser/base/content/test/general/browser_aboutCertError.js rename to browser/base/content/test/about/browser_aboutCertError.js diff --git a/browser/base/content/test/general/browser_aboutHealthReport.js b/browser/base/content/test/about/browser_aboutHealthReport.js similarity index 98% rename from browser/base/content/test/general/browser_aboutHealthReport.js rename to browser/base/content/test/about/browser_aboutHealthReport.js index 7954ceb24b55..9fb519da80ea 100644 --- a/browser/base/content/test/general/browser_aboutHealthReport.js +++ b/browser/base/content/test/about/browser_aboutHealthReport.js @@ -3,8 +3,8 @@ */ -const CHROME_BASE = "chrome://mochitests/content/browser/browser/base/content/test/general/"; -const HTTPS_BASE = "https://example.com/browser/browser/base/content/test/general/"; +const CHROME_BASE = "chrome://mochitests/content/browser/browser/base/content/test/about/"; +const HTTPS_BASE = "https://example.com/browser/browser/base/content/test/about/"; const TELEMETRY_LOG_PREF = "toolkit.telemetry.log.level"; const telemetryOriginalLogPref = Preferences.get(TELEMETRY_LOG_PREF, null); diff --git a/browser/base/content/test/general/browser_aboutHome.js b/browser/base/content/test/about/browser_aboutHome.js similarity index 99% rename from browser/base/content/test/general/browser_aboutHome.js rename to browser/base/content/test/about/browser_aboutHome.js index f13c928181be..bee48298d827 100644 --- a/browser/base/content/test/general/browser_aboutHome.js +++ b/browser/base/content/test/about/browser_aboutHome.js @@ -12,7 +12,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); const TEST_CONTENT_HELPER = "chrome://mochitests/content/browser/browser/base/" + - "content/test/general/aboutHome_content_script.js"; + "content/test/about/aboutHome_content_script.js"; var gRightsVersion = Services.prefs.getIntPref("browser.rights.version"); registerCleanupFunction(function() { @@ -269,7 +269,7 @@ add_task(async function() { resolve(); }; Services.obs.addObserver(searchObserver, "browser-search-engine-modified"); - Services.search.addEngine("http://test:80/browser/browser/base/content/test/general/POSTSearchEngine.xml", + Services.search.addEngine("http://test:80/browser/browser/base/content/test/about/POSTSearchEngine.xml", null, null, false); }); }); @@ -280,7 +280,7 @@ add_task(async function() { await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) { let promise = BrowserTestUtils.browserLoaded(browser); - browser.loadURI("https://example.com/browser/browser/base/content/test/general/test_bug959531.html"); + browser.loadURI("https://example.com/browser/browser/base/content/test/about/test_bug959531.html"); await promise; await ContentTask.spawn(browser, null, async function() { diff --git a/browser/base/content/test/general/browser_aboutHome_wrapsCorrectly.js b/browser/base/content/test/about/browser_aboutHome_wrapsCorrectly.js similarity index 100% rename from browser/base/content/test/general/browser_aboutHome_wrapsCorrectly.js rename to browser/base/content/test/about/browser_aboutHome_wrapsCorrectly.js diff --git a/browser/base/content/test/general/browser_aboutNetError.js b/browser/base/content/test/about/browser_aboutNetError.js similarity index 100% rename from browser/base/content/test/general/browser_aboutNetError.js rename to browser/base/content/test/about/browser_aboutNetError.js diff --git a/browser/base/content/test/about/browser_aboutStopReload.js b/browser/base/content/test/about/browser_aboutStopReload.js new file mode 100644 index 000000000000..c7fb45284c9d --- /dev/null +++ b/browser/base/content/test/about/browser_aboutStopReload.js @@ -0,0 +1,90 @@ +async function waitForNoAnimation(elt) { + return BrowserTestUtils.waitForCondition(() => !elt.hasAttribute("animate")); +} + +async function getAnimatePromise(elt) { + return BrowserTestUtils.waitForAttribute("animate", elt) + .then(() => Assert.ok(true, `${elt.id} should animate`)); +} + +function stopReloadMutationCallback() { + Assert.ok(false, "stop-reload's animate attribute should not have been mutated"); +} + +add_task(async function checkDontShowStopOnNewTab() { + let stopReloadContainer = document.getElementById("stop-reload-button"); + let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback); + + await waitForNoAnimation(stopReloadContainer); + stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]}); + let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser, + opening: "about:home", + waitForStateStop: true}); + await BrowserTestUtils.removeTab(tab); + + Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI on new tab"); + stopReloadContainerObserver.disconnect(); +}); + +add_task(async function checkDontShowStopFromLocalURI() { + let stopReloadContainer = document.getElementById("stop-reload-button"); + let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback); + + let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser, + opening: "about:home", + waitForStateStop: true}); + await waitForNoAnimation(stopReloadContainer); + stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]}); + await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla"); + await BrowserTestUtils.removeTab(tab); + + Assert.ok(true, "Test finished: stop-reload does not animate when navigating between local URIs"); + stopReloadContainerObserver.disconnect(); +}); + +add_task(async function checkDontShowStopFromNonLocalURI() { + let stopReloadContainer = document.getElementById("stop-reload-button"); + let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback); + + let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser, + opening: "https://example.com", + waitForStateStop: true}); + await waitForNoAnimation(stopReloadContainer); + stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]}); + await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla"); + await BrowserTestUtils.removeTab(tab); + + Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI from non-local URI"); + stopReloadContainerObserver.disconnect(); +}); + +add_task(async function checkDoShowStopOnNewTab() { + let stopReloadContainer = document.getElementById("stop-reload-button"); + let animatePromise = getAnimatePromise(stopReloadContainer); + + await waitForNoAnimation(stopReloadContainer); + let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser, + opening: "https://example.com", + waitForStateStop: true}); + await animatePromise; + await waitForNoAnimation(stopReloadContainer); + await BrowserTestUtils.removeTab(tab); + + info("Test finished: stop-reload animates when navigating to non-local URI on new tab"); +}); + +add_task(async function checkDoShowStopFromLocalURI() { + let stopReloadContainer = document.getElementById("stop-reload-button"); + + await waitForNoAnimation(stopReloadContainer); + let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser, + opening: "about:home", + waitForStateStop: true}); + let animatePromise = getAnimatePromise(stopReloadContainer); + BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com"); + await animatePromise; + await waitForNoAnimation(stopReloadContainer); + await BrowserTestUtils.removeTab(tab); + + info("Test finished: stop-reload animates when navigating local URI from non-local URI"); +}); diff --git a/browser/base/content/test/general/browser_aboutSupport.js b/browser/base/content/test/about/browser_aboutSupport.js similarity index 100% rename from browser/base/content/test/general/browser_aboutSupport.js rename to browser/base/content/test/about/browser_aboutSupport.js diff --git a/browser/base/content/test/general/browser_aboutSupport_newtab_security_state.js b/browser/base/content/test/about/browser_aboutSupport_newtab_security_state.js similarity index 100% rename from browser/base/content/test/general/browser_aboutSupport_newtab_security_state.js rename to browser/base/content/test/about/browser_aboutSupport_newtab_security_state.js diff --git a/browser/base/content/test/about/head.js b/browser/base/content/test/about/head.js new file mode 100644 index 000000000000..5906e0b910ec --- /dev/null +++ b/browser/base/content/test/about/head.js @@ -0,0 +1,155 @@ +/* eslint-env mozilla/frame-script */ + +function waitForCondition(condition, nextTest, errorMsg, retryTimes) { + retryTimes = typeof retryTimes !== "undefined" ? retryTimes : 30; + var tries = 0; + var interval = setInterval(function() { + if (tries >= retryTimes) { + ok(false, errorMsg); + moveOn(); + } + var conditionPassed; + try { + conditionPassed = condition(); + } catch (e) { + ok(false, e + "\n" + e.stack); + conditionPassed = false; + } + if (conditionPassed) { + moveOn(); + } + tries++; + }, 100); + var moveOn = function() { clearInterval(interval); nextTest(); }; +} + +function promiseWaitForCondition(aConditionFn) { + return new Promise(resolve => { + waitForCondition(aConditionFn, resolve, "Condition didn't pass."); + }); +} + +function whenTabLoaded(aTab, aCallback) { + promiseTabLoadEvent(aTab).then(aCallback); +} + +function promiseTabLoaded(aTab) { + return new Promise(resolve => { + whenTabLoaded(aTab, resolve); + }); +} + +/** + * Waits for a load (or custom) event to finish in a given tab. If provided + * load an uri into the tab. + * + * @param tab + * The tab to load into. + * @param [optional] url + * The url to load, or the current url. + * @return {Promise} resolved when the event is handled. + * @resolves to the received event + * @rejects if a valid load event is not received within a meaningful interval + */ +function promiseTabLoadEvent(tab, url) { + info("Wait tab event: load"); + + function handle(loadedUrl) { + if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) { + info(`Skipping spurious load event for ${loadedUrl}`); + return false; + } + + info("Tab event received: load"); + return true; + } + + let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle); + + if (url) + BrowserTestUtils.loadURI(tab.linkedBrowser, url); + + return loaded; +} + +/** + * Waits for the next top-level document load in the current browser. The URI + * of the document is compared against aExpectedURL. The load is then stopped + * before it actually starts. + * + * @param aExpectedURL + * The URL of the document that is expected to load. + * @param aStopFromProgressListener + * Whether to cancel the load directly from the progress listener. Defaults to true. + * If you're using this method to avoid hitting the network, you want the default (true). + * However, the browser UI will behave differently for loads stopped directly from + * the progress listener (effectively in the middle of a call to loadURI) and so there + * are cases where you may want to avoid stopping the load directly from within the + * progress listener callback. + * @return promise + */ +function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) { + function content_script(contentStopFromProgressListener) { + let { interfaces: Ci, utils: Cu } = Components; + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + let wp = docShell.QueryInterface(Ci.nsIWebProgress); + + function stopContent(now, uri) { + if (now) { + /* Hammer time. */ + content.stop(); + + /* Let the parent know we're done. */ + sendAsyncMessage("Test:WaitForDocLoadAndStopIt", { uri }); + } else { + setTimeout(stopContent.bind(null, true, uri), 0); + } + } + + let progressListener = { + onStateChange(webProgress, req, flags, status) { + dump("waitForDocLoadAndStopIt: onStateChange " + flags.toString(16) + ": " + req.name + "\n"); + + if (webProgress.isTopLevel && + flags & Ci.nsIWebProgressListener.STATE_START) { + wp.removeProgressListener(progressListener); + + let chan = req.QueryInterface(Ci.nsIChannel); + dump(`waitForDocLoadAndStopIt: Document start: ${chan.URI.spec}\n`); + + stopContent(contentStopFromProgressListener, chan.originalURI.spec); + } + }, + QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"]) + }; + wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW); + + /** + * As |this| is undefined and we can't extend |docShell|, adding an unload + * event handler is the easiest way to ensure the weakly referenced + * progress listener is kept alive as long as necessary. + */ + addEventListener("unload", function() { + try { + wp.removeProgressListener(progressListener); + } catch (e) { /* Will most likely fail. */ } + }); + } + + return new Promise((resolve, reject) => { + function complete({ data }) { + is(data.uri, aExpectedURL, "waitForDocLoadAndStopIt: The expected URL was loaded"); + mm.removeMessageListener("Test:WaitForDocLoadAndStopIt", complete); + resolve(); + } + + let mm = aBrowser.messageManager; + mm.loadFrameScript("data:,(" + content_script.toString() + ")(" + aStopFromProgressListener + ");", true); + mm.addMessageListener("Test:WaitForDocLoadAndStopIt", complete); + info("waitForDocLoadAndStopIt: Waiting for URL: " + aExpectedURL); + }); +} + +function promiseDisableOnboardingTours() { + return SpecialPowers.pushPrefEnv({set: [["browser.onboarding.enabled", false]]}); +} diff --git a/browser/base/content/test/general/healthreport_pingData.js b/browser/base/content/test/about/healthreport_pingData.js similarity index 100% rename from browser/base/content/test/general/healthreport_pingData.js rename to browser/base/content/test/about/healthreport_pingData.js diff --git a/browser/base/content/test/general/healthreport_testRemoteCommands.html b/browser/base/content/test/about/healthreport_testRemoteCommands.html similarity index 100% rename from browser/base/content/test/general/healthreport_testRemoteCommands.html rename to browser/base/content/test/about/healthreport_testRemoteCommands.html diff --git a/browser/base/content/test/about/print_postdata.sjs b/browser/base/content/test/about/print_postdata.sjs new file mode 100644 index 000000000000..4175a248055c --- /dev/null +++ b/browser/base/content/test/about/print_postdata.sjs @@ -0,0 +1,22 @@ +const CC = Components.Constructor; +const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", + "nsIBinaryInputStream", + "setInputStream"); + +function handleRequest(request, response) { + response.setHeader("Content-Type", "text/plain", false); + if (request.method == "GET") { + response.write(request.queryString); + } else { + var body = new BinaryInputStream(request.bodyInputStream); + + var avail; + var bytes = []; + + while ((avail = body.available()) > 0) + Array.prototype.push.apply(bytes, body.readByteArray(avail)); + + var data = String.fromCharCode.apply(null, bytes); + response.bodyOutputStream.write(data, data.length); + } +} diff --git a/browser/base/content/test/about/searchSuggestionEngine.sjs b/browser/base/content/test/about/searchSuggestionEngine.sjs new file mode 100644 index 000000000000..1978b4f66512 --- /dev/null +++ b/browser/base/content/test/about/searchSuggestionEngine.sjs @@ -0,0 +1,9 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +function handleRequest(req, resp) { + let suffixes = ["foo", "bar"]; + let data = [req.queryString, suffixes.map(s => req.queryString + s)]; + resp.setHeader("Content-Type", "application/json", false); + resp.write(JSON.stringify(data)); +} diff --git a/browser/base/content/test/about/searchSuggestionEngine.xml b/browser/base/content/test/about/searchSuggestionEngine.xml new file mode 100644 index 000000000000..9f5a5b0193d1 --- /dev/null +++ b/browser/base/content/test/about/searchSuggestionEngine.xml @@ -0,0 +1,9 @@ + + + + +browser_searchSuggestionEngine searchSuggestionEngine.xml + + + diff --git a/browser/base/content/test/general/test_bug959531.html b/browser/base/content/test/about/test_bug959531.html similarity index 100% rename from browser/base/content/test/general/test_bug959531.html rename to browser/base/content/test/about/test_bug959531.html diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index cecb3a3e0794..d8c4363507f7 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -11,7 +11,6 @@ support-files = alltabslistener.html app_bug575561.html app_subframe_bug575561.html - aboutHome_content_script.js audio.ogg browser_bug479408_sample.html browser_bug678392-1.html @@ -49,8 +48,6 @@ support-files = file_fullscreen-window-open.html file_with_link_to_http.html head.js - healthreport_pingData.js - healthreport_testRemoteCommands.html moz.png navigating_window_with_download.html offlineQuotaNotification.cacheManifest @@ -68,7 +65,6 @@ support-files = test_bug462673.html test_bug628179.html test_bug839103.html - test_bug959531.html test_process_flags_chrome.html title_test.svg unknownContentType_file.pif @@ -91,22 +87,6 @@ support-files = !/toolkit/mozapps/extensions/test/xpinstall/theme.xpi !/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutCertError.js] -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutNetError.js] -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutSupport.js] -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutSupport_newtab_security_state.js] -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutHealthReport.js] -skip-if = os == "linux" # Bug 924307 -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutHome.js] -skip-if = true # Bug 1374537 -# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. -[browser_aboutHome_wrapsCorrectly.js] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. [browser_addKeywordSearch.js] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. diff --git a/browser/base/content/test/general/head.js b/browser/base/content/test/general/head.js index 126d17569806..61ddcfa11e25 100644 --- a/browser/base/content/test/general/head.js +++ b/browser/base/content/test/general/head.js @@ -359,84 +359,6 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) { }); } -/** - * Waits for the next top-level document load in the current browser. The URI - * of the document is compared against aExpectedURL. The load is then stopped - * before it actually starts. - * - * @param aExpectedURL - * The URL of the document that is expected to load. - * @param aStopFromProgressListener - * Whether to cancel the load directly from the progress listener. Defaults to true. - * If you're using this method to avoid hitting the network, you want the default (true). - * However, the browser UI will behave differently for loads stopped directly from - * the progress listener (effectively in the middle of a call to loadURI) and so there - * are cases where you may want to avoid stopping the load directly from within the - * progress listener callback. - * @return promise - */ -function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) { - function content_script(contentStopFromProgressListener) { - let { interfaces: Ci, utils: Cu } = Components; - Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - let wp = docShell.QueryInterface(Ci.nsIWebProgress); - - function stopContent(now, uri) { - if (now) { - /* Hammer time. */ - content.stop(); - - /* Let the parent know we're done. */ - sendAsyncMessage("Test:WaitForDocLoadAndStopIt", { uri }); - } else { - setTimeout(stopContent.bind(null, true, uri), 0); - } - } - - let progressListener = { - onStateChange(webProgress, req, flags, status) { - dump("waitForDocLoadAndStopIt: onStateChange " + flags.toString(16) + ": " + req.name + "\n"); - - if (webProgress.isTopLevel && - flags & Ci.nsIWebProgressListener.STATE_START) { - wp.removeProgressListener(progressListener); - - let chan = req.QueryInterface(Ci.nsIChannel); - dump(`waitForDocLoadAndStopIt: Document start: ${chan.URI.spec}\n`); - - stopContent(contentStopFromProgressListener, chan.originalURI.spec); - } - }, - QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"]) - }; - wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW); - - /** - * As |this| is undefined and we can't extend |docShell|, adding an unload - * event handler is the easiest way to ensure the weakly referenced - * progress listener is kept alive as long as necessary. - */ - addEventListener("unload", function() { - try { - wp.removeProgressListener(progressListener); - } catch (e) { /* Will most likely fail. */ } - }); - } - - return new Promise((resolve, reject) => { - function complete({ data }) { - is(data.uri, aExpectedURL, "waitForDocLoadAndStopIt: The expected URL was loaded"); - mm.removeMessageListener("Test:WaitForDocLoadAndStopIt", complete); - resolve(); - } - - let mm = aBrowser.messageManager; - mm.loadFrameScript("data:,(" + content_script.toString() + ")(" + aStopFromProgressListener + ");", true); - mm.addMessageListener("Test:WaitForDocLoadAndStopIt", complete); - info("waitForDocLoadAndStopIt: Waiting for URL: " + aExpectedURL); - }); -} - /** * Waits for the next load to complete in any browser or the given browser. * If a is given it waits for a load in any of its browsers. @@ -829,7 +751,3 @@ function getCertExceptionDialog(aLocation) { } return undefined; } - -function promiseDisableOnboardingTours() { - return SpecialPowers.pushPrefEnv({set: [["browser.onboarding.enabled", false]]}); -} diff --git a/browser/base/content/test/performance/browser_startup.js b/browser/base/content/test/performance/browser_startup.js index 5e943610f3cf..d1b7875531b2 100644 --- a/browser/base/content/test/performance/browser_startup.js +++ b/browser/base/content/test/performance/browser_startup.js @@ -38,7 +38,6 @@ const startupPhases = { "resource://gre/modules/Services.jsm", // Bugs to fix: Probably loaded too early, needs investigation. - "resource://gre/modules/AsyncPrefs.jsm", // bug 1369460 "resource://gre/modules/RemotePageManager.jsm", // bug 1369466 ]) }}, @@ -66,6 +65,9 @@ const startupPhases = { ]), modules: new Set([ "resource:///modules/AboutNewTab.jsm", + "resource:///modules/BrowserUITelemetry.jsm", + "resource:///modules/BrowserUsageTelemetry.jsm", + "resource:///modules/ContentCrashHandlers.jsm", "resource:///modules/DirectoryLinksProvider.jsm", "resource://gre/modules/NewTabUtils.jsm", "resource://gre/modules/PageThumbs.jsm", @@ -92,6 +94,7 @@ const startupPhases = { "resource://gre/modules/BookmarkHTMLUtils.jsm", "resource://gre/modules/Bookmarks.jsm", "resource://gre/modules/ContextualIdentityService.jsm", + "resource://gre/modules/CrashSubmit.jsm", "resource://gre/modules/FxAccounts.jsm", "resource://gre/modules/FxAccountsStorage.jsm", "resource://gre/modules/PlacesSyncUtils.jsm", @@ -109,6 +112,7 @@ const startupPhases = { // be blacklisted here. "before becoming idle": {blacklist: { modules: new Set([ + "resource://gre/modules/AsyncPrefs.jsm", "resource://gre/modules/LoginManagerContextMenu.jsm", "resource://gre/modules/Task.jsm", ]), diff --git a/browser/base/moz.build b/browser/base/moz.build index 9f52ed38f7a4..96e73c207de5 100644 --- a/browser/base/moz.build +++ b/browser/base/moz.build @@ -15,6 +15,7 @@ MOCHITEST_CHROME_MANIFESTS += [ ] BROWSER_CHROME_MANIFESTS += [ + 'content/test/about/browser.ini', 'content/test/alerts/browser.ini', 'content/test/captivePortal/browser.ini', 'content/test/contextMenu/browser.ini', diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 678e10284e56..aeb507b08055 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -12,7 +12,6 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/AppConstants.jsm"); -Cu.import("resource://gre/modules/AsyncPrefs.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"); XPCOMUtils.defineLazyGetter(this, "WeaveService", () => @@ -24,7 +23,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService", // lazy module getters /* global AboutHome:false, AboutNewTab:false, AddonManager:false, AppMenuNotifications:false, - AsyncShutdown:false, AutoCompletePopup:false, BookmarkHTMLUtils:false, + AsyncPrefs: false, AsyncShutdown:false, AutoCompletePopup:false, BookmarkHTMLUtils:false, BookmarkJSONUtils:false, BrowserUITelemetry:false, BrowserUsageTelemetry:false, ContentClick:false, ContentPrefServiceParent:false, ContentSearch:false, DateTimePickerHelper:false, DirectoryLinksProvider:false, @@ -54,6 +53,7 @@ let initializedModules = {}; ["AboutNewTab", "resource:///modules/AboutNewTab.jsm"], ["AddonManager", "resource://gre/modules/AddonManager.jsm"], ["AppMenuNotifications", "resource://gre/modules/AppMenuNotifications.jsm"], + ["AsyncPrefs", "resource://gre/modules/AsyncPrefs.jsm"], ["AsyncShutdown", "resource://gre/modules/AsyncShutdown.jsm"], ["AutoCompletePopup", "resource://gre/modules/AutoCompletePopup.jsm"], ["BookmarkHTMLUtils", "resource://gre/modules/BookmarkHTMLUtils.jsm"], @@ -143,6 +143,12 @@ const listeners = { "ContentPrefs:AddObserverForName": ["ContentPrefServiceParent"], "ContentPrefs:RemoveObserverForName": ["ContentPrefServiceParent"], // PLEASE KEEP THIS LIST IN SYNC WITH THE LISTENERS ADDED IN ContentPrefServiceParent.init + + // PLEASE KEEP THIS LIST IN SYNC WITH THE LISTENERS ADDED IN AsyncPrefs.init + "AsyncPrefs:SetPref": ["AsyncPrefs"], + "AsyncPrefs:ResetPref": ["AsyncPrefs"], + // PLEASE KEEP THIS LIST IN SYNC WITH THE LISTENERS ADDED IN AsyncPrefs.init + "FeedConverter:addLiveBookmark": ["Feeds"], "WCCR:setAutoHandler": ["Feeds"], "webrtc:UpdateGlobalIndicators": ["webrtcUI"], @@ -318,7 +324,7 @@ BrowserGlue.prototype = { this._onAppDefaults(); break; case "final-ui-startup": - this._finalUIStartup(); + this._beforeUIStartup(); break; case "browser-delayed-startup-finished": this._onFirstWindowLoaded(subject); @@ -584,13 +590,13 @@ BrowserGlue.prototype = { _onAppDefaults: function BG__onAppDefaults() { // apply distribution customizations (prefs) - // other customizations are applied in _finalUIStartup() + // other customizations are applied in _beforeUIStartup() this._distributionCustomizer.applyPrefDefaults(); }, // runs on startup, before the first command line handler is invoked // (i.e. before the first window is opened) - _finalUIStartup: function BG__finalUIStartup() { + _beforeUIStartup: function BG__beforeUIStartup() { // check if we're in safe mode if (Services.appinfo.inSafeMode) { Services.ww.openWindow(null, "chrome://browser/content/safeMode.xul", @@ -607,8 +613,6 @@ BrowserGlue.prototype = { listeners.init(); SessionStore.init(); - BrowserUsageTelemetry.init(); - BrowserUITelemetry.init(); if (AppConstants.INSTALL_COMPACT_THEMES) { let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName"); @@ -635,12 +639,6 @@ BrowserGlue.prototype = { }); } - TabCrashHandler.init(); - if (AppConstants.MOZ_CRASHREPORTER) { - PluginCrashReporter.init(); - UnsubmittedCrashHandler.init(); - } - Services.obs.notifyObservers(null, "browser-ui-startup-complete"); }, @@ -899,6 +897,11 @@ BrowserGlue.prototype = { } } + TabCrashHandler.init(); + if (AppConstants.MOZ_CRASHREPORTER) { + PluginCrashReporter.init(); + } + ProcessHangMonitor.init(); // A channel for "remote troubleshooting" code... @@ -1050,6 +1053,9 @@ BrowserGlue.prototype = { // All initial windows have opened. _onWindowsRestored: function BG__onWindowsRestored() { + BrowserUsageTelemetry.init(); + BrowserUITelemetry.init(); + if (AppConstants.MOZ_DEV_EDITION) { this._createExtraDefaultProfile(); } @@ -1163,6 +1169,13 @@ BrowserGlue.prototype = { } } + if (AppConstants.MOZ_CRASHREPORTER) { + UnsubmittedCrashHandler.init(); + Services.tm.idleDispatchToMainThread(function() { + UnsubmittedCrashHandler.checkForUnsubmittedCrashReports(); + }); + } + // Let's load the contextual identities. Services.tm.idleDispatchToMainThread(() => { ContextualIdentityService.load(); diff --git a/browser/modules/BrowserUITelemetry.jsm b/browser/modules/BrowserUITelemetry.jsm index 286fda86ed17..1a8a2b70be77 100644 --- a/browser/modules/BrowserUITelemetry.jsm +++ b/browser/modules/BrowserUITelemetry.jsm @@ -207,17 +207,21 @@ this.BrowserUITelemetry = { UITelemetry.addSimpleMeasureFunction("syncstate", this.getSyncState.bind(this)); - Services.obs.addObserver(this, "sessionstore-windows-restored"); - Services.obs.addObserver(this, "browser-delayed-startup-finished"); Services.obs.addObserver(this, "autocomplete-did-enter-text"); CustomizableUI.addListener(this); + + // Register existing windows + let browserEnum = Services.wm.getEnumerator("navigator:browser"); + while (browserEnum.hasMoreElements()) { + this._registerWindow(browserEnum.getNext()); + } + Services.obs.addObserver(this, "browser-delayed-startup-finished"); + + this._gatherFirstWindowMeasurements(); }, observe(aSubject, aTopic, aData) { switch (aTopic) { - case "sessionstore-windows-restored": - this._gatherFirstWindowMeasurements(); - break; case "browser-delayed-startup-finished": this._registerWindow(aSubject); break; diff --git a/browser/modules/BrowserUsageTelemetry.jsm b/browser/modules/BrowserUsageTelemetry.jsm index ea83fa0cc199..fa3755574b16 100644 --- a/browser/modules/BrowserUsageTelemetry.jsm +++ b/browser/modules/BrowserUsageTelemetry.jsm @@ -23,7 +23,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", const MAX_UNIQUE_VISITED_DOMAINS = 100; // Observed topic names. -const WINDOWS_RESTORED_TOPIC = "sessionstore-windows-restored"; const TAB_RESTORING_TOPIC = "SSTabRestoring"; const TELEMETRY_SUBSESSIONSPLIT_TOPIC = "internal-telemetry-after-subsession-split"; const DOMWINDOW_OPENED_TOPIC = "domwindowopened"; @@ -311,8 +310,8 @@ let urlbarListener = { let BrowserUsageTelemetry = { init() { - Services.obs.addObserver(this, WINDOWS_RESTORED_TOPIC); urlbarListener.init(); + this._setupAfterRestore(); }, /** @@ -333,15 +332,11 @@ let BrowserUsageTelemetry = { uninit() { Services.obs.removeObserver(this, DOMWINDOW_OPENED_TOPIC); Services.obs.removeObserver(this, TELEMETRY_SUBSESSIONSPLIT_TOPIC); - Services.obs.removeObserver(this, WINDOWS_RESTORED_TOPIC); urlbarListener.uninit(); }, observe(subject, topic, data) { switch (topic) { - case WINDOWS_RESTORED_TOPIC: - this._setupAfterRestore(); - break; case DOMWINDOW_OPENED_TOPIC: this._onWindowOpen(subject); break; diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm index bc1108779ea5..2dfa568ba4db 100644 --- a/browser/modules/ContentCrashHandlers.jsm +++ b/browser/modules/ContentCrashHandlers.jsm @@ -577,7 +577,6 @@ this.UnsubmittedCrashHandler = { this.prefs.clearUserPref("suppressUntilDate"); } - Services.obs.addObserver(this, "browser-delayed-startup-finished"); Services.obs.addObserver(this, "profile-before-change"); } }, @@ -604,26 +603,11 @@ this.UnsubmittedCrashHandler = { this.showingNotification = false; } - try { - Services.obs.removeObserver(this, "browser-delayed-startup-finished"); - } catch (e) { - // The browser-delayed-startup-finished observer might have already - // fired and removed itself, so if this fails, it's okay. - if (e.result != Cr.NS_ERROR_FAILURE) { - throw e; - } - } - Services.obs.removeObserver(this, "profile-before-change"); }, observe(subject, topic, data) { switch (topic) { - case "browser-delayed-startup-finished": { - Services.obs.removeObserver(this, topic); - this.checkForUnsubmittedCrashReports(); - break; - } case "profile-before-change": { this.uninit(); break; diff --git a/devtools/client/debugger/test/mochitest/browser.ini b/devtools/client/debugger/test/mochitest/browser.ini index f391c542b8cd..bc1c5002d80d 100644 --- a/devtools/client/debugger/test/mochitest/browser.ini +++ b/devtools/client/debugger/test/mochitest/browser.ini @@ -170,6 +170,7 @@ skip-if = e10s || true # bug 1113935 [browser_dbg_break-on-next.js] [browser_dbg_break-on-next-console.js] [browser_dbg_break-on-dom-01.js] +skip-if = true # bug 1368908 [browser_dbg_break-on-dom-02.js] [browser_dbg_break-on-dom-03.js] [browser_dbg_break-on-dom-04.js] diff --git a/devtools/client/framework/target.js b/devtools/client/framework/target.js index 3fae6e5350c8..a8d17f871db7 100644 --- a/devtools/client/framework/target.js +++ b/devtools/client/framework/target.js @@ -836,6 +836,10 @@ WorkerTarget.prototype = { return this._workerClient; }, + get activeConsole() { + return this.client._clients.get(this.form.consoleActor); + }, + get client() { return this._workerClient.client; }, diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 558cf046ad44..c863b954974a 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -190,11 +190,11 @@ public: mFocusState.ReceiveFocusChangingEvent(); APZ_KEY_LOG("Marking input with type=%d as focus changing with seq=%" PRIu64 "\n", - (int)mEvent.mInputType, + static_cast(mEvent.mInputType), mFocusState.LastAPZProcessedEvent()); } else { APZ_KEY_LOG("Marking input with type=%d as non focus changing with seq=%" PRIu64 "\n", - (int)mEvent.mInputType, + static_cast(mEvent.mInputType), mFocusState.LastAPZProcessedEvent()); } diff --git a/gfx/layers/apz/src/FocusState.cpp b/gfx/layers/apz/src/FocusState.cpp index 4c2c614fc459..8bbc2c543c20 100644 --- a/gfx/layers/apz/src/FocusState.cpp +++ b/gfx/layers/apz/src/FocusState.cpp @@ -46,7 +46,7 @@ FocusState::Update(uint64_t aRootLayerTreeId, FS_LOG("Update with rlt=%" PRIu64 ", olt=%" PRIu64 ", ft=(%d, %" PRIu64 ")\n", aRootLayerTreeId, aOriginatingLayersId, - (int)aState.mType, + static_cast(aState.mType), aState.mSequenceNumber); // Update the focus tree with the latest target diff --git a/gfx/layers/apz/src/FocusTarget.cpp b/gfx/layers/apz/src/FocusTarget.cpp index 4455a513a49c..7e761676b0e2 100644 --- a/gfx/layers/apz/src/FocusTarget.cpp +++ b/gfx/layers/apz/src/FocusTarget.cpp @@ -117,8 +117,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell, // The globally focused element for scrolling is in a remote layer tree if (rfp) { - FT_LOG("Creating reflayer target with seq=%" PRIu64 ", lt=%" PRIu64 "\n", + FT_LOG("Creating reflayer target with seq=%" PRIu64 ", kl=%d, lt=%" PRIu64 "\n", aFocusSequenceNumber, + mFocusHasKeyEventListeners, rfp->GetLayersId()); mType = FocusTarget::eRefLayer; @@ -126,8 +127,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell, return; } - FT_LOG("Creating nil target with seq=%" PRIu64 " (remote browser missing layers id)\n", - aFocusSequenceNumber); + FT_LOG("Creating nil target with seq=%" PRIu64 ", kl=%d (remote browser missing layers id)\n", + aFocusSequenceNumber, + mFocusHasKeyEventListeners); mType = FocusTarget::eNone; return; @@ -136,8 +138,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell, // If the focus isn't on a remote browser then check for scrollable targets if (IsEditableNode(scrollTarget) || IsEditableNode(presShell->GetDocument())) { - FT_LOG("Creating nil target with seq=%" PRIu64 " (disabling for editable node)\n", - aFocusSequenceNumber); + FT_LOG("Creating nil target with seq=%" PRIu64 ", kl=%d (disabling for editable node)\n", + aFocusSequenceNumber, + mFocusHasKeyEventListeners); mType = FocusTarget::eNone; return; @@ -160,8 +163,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell, mData.mScrollTargets.mVertical = nsLayoutUtils::FindIDForScrollableFrame(vertical); - FT_LOG("Creating scroll target with seq=%" PRIu64 ", h=%" PRIu64 ", v=%" PRIu64 "\n", + FT_LOG("Creating scroll target with seq=%" PRIu64 ", kl=%d, h=%" PRIu64 ", v=%" PRIu64 "\n", aFocusSequenceNumber, + mFocusHasKeyEventListeners, mData.mScrollTargets.mHorizontal, mData.mScrollTargets.mVertical); } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 53e559aa62a9..c3b20b27e15f 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -478,6 +478,16 @@ js::Nursery::renderProfileJSON(JSONPrinter& json) const } json.beginObject(); + + json.property("reason", JS::gcreason::ExplainReason(previousGC.reason)); + json.property("bytes_tenured", previousGC.tenuredBytes); + json.floatProperty("promotion_rate", + 100.0 * previousGC.tenuredBytes / double(previousGC.nurseryUsedBytes), 2); + json.property("nursery_bytes", previousGC.nurseryUsedBytes); + json.property("new_nursery_bytes", numChunks() * ChunkSize); + + json.beginObjectProperty("timings"); + #define EXTRACT_NAME(name, text) #name, static const char* names[] = { FOR_EACH_NURSERY_PROFILE_TIME(EXTRACT_NAME) @@ -488,6 +498,8 @@ FOR_EACH_NURSERY_PROFILE_TIME(EXTRACT_NAME) for (auto time : profileDurations_) json.property(names[i++], time, json.MICROSECONDS); + json.endObject(); // timings value + json.endObject(); } @@ -753,6 +765,10 @@ js::Nursery::doCollection(JS::gcreason::Reason reason, #endif endProfile(ProfileKey::CheckHashTables); + previousGC.reason = reason; + previousGC.nurseryUsedBytes = initialNurserySize; + previousGC.tenuredBytes = mover.tenuredSize; + // Calculate and return the promotion rate. return mover.tenuredSize / double(initialNurserySize); } diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 7730e387c531..452055447eeb 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -353,6 +353,12 @@ class Nursery ProfileDurations totalDurations_; uint64_t minorGcCount_; + struct { + JS::gcreason::Reason reason; + uint64_t nurseryUsedBytes; + uint64_t tenuredBytes; + } previousGC; + /* * The set of externally malloced buffers potentially kept live by objects * stored in the nursery. Any external buffers that do not belong to a diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index c58e71a7ef73..c03f454a21aa 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -7170,6 +7170,9 @@ PresShell::HandleEvent(nsIFrame* aFrame, // Update the latest focus sequence number with this new sequence number if (mAPZFocusSequenceNumber < aEvent->mFocusSequenceNumber) { mAPZFocusSequenceNumber = aEvent->mFocusSequenceNumber; + + // Schedule an empty transaction to transmit this focus update + aFrame->SchedulePaint(nsIFrame::PAINT_COMPOSITE_ONLY); } if (sPointerEventEnabled) { diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index de58dba2ac73..8e3be8393bbd 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -2372,12 +2372,6 @@ nsDisplayItem* nsDisplayList::RemoveBottom() { void nsDisplayList::DeleteAll() { nsDisplayItem* item; while ((item = RemoveBottom()) != nullptr) { -#ifdef NIGHTLY_BUILD - if (XRE_IsContentProcess()) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::DISPLAY_ITEM_USAGE_COUNT, - item->GetType()); - } -#endif item->~nsDisplayItem(); } } diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js index 7016d6df13b7..191211d0818f 100644 --- a/layout/tools/reftest/reftest-content.js +++ b/layout/tools/reftest/reftest-content.js @@ -833,6 +833,7 @@ function RecordResult() clearTimeout(gFailureTimeout); gFailureReason = null; gFailureTimeout = null; + gCurrentURL = null; if (gCurrentTestType == TYPE_SCRIPT) { var error = ''; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 1acc9826f11e..78d269705c15 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -11,7 +11,6 @@ var Cr = Components.results; Cu.import("resource://gre/modules/AddonManager.jsm"); Cu.import("resource://gre/modules/AppConstants.jsm"); -Cu.import("resource://gre/modules/AsyncPrefs.jsm"); Cu.import("resource://gre/modules/DelayedInit.jsm"); Cu.import("resource://gre/modules/Messaging.jsm"); Cu.import("resource://gre/modules/Services.jsm"); diff --git a/mobile/android/components/geckoview/GeckoViewPrompt.js b/mobile/android/components/geckoview/GeckoViewPrompt.js index a6fa5621be3a..c1ec31976421 100644 --- a/mobile/android/components/geckoview/GeckoViewPrompt.js +++ b/mobile/android/components/geckoview/GeckoViewPrompt.js @@ -7,6 +7,9 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "AsyncPrefs", + "resource://gre/modules/AsyncPrefs.jsm"); + XPCOMUtils.defineLazyModuleGetter(this, "ContentPrefServiceParent", "resource://gre/modules/ContentPrefServiceParent.jsm"); @@ -39,6 +42,8 @@ PromptFactory.prototype = { case "profile-after-change": { // ContentPrefServiceParent is needed for e10s file picker. ContentPrefServiceParent.init(); + // AsyncPrefs is needed for reader mode. + AsyncPrefs.init(); Services.mm.addMessageListener("GeckoView:Prompt", this); break; } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 3fe61e21d641..55ce49538d15 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -13209,15 +13209,6 @@ "keyed": true, "description": "Measures the number of milliseconds we spend waiting for sync message manager IPC messages to finish sending, keyed by message name. Note: only messages that wait for more than 500 microseconds are included in this probe." }, - "DISPLAY_ITEM_USAGE_COUNT": { - "record_in_processes": ["main", "content"], - "alert_emails": ["mchang@mozilla.com", "gfx-telemetry-alerts@mozilla.com"], - "bug_numbers": [1353521], - "expires_in_version": "56", - "kind": "enumerated", - "n_values": 99, - "description": "Count of which layout display items are being created. Display items are created by layout to determine what content to render. A full description is above the class definition for nsDisplayItem. The list of types is kept in nsDisplayItemTypes.h." - }, "TIMEOUT_EXECUTION_FG_MS": { "record_in_processes": ["main", "content"], diff --git a/toolkit/components/telemetry/TelemetryHistogram.cpp b/toolkit/components/telemetry/TelemetryHistogram.cpp index e6a603357eab..bdd92dd96b67 100644 --- a/toolkit/components/telemetry/TelemetryHistogram.cpp +++ b/toolkit/components/telemetry/TelemetryHistogram.cpp @@ -865,7 +865,8 @@ namespace { class KeyedHistogram { public: - KeyedHistogram(const nsACString &name, const nsACString &expiration, + KeyedHistogram(ProcessID processType, const nsACString &name, + const nsACString &expiration, uint32_t histogramType, uint32_t min, uint32_t max, uint32_t bucketCount, uint32_t dataset); nsresult GetHistogram(const nsCString& name, Histogram** histogram, bool subsession); @@ -895,6 +896,7 @@ private: JSContext* cx, JS::Handle obj); + const ProcessID mProcessType; const nsCString mName; const nsCString mExpiration; const uint32_t mHistogramType; @@ -905,7 +907,8 @@ private: mozilla::Atomic mRecordingEnabled; }; -KeyedHistogram::KeyedHistogram(const nsACString &name, +KeyedHistogram::KeyedHistogram(ProcessID processType, + const nsACString &name, const nsACString &expiration, uint32_t histogramType, uint32_t min, uint32_t max, @@ -914,6 +917,7 @@ KeyedHistogram::KeyedHistogram(const nsACString &name, #if !defined(MOZ_WIDGET_ANDROID) , mSubsessionMap() #endif + , mProcessType(processType) , mName(name) , mExpiration(expiration) , mHistogramType(histogramType) @@ -947,6 +951,7 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram, } #endif histogramName.Append(mName); + histogramName.Append(SuffixForProcessType(mProcessType)); histogramName.AppendLiteral(KEYED_HISTOGRAM_NAME_SEPARATOR); histogramName.Append(key); @@ -1857,7 +1862,7 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase, const nsDependentCString id(h.id()); const nsDependentCString expiration(h.expiration()); - gKeyedHistograms.Put(id, new KeyedHistogram(id, expiration, h.histogramType, + gKeyedHistograms.Put(id, new KeyedHistogram(ProcessID::Parent, id, expiration, h.histogramType, h.min, h.max, h.bucketCount, h.dataset)); if (XRE_IsParentProcess()) { // We must create registered child keyed histograms as well or else the @@ -1866,19 +1871,19 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase, nsCString contentId(id); contentId.AppendLiteral(CONTENT_HISTOGRAM_SUFFIX); gKeyedHistograms.Put(contentId, - new KeyedHistogram(id, expiration, h.histogramType, + new KeyedHistogram(ProcessID::Content, id, expiration, h.histogramType, h.min, h.max, h.bucketCount, h.dataset)); nsCString gpuId(id); gpuId.AppendLiteral(GPU_HISTOGRAM_SUFFIX); gKeyedHistograms.Put(gpuId, - new KeyedHistogram(id, expiration, h.histogramType, + new KeyedHistogram(ProcessID::Gpu, id, expiration, h.histogramType, h.min, h.max, h.bucketCount, h.dataset)); nsCString extensionId(id); extensionId.AppendLiteral(EXTENSION_HISTOGRAM_SUFFIX); gKeyedHistograms.Put(extensionId, - new KeyedHistogram(id, expiration, h.histogramType, + new KeyedHistogram(ProcessID::Extension, id, expiration, h.histogramType, h.min, h.max, h.bucketCount, h.dataset)); } } diff --git a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js index 505207ff713b..b3ab52afe505 100644 --- a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js +++ b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js @@ -125,6 +125,8 @@ add_task(async function() { allLinear.add(20); let allChildLinear = Telemetry.getHistogramById("TELEMETRY_TEST_ALL_CHILD_PROCESSES"); allChildLinear.add(20); + let countKeyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT"); + countKeyed.add("a"); const payload = TelemetrySession.getPayload("test-ping"); Assert.ok("processes" in payload, "Should have processes section"); @@ -160,6 +162,7 @@ add_task(async function() { Assert.ok(!("TELEMETRY_TEST_ALL_CHILD_PROCESSES" in mainHs), "Should not have all-child process histogram in main process payload"); Assert.ok("TELEMETRY_TEST_FLAG_MAIN_PROCESS" in mainHs, "Should have main process histogram in main process payload"); Assert.equal(mainHs.TELEMETRY_TEST_FLAG_MAIN_PROCESS.sum, 1, "Should have correct value"); + Assert.equal(mainKhs.TELEMETRY_TEST_KEYED_COUNT.a.sum, 1, "Should have correct value in parent"); do_test_finished(); }); diff --git a/toolkit/modules/AsyncPrefs.jsm b/toolkit/modules/AsyncPrefs.jsm index b78e8b2ff2b0..989be2ddcc6e 100644 --- a/toolkit/modules/AsyncPrefs.jsm +++ b/toolkit/modules/AsyncPrefs.jsm @@ -101,12 +101,10 @@ if (kInChildProcess) { } } }, - - init() { - Services.cpmm.addMessageListener("AsyncPrefs:PrefSetFinished", this); - Services.cpmm.addMessageListener("AsyncPrefs:PrefResetFinished", this); - }, }; + + Services.cpmm.addMessageListener("AsyncPrefs:PrefSetFinished", AsyncPrefs); + Services.cpmm.addMessageListener("AsyncPrefs:PrefResetFinished", AsyncPrefs); } else { AsyncPrefs = { methodForType: { @@ -172,11 +170,10 @@ if (kInChildProcess) { }, init() { + // PLEASE KEEP THIS LIST IN SYNC WITH THE LISTENERS ADDED IN nsBrowserGlue Services.ppmm.addMessageListener("AsyncPrefs:SetPref", this); Services.ppmm.addMessageListener("AsyncPrefs:ResetPref", this); + // PLEASE KEEP THIS LIST IN SYNC WITH THE LISTENERS ADDED IN nsBrowserGlue } }; } - -AsyncPrefs.init(); - diff --git a/tools/profiler/core/ProfilerMarkerPayload.cpp b/tools/profiler/core/ProfilerMarkerPayload.cpp index d7f7ef243368..790a7017db35 100644 --- a/tools/profiler/core/ProfilerMarkerPayload.cpp +++ b/tools/profiler/core/ProfilerMarkerPayload.cpp @@ -164,8 +164,8 @@ GCMinorMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter, MOZ_ASSERT(mTimingData); StreamCommonProps("GCMinor", aWriter, aProcessStartTime, aUniqueStacks); if (mTimingData) { - aWriter.SplicedJSONProperty("nurseryTimings", mTimingData.get()); + aWriter.SplicedJSONProperty("nursery", mTimingData.get()); } else { - aWriter.NullProperty("nurseryTimings"); + aWriter.NullProperty("nursery"); } } diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 29a318e2a638..559f88b8fda2 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -1318,16 +1318,6 @@ GfxInfo::GetGfxDriverInfo() (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAMD), GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_DX_INTEROP2, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, "DX_INTEROP2_AMD_CRASH"); - - //////////////////////////////////// - // FEATURE_ADVANCED_LAYERS - - // bug 1377866 - APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, - (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), - (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(IntelHDGraphicsToSandyBridge), - nsIGfxInfo::FEATURE_ADVANCED_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, - DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1377866"); } return *mDriverInfo; }