diff options
-rw-r--r-- | application/palemoon/base/content/browser-appmenu.inc | 4 | ||||
-rw-r--r-- | application/palemoon/base/content/browser-menubar.inc | 6 | ||||
-rw-r--r-- | browser/installer/package-manifest.in | 2 | ||||
-rw-r--r-- | devtools/client/framework/browser-menus.js | 44 | ||||
-rw-r--r-- | devtools/client/framework/devtools-browser.js | 83 | ||||
-rw-r--r-- | devtools/client/shared/developer-toolbar.js | 20 |
6 files changed, 115 insertions, 44 deletions
diff --git a/application/palemoon/base/content/browser-appmenu.inc b/application/palemoon/base/content/browser-appmenu.inc index 4869afa11..cfc855484 100644 --- a/application/palemoon/base/content/browser-appmenu.inc +++ b/application/palemoon/base/content/browser-appmenu.inc @@ -144,10 +144,10 @@ observes="workOfflineMenuitemState" oncommand="BrowserOffline.toggleOfflineStatus();"/> <menuseparator/> - <menuitem id="appmenu_javascriptConsole" - observes="devtoolsMenuBroadcaster_ErrorConsole"/> <menuitem id="appmenu_pageSource" observes="devtoolsMenuBroadcaster_PageSource"/> + <menuitem id="appmenu_javascriptConsole" + observes="devtoolsMenuBroadcaster_ErrorConsole"/> </menupopup> </splitmenu> <menuseparator class="appmenu-menuseparator"/> diff --git a/application/palemoon/base/content/browser-menubar.inc b/application/palemoon/base/content/browser-menubar.inc index e947e7d79..fc6bc7694 100644 --- a/application/palemoon/base/content/browser-menubar.inc +++ b/application/palemoon/base/content/browser-menubar.inc @@ -534,12 +534,12 @@ label="&webDeveloperMenu.label;" accesskey="&webDeveloperMenu.accesskey;"> <menupopup id="menuWebDeveloperPopup"> - <menuitem id="javascriptConsole" - observes="devtoolsMenuBroadcaster_ErrorConsole" - accesskey="&errorConsoleCmd.accesskey;"/> <menuitem id="menu_pageSource" observes="devtoolsMenuBroadcaster_PageSource" accesskey="&pageSourceCmd.accesskey;"/> + <menuitem id="javascriptConsole" + observes="devtoolsMenuBroadcaster_ErrorConsole" + accesskey="&errorConsoleCmd.accesskey;"/> </menupopup> </menu> <menuitem id="menu_pageInfo" diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 015daa8c7..88a1aeb73 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -374,8 +374,6 @@ @RESPATH@/browser/components/devtools-startup.js @RESPATH@/browser/components/webideCli.js @RESPATH@/browser/components/webideComponents.manifest -@RESPATH@/browser/components/Experiments.manifest -@RESPATH@/browser/components/ExperimentsService.js @RESPATH@/browser/components/browser-newtab.xpt @RESPATH@/browser/components/aboutNewTabService.js @RESPATH@/browser/components/NewTabComponents.manifest diff --git a/devtools/client/framework/browser-menus.js b/devtools/client/framework/browser-menus.js index 15d2ec1b6..a3ed17bbc 100644 --- a/devtools/client/framework/browser-menus.js +++ b/devtools/client/framework/browser-menus.js @@ -133,10 +133,11 @@ function attachKeybindingsToBrowser(doc, keys) { */ function createToolMenuElements(toolDefinition, doc) { let id = toolDefinition.id; + let appmenuId = "appmenuitem_" + id; let menuId = "menuitem_" + id; // Prevent multiple entries for the same tool. - if (doc.getElementById(menuId)) { + if (doc.getElementById(appmenuId) || doc.getElementById(menuId)) { return; } @@ -321,6 +322,7 @@ function addTopLevelItems(doc) { doc, id: "app" + id, label: l10n(l10nKey + ".label"), + accesskey: null, isCheckbox: item.checkbox }); let menuitem = createMenuItem({ @@ -383,27 +385,33 @@ function addTopLevelItems(doc) { attachKeybindingsToBrowser(doc, keys); + // There are hardcoded menu items in the Web Developer menus plus it is a + // location of menu items via overlays from extensions so we want to make + // sure the last seperator and the "Get More Tools..." items are last. + // This will emulate the behavior when devtools menu items were actually + // physically present in browser.xul + + // Tools > Web Developer + let menu = doc.getElementById("menuWebDeveloperPopup"); + // Insert the Devtools Menu Items before everything else + menu.insertBefore(menuItems, menu.firstChild); + // Move the devtools last seperator and Get More Tools menu items to the bottom + let menu_endSeparator = doc.getElementById("menu_devToolsEndSeparator"); + let menu_getMoreDevtools = doc.getElementById("menu_getMoreDevtools"); + menu.insertBefore(menu_getMoreDevtools, null); + menu.insertBefore(menu_endSeparator, menu_getMoreDevtools); + + // Application Menu > Web Developer (If existant) let appmenu = doc.getElementById("appmenu_webDeveloper_popup"); if (appmenu) { - appmenu.appendChild(appmenuItems); - - // There is still "Page Source" menuitem hardcoded into browser.xul. Instead - // of manually inserting everything around it, move it to the expected - // position. - let appmenu_pageSource = doc.getElementById("appmenu_pageSource"); + // Insert the Devtools Menu Items after the hardcoded idless seperator + appmenu.insertBefore(appmenuItems, appmenu.childNodes[2].nextSibling); + // Move the devtools last seperator and Get More Tools menu items to the bottom let appmenu_endSeparator = doc.getElementById("appmenu_devToolsEndSeparator"); - appmenu.insertBefore(appmenu_pageSource, appmenu_endSeparator); + let appmenu_getMoreDevtools = doc.getElementById("appmenu_getMoreDevtools"); + appmenu.insertBefore(appmenu_getMoreDevtools, null); + appmenu.insertBefore(appmenu_endSeparator, appmenu_getMoreDevtools); } - - let menu = doc.getElementById("menuWebDeveloperPopup"); - menu.appendChild(menuItems); - - // There is still "Page Source" menuitem hardcoded into browser.xul. Instead - // of manually inserting everything around it, move it to the expected - // position. - let menu_pageSource = doc.getElementById("menu_pageSource"); - let menu_endSeparator = doc.getElementById("menu_devToolsEndSeparator"); - menu.insertBefore(menu_pageSource, menu_endSeparator); } /** diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index 152870af3..f032f82aa 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -87,6 +87,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { function toggleMenuItem(id, isEnabled) { let cmd = doc.getElementById(id); + if (!cmd) { + return; + } if (isEnabled) { cmd.removeAttribute("disabled"); cmd.removeAttribute("hidden"); @@ -96,22 +99,39 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { } } + let idEls = []; + // Enable developer toolbar? let devToolbarEnabled = Services.prefs.getBoolPref("devtools.toolbar.enabled"); - toggleMenuItem("menu_devToolbar", devToolbarEnabled); - let focusEl = doc.getElementById("menu_devToolbar"); - if (devToolbarEnabled) { - focusEl.removeAttribute("disabled"); - } else { - focusEl.setAttribute("disabled", "true"); - } + idEls = [ + "appmenu_devToolbar", + "menu_devToolbar" + ]; + idEls.forEach(function (idEl) { + toggleMenuItem(idEl, devToolbarEnabled); + let focusEl = doc.getElementById(idEl); + if (!focusEl) { + return; + } + if (devToolbarEnabled) { + focusEl.removeAttribute("disabled"); + } else { + focusEl.setAttribute("disabled", "true"); + } + }); if (devToolbarEnabled && Services.prefs.getBoolPref("devtools.toolbar.visible")) { win.DeveloperToolbar.show(false).catch(console.error); } // Enable WebIDE? let webIDEEnabled = Services.prefs.getBoolPref("devtools.webide.enabled"); - toggleMenuItem("menu_webide", webIDEEnabled); + idEls = [ + "appmenu_webide", + "menu_webide" + ]; + idEls.forEach(function (idEl) { + toggleMenuItem(idEl, webIDEEnabled); + }); let showWebIDEWidget = Services.prefs.getBoolPref("devtools.webide.widget.enabled"); if (webIDEEnabled && showWebIDEWidget) { @@ -124,11 +144,29 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { let chromeEnabled = Services.prefs.getBoolPref("devtools.chrome.enabled"); let devtoolsRemoteEnabled = Services.prefs.getBoolPref("devtools.debugger.remote-enabled"); let remoteEnabled = chromeEnabled && devtoolsRemoteEnabled; - toggleMenuItem("menu_browserToolbox", remoteEnabled); - toggleMenuItem("menu_browserContentToolbox", remoteEnabled && win.gMultiProcessBrowser); + idEls = [ + "appmenu_browserToolbox", + "menu_browserToolbox" + ]; + idEls.forEach(function (idEl) { + toggleMenuItem(idEl, remoteEnabled); + }); + idEls = [ + "appmenu_browserContentToolbox", + "menu_browserContentToolbox" + ]; + idEls.forEach(function (idEl) { + toggleMenuItem(idEl, remoteEnabled && win.gMultiProcessBrowser); + }); // Enable DevTools connection screen, if the preference allows this. - toggleMenuItem("menu_devtools_connect", devtoolsRemoteEnabled); + idEls = [ + "appmenu_devtools_connect", + "menu_devtools_connect" + ]; + idEls.forEach(function (idEl) { + toggleMenuItem(idEl, devtoolsRemoteEnabled); + }); }, observe: function (subject, topic, prefName) { @@ -613,12 +651,23 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { let hasToolbox = gDevToolsBrowser.hasToolboxOpened(win); - let menu = win.document.getElementById("menu_devToolbox"); - if (hasToolbox) { - menu.setAttribute("checked", "true"); - } else { - menu.removeAttribute("checked"); - } + let idEls = []; + + idEls = [ + "appmenu_devToolbox", + "menu_devToolbox" + ]; + idEls.forEach(function (idEl) { + let menu = win.document.getElementById(idEl); + if (!menu) { + return; + } + if (hasToolbox) { + menu.setAttribute("checked", "true"); + } else { + menu.removeAttribute("checked"); + } + }); } }, diff --git a/devtools/client/shared/developer-toolbar.js b/devtools/client/shared/developer-toolbar.js index 2528591a6..d84402418 100644 --- a/devtools/client/shared/developer-toolbar.js +++ b/devtools/client/shared/developer-toolbar.js @@ -449,7 +449,15 @@ DeveloperToolbar.prototype.show = function (focus) { [ this.tooltipPanel, this.outputPanel ] = panels; - this._doc.getElementById("menu_devToolbar").setAttribute("checked", "true"); + let checkboxValue = "true"; + let appmenuEl = this._doc.getElementById("appmenu_devToolbar"); + let menuEl = this._doc.getElementById("menu_devToolbar"); + if (appmenuEl) { + appmenuEl.setAttribute("checked", checkboxValue); + } + if (menuEl) { + menuEl.setAttribute("checked", checkboxValue); + } this.target = TargetFactory.forTab(this._chromeWindow.gBrowser.selectedTab); const options = { @@ -569,7 +577,15 @@ DeveloperToolbar.prototype.hide = function () { Services.prefs.setBoolPref("devtools.toolbar.visible", false); - this._doc.getElementById("menu_devToolbar").setAttribute("checked", "false"); + let checkboxValue = "false"; + let appmenuEl = this._doc.getElementById("appmenu_devToolbar"); + let menuEl = this._doc.getElementById("menu_devToolbar"); + if (appmenuEl) { + appmenuEl.setAttribute("checked", checkboxValue); + } + if (menuEl) { + menuEl.setAttribute("checked", checkboxValue); + } this.destroy(); this._telemetry.toolClosed("developertoolbar"); |