merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: Kr2w3UdA0p9
This commit is contained in:
Sebastian Hengst 2017-07-15 16:34:47 +02:00
commit 186c6d7165
46 changed files with 452 additions and 201 deletions

View File

@ -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);

View File

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/browser-test"
]
};

View File

@ -0,0 +1,6 @@
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>POST Search</ShortName>
<Url type="text/html" method="POST" template="http://mochi.test:8888/browser/browser/base/content/test/about/print_postdata.sjs">
<Param name="searchterms" value="{searchTerms}"/>
</Url>
</OpenSearchDescription>

View File

@ -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]

View File

@ -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);

View File

@ -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() {

View File

@ -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");
});

View File

@ -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]]});
}

View File

@ -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);
}
}

View File

@ -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));
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>browser_searchSuggestionEngine searchSuggestionEngine.xml</ShortName>
<Url type="application/x-suggestions+json" method="GET" template="http://mochi.test:8888/browser/browser/base/content/test/about/searchSuggestionEngine.sjs?{searchTerms}"/>
<Url type="text/html" method="GET" template="http://mochi.test:8888/" rel="searchform"/>
</SearchPlugin>

View File

@ -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.

View File

@ -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 <tabbrowser> 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]]});
}

View File

@ -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",
]),

View File

@ -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',

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]

View File

@ -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;
},

View File

@ -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<int>(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<int>(mEvent.mInputType),
mFocusState.LastAPZProcessedEvent());
}

View File

@ -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<int>(aState.mType),
aState.mSequenceNumber);
// Update the focus tree with the latest target

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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) {

View File

@ -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();
}
}

View File

@ -833,6 +833,7 @@ function RecordResult()
clearTimeout(gFailureTimeout);
gFailureReason = null;
gFailureTimeout = null;
gCurrentURL = null;
if (gCurrentTestType == TYPE_SCRIPT) {
var error = '';

View File

@ -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");

View File

@ -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;
}

View File

@ -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"],

View File

@ -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<JSObject*> obj);
const ProcessID mProcessType;
const nsCString mName;
const nsCString mExpiration;
const uint32_t mHistogramType;
@ -905,7 +907,8 @@ private:
mozilla::Atomic<bool, mozilla::Relaxed> 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));
}
}

View File

@ -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();
});

View File

@ -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();

View File

@ -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");
}
}

View File

@ -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;
}