Bug 1407351 - Back out to avoid a merge conflict with bug 1406212. I'll reland tomorrow

MozReview-Commit-ID: 612TlR0MgR4
This commit is contained in:
Felipe Gomes 2017-10-12 21:59:18 -03:00
parent bbfec72b95
commit 782fcdbd30
21 changed files with 264 additions and 29 deletions

View File

@ -34,6 +34,12 @@
accesskey="&newPrivateWindow.accesskey;"
command="Tools:PrivateBrowsing"
key="key_privatebrowsing"/>
#ifdef E10S_TESTING_ONLY
<menuitem id="menu_newNonRemoteWindow"
label="&newNonRemoteWindow.label;"
hidden="true"
command="Tools:NonRemoteWindow"/>
#endif
#ifdef MAC_NON_BROWSER_WINDOW
<menuitem id="menu_openLocation"
label="&openLocationCmd.label;"

View File

@ -102,6 +102,10 @@
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing"
oncommand="OpenBrowserWindow({private: true});"/>
#ifdef E10S_TESTING_ONLY
<command id="Tools:NonRemoteWindow"
oncommand="OpenBrowserWindow({remote: false});"/>
#endif
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>
</commandset>

View File

@ -1465,6 +1465,9 @@ var gBrowserInit = {
BrowserOffline.init();
IndexedDBPromptHelper.init();
if (AppConstants.E10S_TESTING_ONLY)
gRemoteTabsUI.init();
// Initialize the full zoom setting.
// We do this before the session restore service gets initialized so we can
// apply full zoom settings to tabs restored by the session restore service.
@ -1977,6 +1980,9 @@ if (AppConstants.platform == "macosx") {
// initialize the private browsing UI
gPrivateBrowsingUI.init();
if (AppConstants.E10S_TESTING_ONLY) {
gRemoteTabsUI.init();
}
};
gBrowserInit.nonBrowserWindowShutdown = function() {
@ -8187,6 +8193,27 @@ var gPrivateBrowsingUI = {
}
};
var gRemoteTabsUI = {
init() {
if (window.location.href != getBrowserURL() &&
// Also check hidden window for the Mac no-window case
window.location.href != "chrome://browser/content/hiddenWindow.xul") {
return;
}
if (AppConstants.platform == "macosx" &&
Services.prefs.getBoolPref("layers.acceleration.disabled")) {
// On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
// a fallback to Basic Layers. This is incompatible with e10s.
return;
}
let newNonRemoteWindow = document.getElementById("menu_newNonRemoteWindow");
let autostart = Services.appinfo.browserTabsRemoteAutostart;
newNonRemoteWindow.hidden = !autostart;
}
};
/**
* Switch to a tab that has a given URI, and focuses its browser window.
* If a matching tab is in this window, it will be switched to. Otherwise, other
@ -8444,6 +8471,16 @@ var TabContextMenu = {
if (this.contextTab.hasAttribute("customizemode"))
document.getElementById("context_openTabInWindow").disabled = true;
if (AppConstants.E10S_TESTING_ONLY) {
menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-remote");
for (let menuItem of menuItems) {
menuItem.hidden = !gMultiProcessBrowser;
if (menuItem.id == "context_openNonRemoteWindow") {
menuItem.disabled = !!parseInt(this.contextTab.getAttribute("usercontextid"));
}
}
}
disabled = gBrowser.visibleTabs.length == 1;
menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple-visible");
for (let menuItem of menuItems)

View File

@ -96,6 +96,12 @@
accesskey="&moveToNewWindow.accesskey;"
tbattr="tabbrowser-multiple"
oncommand="gBrowser.replaceTabWithWindow(TabContextMenu.contextTab);"/>
#ifdef E10S_TESTING_ONLY
<menuitem id="context_openNonRemoteWindow" label="Open in new non-e10s window"
tbattr="tabbrowser-remote"
hidden="true"
oncommand="gBrowser.openNonRemoteWindow(TabContextMenu.contextTab);"/>
#endif
<menuseparator id="context_sendTabToDevice_separator"/>
<menu id="context_sendTabToDevice" label="&sendTabToDevice.label;"
accesskey="&sendTabToDevice.accesskey;">

View File

@ -3954,6 +3954,20 @@
</body>
</method>
<!-- Opens a given tab to a non-remote window. -->
<method name="openNonRemoteWindow">
<parameter name="aTab"/>
<body>
<![CDATA[
if (!AppConstants.E10S_TESTING_ONLY) {
throw "This method is intended only for e10s testing!";
}
let url = aTab.linkedBrowser.currentURI.spec;
return window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no,non-remote", url);
]]>
</body>
</method>
<method name="moveTabTo">
<parameter name="aTab"/>
<parameter name="aIndex"/>
@ -5530,11 +5544,14 @@
}
} else {
label = tab._fullLabel || tab.getAttribute("label");
if (AppConstants.NIGHTLY_BUILD &&
if (AppConstants.E10S_TESTING_ONLY &&
tab.linkedBrowser &&
tab.linkedBrowser.isRemoteBrowser &&
tab.linkedBrowser.frameLoader) {
label += " (pid " + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
tab.linkedBrowser.isRemoteBrowser) {
label += " - e10s";
if (tab.linkedBrowser.frameLoader &&
Services.appinfo.maxWebProcessCount > 1) {
label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
}
}
if (tab.userContextId) {
label = this.mStringBundle.getFormattedString("tabs.containers.tooltip", [label, ContextualIdentityService.getUserContextLabel(tab.userContextId)]);

View File

@ -59,7 +59,7 @@ const kSubviewEvents = [
* The current version. We can use this to auto-add new default widgets as necessary.
* (would be const but isn't because of testing purposes)
*/
var kVersion = 13;
var kVersion = 12;
/**
* Buttons removed from built-ins by version they were removed. kVersion must be
@ -345,6 +345,7 @@ var CustomizableUIInternal = {
"preferences-button",
"add-ons-button",
"sync-button",
"e10s-button",
];
if (!AppConstants.MOZ_DEV_EDITION) {
@ -451,17 +452,6 @@ var CustomizableUIInternal = {
}
}
}
// Remove the old placements from the now-gone Nightly-only
// "New non-e10s window" button.
if (currentVersion < 13 && gSavedState.placements) {
for (let placements of Object.values(gSavedState.placements)) {
let buttonIndex = placements.indexOf("e10s-button");
if (buttonIndex != -1) {
placements.spice(buttonIndex, 1);
}
}
}
},
/**

View File

@ -997,3 +997,21 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
},
});
}
if (AppConstants.E10S_TESTING_ONLY) {
if (Services.appinfo.browserTabsRemoteAutostart) {
CustomizableWidgets.push({
id: "e10s-button",
defaultArea: CustomizableUI.AREA_PANEL,
onBuild(aDocument) {
let node = aDocument.createElementNS(kNSXUL, "toolbarbutton");
node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
},
onCommand(aEvent) {
let win = aEvent.view;
win.OpenBrowserWindow({remote: false});
},
});
}
}

View File

@ -17,6 +17,11 @@ Services.scriptloader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/
Services.prefs.setBoolPref("browser.uiCustomization.skipSourceNodeCheck", true);
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.uiCustomization.skipSourceNodeCheck"));
// Remove temporary e10s related new window options in customize ui,
// they break a lot of tests.
CustomizableUI.destroyWidget("e10s-button");
CustomizableUI.removeWidgetFromArea("e10s-button");
var {synthesizeDragStart, synthesizeDrop} = EventUtils;
const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

View File

@ -97,6 +97,11 @@ const APP_ICON_ATTR_NAME = "appHandlerIcon";
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
if (AppConstants.E10S_TESTING_ONLY) {
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
}
if (AppConstants.MOZ_DEV_EDITION) {
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
@ -314,6 +319,26 @@ var gMainPane = {
}
}
if (AppConstants.E10S_TESTING_ONLY) {
setEventListener("e10sAutoStart", "command",
gMainPane.enableE10SChange);
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let e10sForceEnable = document.getElementById("e10sForceEnable");
let preffedOn = e10sPref.value || e10sTempPref.value || e10sForceEnable.value;
if (preffedOn) {
// The checkbox is checked if e10s is preffed on and enabled.
e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart;
// but if it's force disabled, then the checkbox is disabled.
e10sCheckbox.disabled = !Services.appinfo.browserTabsRemoteAutostart;
}
}
if (AppConstants.MOZ_DEV_EDITION) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
@ -521,6 +546,54 @@ var gMainPane = {
this.readBrowserContainersCheckbox();
},
isE10SEnabled() {
let e10sEnabled;
try {
let e10sStatus = Components.classes["@mozilla.org/supports-PRUint64;1"]
.createInstance(Ci.nsISupportsPRUint64);
let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
appinfo.observe(e10sStatus, "getE10SBlocked", "");
e10sEnabled = e10sStatus.data < 2;
} catch (e) {
e10sEnabled = false;
}
return e10sEnabled;
},
enableE10SChange() {
if (AppConstants.E10S_TESTING_ONLY) {
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let prefsToChange;
if (e10sCheckbox.checked) {
// Enabling e10s autostart
prefsToChange = [e10sPref];
} else {
// Disabling e10s autostart
prefsToChange = [e10sPref];
if (e10sTempPref.value) {
prefsToChange.push(e10sTempPref);
}
}
let buttonIndex = confirmRestartPrompt(e10sCheckbox.checked, 0,
true, false);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
for (let prefToChange of prefsToChange) {
prefToChange.value = e10sCheckbox.checked;
}
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
// Revert the checkbox in case we didn't quit
e10sCheckbox.checked = e10sPref.value || e10sTempPref.value;
}
},
separateProfileModeChange() {
if (AppConstants.MOZ_DEV_EDITION) {
function quitApp() {
@ -1203,7 +1276,7 @@ var gMainPane = {
},
buildContentProcessCountMenuList() {
if (Services.appinfo.browserTabsRemoteAutostart) {
if (gMainPane.isE10SEnabled()) {
let processCountPref = document.getElementById("dom.ipc.processCount");
let e10sRolloutProcessCountPref =
document.getElementById("dom.ipc.processCount.web");

View File

@ -17,6 +17,19 @@
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
<preferences id="mainPreferences" hidden="true" data-category="paneGeneral">
#ifdef E10S_TESTING_ONLY
<preference id="browser.tabs.remote.autostart"
name="browser.tabs.remote.autostart"
type="bool"/>
<preference id="e10sTempPref"
name="browser.tabs.remote.autostart.2"
type="bool"/>
<preference id="e10sForceEnable"
name="browser.tabs.remote.force-enable"
type="bool"/>
#endif
<!-- Startup -->
<preference id="browser.startup.page"
name="browser.startup.page"
@ -285,6 +298,11 @@
</vbox>
#endif
#ifdef E10S_TESTING_ONLY
<checkbox id="e10sAutoStart"
label="&e10sEnabled.label;"/>
#endif
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"

View File

@ -293,6 +293,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY newNavigatorCmd.accesskey "N">
<!ENTITY newPrivateWindow.label "New Private Window">
<!ENTITY newPrivateWindow.accesskey "W">
<!ENTITY newNonRemoteWindow.label "New Non-e10s Window">
<!ENTITY editMenu.label "Edit">
<!ENTITY editMenu.accesskey "E">

View File

@ -101,6 +101,9 @@ panic-button.tooltiptext = Forget about some browsing history
devtools-webide-button2.label = WebIDE
devtools-webide-button2.tooltiptext = Open WebIDE (%S)
e10s-button.label = New Non-e10s Window
e10s-button.tooltiptext = Open a new Non-e10s Window
toolbarspring.label = Flexible Space
toolbarseparator.label = Separator
toolbarspacer.label = Space

View File

@ -44,3 +44,5 @@
<!ENTITY useFirefoxSync.label "Tip: This uses separate profiles. Use Sync to share data between them.">
<!ENTITY getStarted.notloggedin.label "Sign in to &syncBrand.shortName.label;…">
<!ENTITY getStarted.configured.label "Open &syncBrand.shortName.label; preferences">
<!ENTITY e10sEnabled.label "Enable multi-process &brandShortName;">

View File

@ -229,6 +229,14 @@ toolbar[brighttext] {
list-style-image: url("chrome://browser/skin/new-window.svg");
}
#e10s-button {
list-style-image: url("chrome://browser/skin/new-window.svg");
}
#e10s-button > .toolbarbutton-icon {
transform: scaleY(-1);
}
#new-tab-button {
list-style-image: url("chrome://browser/skin/new-tab.svg");
}

View File

@ -15,6 +15,11 @@
- is displayed as the tooltip for the buffer capacity during a recording. -->
<!ENTITY performanceUI.bufferStatusTooltip "The profiler stores samples in a circular buffer, and once the buffer reaches the limit for a recording, newer samples begin to overwrite samples at the beginning of the recording.">
<!-- LOCALIZATION NOTE (performanceUI.disabledRealTime.nonE10SBuild): This string
- is displayed as a message for why the real time overview graph is disabled
- when running on a non-multiprocess build. -->
<!ENTITY performanceUI.disabledRealTime.nonE10SBuild "Realtime recording data disabled on non-multiprocess Firefox.">
<!-- LOCALIZATION NOTE (performanceUI.disabledRealTime.disabledE10S): This string
- is displayed as a message for why the real time overview graph is disabled
- when running on a build that can run multiprocess Firefox, but just is not enabled. -->

View File

@ -517,17 +517,18 @@ var PerformanceController = {
* @return {object}
*/
getMultiprocessStatus: function () {
// If testing, set enabled to true so we have realtime rendering tests
// in non-e10s. This function is overridden wholesale in tests
// when we want to test multiprocess support
// If testing, set both supported and enabled to true so we
// have realtime rendering tests in non-e10s. This function is
// overridden wholesale in tests when we want to test multiprocess support
// specifically.
if (flags.testing) {
return { enabled: true };
return { supported: true, enabled: true };
}
let supported = system.constants.E10S_TESTING_ONLY;
// This is only checked on tool startup -- requires a restart if
// e10s subsequently enabled.
let enabled = this._e10s;
return { enabled };
return { supported, enabled };
},
/**
@ -555,9 +556,12 @@ var PerformanceController = {
* if e10s is not possible on the platform. If e10s is on, no attribute is set.
*/
_setMultiprocessAttributes: function () {
let { enabled } = this.getMultiprocessStatus();
if (!enabled) {
let { enabled, supported } = this.getMultiprocessStatus();
if (!enabled && supported) {
$("#performance-view").setAttribute("e10s", "disabled");
} else if (!enabled && !supported) {
// Could be a chance where the directive goes away yet e10s is still on
$("#performance-view").setAttribute("e10s", "unsupported");
}
},

View File

@ -211,6 +211,8 @@
<hbox pack="center">
<html:div class='recording-button-mount'/>
</hbox>
<label class="realtime-disabled-message"
value="&performanceUI.disabledRealTime.nonE10SBuild;"/>
<label class="realtime-disabled-on-e10s-message"
value="&performanceUI.disabledRealTime.disabledE10S;"/>
<label class="buffer-status-message"
@ -235,6 +237,8 @@
<label class="console-profile-command" />
<label value="&performanceUI.console.stopCommandEnd;" />
</hbox>
<label class="realtime-disabled-message"
value="&performanceUI.disabledRealTime.nonE10SBuild;"/>
<label class="realtime-disabled-on-e10s-message"
value="&performanceUI.disabledRealTime.disabledE10S;"/>
<label class="buffer-status-message"

View File

@ -20,21 +20,35 @@ add_task(function* () {
// Set a fast profiler-status update interval
yield gFront.setProfilerStatusInterval(10);
let supported = false;
let enabled = false;
PerformanceController.getMultiprocessStatus = () => {
return { enabled };
return { supported, enabled };
};
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "unsupported",
"When e10s is disabled and no option to turn on, container has [e10s=unsupported].");
supported = true;
enabled = false;
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "disabled",
"When e10s is disabled, container has [e10s=disabled].");
"When e10s is disabled and but is supported, container has [e10s=disabled].");
supported = false;
enabled = true;
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "",
"When e10s is enabled, there should be no e10s attribute.");
"When e10s is enabled, but not supported, this probably means we no longer have " +
"E10S_TESTING_ONLY, and we have no e10s attribute.");
supported = true;
enabled = true;
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "",
"When e10s is enabled and supported, there should be no e10s attribute.");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -247,11 +247,13 @@
margin: 3px 2px;
}
.realtime-disabled-message,
.realtime-disabled-on-e10s-message {
display: none;
}
#performance-view[e10s="disabled"] .realtime-disabled-on-e10s-message {
#performance-view[e10s="disabled"] .realtime-disabled-on-e10s-message,
#performance-view[e10s="unsupported"] .realtime-disabled-message {
display: initial;
opacity: 0.5;
}

View File

@ -14,6 +14,17 @@ include('build/moz.configure/init.configure')
# - Spidermonkey-specific options and rules should go in js/moz.configure.
# - etc.
# Multiprocess Firefox Testing UI - Nightly and Aurora
# To be removed in Bug 1003313
@depends(milestone)
def e10s_testing_only(milestone):
if not milestone.is_release_or_beta:
return True
set_config('E10S_TESTING_ONLY', e10s_testing_only)
set_define('E10S_TESTING_ONLY', e10s_testing_only)
option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
help='Download and use prebuilt binary artifacts.')

View File

@ -180,6 +180,13 @@ this.AppConstants = Object.freeze({
false,
#endif
E10S_TESTING_ONLY:
#ifdef E10S_TESTING_ONLY
true,
#else
false,
#endif
DEBUG:
#ifdef DEBUG
true,