diff --git a/browser/devtools/commandline/test/browser_cmd_settings.js b/browser/devtools/commandline/test/browser_cmd_settings.js index fa1a0704f9e..8b4e27225bf 100644 --- a/browser/devtools/commandline/test/browser_cmd_settings.js +++ b/browser/devtools/commandline/test/browser_cmd_settings.js @@ -25,49 +25,49 @@ function spawnTest() { yield gcli.load(); let settings = gcli.settings; - let tiltEnabled = settings.get("devtools.tilt.enabled"); + let hideIntroEnabled = settings.get("devtools.gcli.hideIntro"); let tabSize = settings.get("devtools.editor.tabsize"); let remoteHost = settings.get("devtools.debugger.remote-host"); - let tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled"); + let hideIntroOrig = prefBranch.getBoolPref("devtools.gcli.hideIntro"); let tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize"); let remoteHostOrig = prefBranch.getComplexValue( "devtools.debugger.remote-host", Components.interfaces.nsISupportsString).data; - info("originally: devtools.tilt.enabled = " + tiltEnabledOrig); + info("originally: devtools.gcli.hideIntro = " + hideIntroOrig); info("originally: devtools.editor.tabsize = " + tabSizeOrig); info("originally: devtools.debugger.remote-host = " + remoteHostOrig); // Actual tests - is(tiltEnabled.value, tiltEnabledOrig, "tiltEnabled default"); + is(hideIntroEnabled.value, hideIntroOrig, "hideIntroEnabled default"); is(tabSize.value, tabSizeOrig, "tabSize default"); is(remoteHost.value, remoteHostOrig, "remoteHost default"); - tiltEnabled.setDefault(); + hideIntroEnabled.setDefault(); tabSize.setDefault(); remoteHost.setDefault(); - let tiltEnabledDefault = tiltEnabled.value; + let hideIntroEnabledDefault = hideIntroEnabled.value; let tabSizeDefault = tabSize.value; let remoteHostDefault = remoteHost.value; - tiltEnabled.value = false; + hideIntroEnabled.value = false; tabSize.value = 42; - remoteHost.value = "example.com" + remoteHost.value = "example.com"; - is(tiltEnabled.value, false, "tiltEnabled basic"); + is(hideIntroEnabled.value, false, "hideIntroEnabled basic"); is(tabSize.value, 42, "tabSize basic"); is(remoteHost.value, "example.com", "remoteHost basic"); - function tiltEnabledCheck(ev) { - is(ev.setting, tiltEnabled, "tiltEnabled event setting"); - is(ev.value, true, "tiltEnabled event value"); - is(ev.setting.value, true, "tiltEnabled event setting value"); + function hideIntroEnabledCheck(ev) { + is(ev.setting, hideIntroEnabled, "hideIntroEnabled event setting"); + is(ev.value, true, "hideIntroEnabled event value"); + is(ev.setting.value, true, "hideIntroEnabled event setting value"); } - tiltEnabled.onChange.add(tiltEnabledCheck); - tiltEnabled.value = true; - is(tiltEnabled.value, true, "tiltEnabled change"); + hideIntroEnabled.onChange.add(hideIntroEnabledCheck); + hideIntroEnabled.value = true; + is(hideIntroEnabled.value, true, "hideIntroEnabled change"); function tabSizeCheck(ev) { is(ev.setting, tabSize, "tabSize event setting"); @@ -87,7 +87,7 @@ function spawnTest() { remoteHost.value = "y.com"; is(remoteHost.value, "y.com", "remoteHost change"); - tiltEnabled.onChange.remove(tiltEnabledCheck); + hideIntroEnabled.onChange.remove(hideIntroEnabledCheck); tabSize.onChange.remove(tabSizeCheck); remoteHost.onChange.remove(remoteHostCheck); @@ -98,18 +98,18 @@ function spawnTest() { } remoteHost.onChange.add(remoteHostReCheck); - tiltEnabled.setDefault(); + hideIntroEnabled.setDefault(); tabSize.setDefault(); remoteHost.setDefault(); remoteHost.onChange.remove(remoteHostReCheck); - is(tiltEnabled.value, tiltEnabledDefault, "tiltEnabled reset"); + is(hideIntroEnabled.value, hideIntroEnabledDefault, "hideIntroEnabled reset"); is(tabSize.value, tabSizeDefault, "tabSize reset"); is(remoteHost.value, remoteHostDefault, "remoteHost reset"); // Cleanup - prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig); + prefBranch.setBoolPref("devtools.gcli.hideIntro", hideIntroOrig); prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig); supportsString.data = remoteHostOrig; prefBranch.setComplexValue("devtools.debugger.remote-host", diff --git a/browser/devtools/framework/target.js b/browser/devtools/framework/target.js index c5391edfbcb..d9ff0d925c8 100644 --- a/browser/devtools/framework/target.js +++ b/browser/devtools/framework/target.js @@ -345,6 +345,10 @@ TabTarget.prototype = { return !!this._tab; }, + get isMultiProcess() { + return !this.window; + }, + get isThreadPaused() { return !!this._isThreadPaused; }, diff --git a/browser/devtools/framework/test/browser_toolbox_options_disable_buttons.js b/browser/devtools/framework/test/browser_toolbox_options_disable_buttons.js index 1b1737b626e..63b351904c1 100644 --- a/browser/devtools/framework/test/browser_toolbox_options_disable_buttons.js +++ b/browser/devtools/framework/test/browser_toolbox_options_disable_buttons.js @@ -74,9 +74,14 @@ function testPreferenceAndUIStateIsConsistent() { function testToggleToolboxButtons() { let checkNodes = [...panelWin.document.querySelectorAll("#enabled-toolbox-buttons-box > checkbox")]; let toolboxButtonNodes = [...doc.querySelectorAll(".command-button")]; - let visibleButtons = toolboxButtonNodes.filter(button=>!button.hasAttribute("hidden")); let toggleableTools = toolbox.toolboxButtons; + // Tilt is disabled in E10S mode so we skip the tilt button if E10S is + // enabled. + if (toolbox.target.isMultiProcess) { + toolboxButtonNodes = [...doc.querySelectorAll(".command-button:not(#command-button-tilt)")]; + } + is (checkNodes.length, toggleableTools.length, "All of the buttons are toggleable." ); is (checkNodes.length, toolboxButtonNodes.length, "All of the DOM buttons are toggleable." ); @@ -92,9 +97,9 @@ function testToggleToolboxButtons() { "DOM buttons should match for: " + id); is (matchedCheckboxes[0].getAttribute("label"), tool.label, - "The label for checkbox matches the tool definition.") + "The label for checkbox matches the tool definition."); is (matchedButtons[0].getAttribute("tooltiptext"), tool.label, - "The tooltip for button matches the tool definition.") + "The tooltip for button matches the tool definition."); } // Store modified pref names so that they can be cleared on error. diff --git a/browser/devtools/framework/toolbox-options.js b/browser/devtools/framework/toolbox-options.js index 3d028eda974..afaeb52a282 100644 --- a/browser/devtools/framework/toolbox-options.js +++ b/browser/devtools/framework/toolbox-options.js @@ -182,6 +182,10 @@ OptionsPanel.prototype = { }; for (let tool of toggleableButtons) { + if (this.toolbox.target.isMultiProcess && tool.id === "command-button-tilt") { + continue; + } + enabledToolbarButtonsBox.appendChild(createCommandCheckbox(tool)); } }, diff --git a/browser/devtools/framework/toolbox.js b/browser/devtools/framework/toolbox.js index 8ea154d0866..b9df282d3ac 100644 --- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -691,6 +691,13 @@ Toolbox.prototype = { if (!button) { return false; } + + // Disable tilt in E10S mode. Removing it from the list of toolbox buttons + // allows a bunch of tests to pass without modification. + if (this.target.isMultiProcess && options.id === "command-button-tilt") { + return false; + } + return { id: options.id, button: button, @@ -698,7 +705,7 @@ Toolbox.prototype = { visibilityswitch: "devtools." + options.id + ".enabled", isTargetSupported: options.isTargetSupported ? options.isTargetSupported : target => target.isLocalTab - } + }; }).filter(button=>button); }, @@ -724,6 +731,18 @@ Toolbox.prototype = { } } }); + + // Tilt is handled separately because it is disabled in E10S mode. Because + // we have removed tilt from toolboxButtons we have to deal with it here. + let tiltEnabled = !this.target.isMultiProcess && + Services.prefs.getBoolPref("devtools.command-button-tilt.enabled"); + let tiltButton = this.doc.getElementById("command-button-tilt"); + + if (tiltEnabled) { + tiltButton.removeAttribute("hidden"); + } else { + tiltButton.setAttribute("hidden", "true"); + } }, /** diff --git a/browser/devtools/shared/test/browser.ini b/browser/devtools/shared/test/browser.ini index 7a6f4ab54f3..5111259060a 100644 --- a/browser/devtools/shared/test/browser.ini +++ b/browser/devtools/shared/test/browser.ini @@ -49,6 +49,8 @@ skip-if = buildapp == 'mulet' [browser_telemetry_button_responsive.js] [browser_telemetry_button_scratchpad.js] [browser_telemetry_button_tilt.js] +skip-if = e10s # Bug 1086492 - Disable tilt for e10s + # Bug 937166 - Make tilt work in E10S mode [browser_telemetry_sidebar.js] [browser_telemetry_toolbox.js] [browser_telemetry_toolboxtabs_canvasdebugger.js] diff --git a/browser/devtools/tilt/test/browser.ini b/browser/devtools/tilt/test/browser.ini index e53a5bdec34..af20a3e9e0d 100644 --- a/browser/devtools/tilt/test/browser.ini +++ b/browser/devtools/tilt/test/browser.ini @@ -1,5 +1,6 @@ [DEFAULT] -skip-if = e10s # Bug ?????? - devtools tests disabled with e10s +skip-if = e10s # Bug 1086492 - Disable tilt for e10s + # Bug 937166 - Make tilt work in E10S mode subsuite = devtools support-files = head.js diff --git a/browser/devtools/tilt/tilt-commands.js b/browser/devtools/tilt/tilt-commands.js index 9a51c038780..9c82828307e 100644 --- a/browser/devtools/tilt/tilt-commands.js +++ b/browser/devtools/tilt/tilt-commands.js @@ -20,13 +20,19 @@ exports.items = [ { name: 'tilt', description: gcli.lookup("tiltDesc"), - manual: gcli.lookup("tiltManual") + manual: gcli.lookup("tiltManual"), + hidden: true }, { name: 'tilt open', description: gcli.lookup("tiltOpenDesc"), manual: gcli.lookup("tiltOpenManual"), + hidden: true, exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); if (!Tilt.currentInstance) { @@ -59,6 +65,10 @@ exports.items = [ }, }, exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); Tilt.toggle(); @@ -68,6 +78,7 @@ exports.items = [ name: 'tilt translate', description: gcli.lookup("tiltTranslateDesc"), manual: gcli.lookup("tiltTranslateManual"), + hidden: true, params: [ { name: "x", @@ -85,6 +96,10 @@ exports.items = [ } ], exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); if (Tilt.currentInstance) { @@ -96,6 +111,7 @@ exports.items = [ name: 'tilt rotate', description: gcli.lookup("tiltRotateDesc"), manual: gcli.lookup("tiltRotateManual"), + hidden: true, params: [ { name: "x", @@ -120,6 +136,10 @@ exports.items = [ } ], exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); if (Tilt.currentInstance) { @@ -131,6 +151,7 @@ exports.items = [ name: 'tilt zoom', description: gcli.lookup("tiltZoomDesc"), manual: gcli.lookup("tiltZoomManual"), + hidden: true, params: [ { name: "zoom", @@ -140,6 +161,10 @@ exports.items = [ } ], exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); @@ -152,7 +177,12 @@ exports.items = [ name: 'tilt reset', description: gcli.lookup("tiltResetDesc"), manual: gcli.lookup("tiltResetManual"), + hidden: true, exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); @@ -165,7 +195,12 @@ exports.items = [ name: 'tilt close', description: gcli.lookup("tiltCloseDesc"), manual: gcli.lookup("tiltCloseManual"), + hidden: true, exec: function(args, context) { + if (isMultiProcess(context)) { + return gcli.lookupFormat("notAvailableInE10S", [this.name]); + } + let chromeWindow = context.environment.chromeDocument.defaultView; let Tilt = TiltManager.getTiltForBrowser(chromeWindow); @@ -173,3 +208,7 @@ exports.items = [ } } ]; + +function isMultiProcess(context) { + return !context.environment.window; +} diff --git a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties index 3fa84363062..f883b3e0393 100644 --- a/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties +++ b/browser/locales/en-US/chrome/browser/devtools/gclicommands.properties @@ -20,6 +20,10 @@ helpDesc=Get help on the available commands # explain the contents of the command help table. helpAvailable=Available Commands +# LOCALIZATION NOTE (notAvailableInE10S) Used in the output of any command that +# is not compatible with multiprocess mode (E10S). +notAvailableInE10S=The command '%1$S' is not available in multiprocess mode (E10S) + # LOCALIZATION NOTE (consoleDesc) A very short string used to describe the # function of the console command. consoleDesc=Commands to control the console