diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-04-08 19:48:21 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-04-08 19:48:21 -0400 |
commit | be78355e8374c566488e1004e3f3c41785dd3dd0 (patch) | |
tree | 58f62cb5314eff2df2425e8a8007a553e0ce8b1c | |
parent | 93b77160ce43384c8b44c00c8c157546fed2ca3a (diff) | |
download | UXP-be78355e8374c566488e1004e3f3c41785dd3dd0.tar UXP-be78355e8374c566488e1004e3f3c41785dd3dd0.tar.gz UXP-be78355e8374c566488e1004e3f3c41785dd3dd0.tar.lz UXP-be78355e8374c566488e1004e3f3c41785dd3dd0.tar.xz UXP-be78355e8374c566488e1004e3f3c41785dd3dd0.zip |
[DEVTOOLS] Resolve issues with dynamically created devtools menu items vs hardcoded vs overlay
Follow up to 1a36001
-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-- | devtools/client/framework/browser-menus.js | 40 |
3 files changed, 28 insertions, 22 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/devtools/client/framework/browser-menus.js b/devtools/client/framework/browser-menus.js index 15d2ec1b6..c0572a928 100644 --- a/devtools/client/framework/browser-menus.js +++ b/devtools/client/framework/browser-menus.js @@ -383,27 +383,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); } /** |