From 7b9b08e2071331738ae1dde7a7efd8c145448b90 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 8 Apr 2018 00:14:08 +0200 Subject: CustomizableUI.jsm can't be used for Pale Moon - setting conditions Issue #97 --- devtools/client/framework/devtools-browser.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'devtools') diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index b9f4d92ba0..5193592ddf 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -27,9 +27,12 @@ loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true); loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true); loader.lazyRequireGetter(this, "BrowserMenus", "devtools/client/framework/browser-menus"); -loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm"); loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); +if (AppConstants.MOZ_APP_NAME.toLowerCase() != "palemoon") { + loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm"); +} + const {LocalizationHelper} = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); @@ -295,6 +298,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { * Install Developer widget */ installDeveloperWidget: function () { + if (typeof CustomizableUI === "undefined") { + return; + } let id = "developer-button"; let widget = CustomizableUI.getWidget(id); if (widget && widget.provider == CustomizableUI.PROVIDER_API) { @@ -350,7 +356,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { */ // Used by itself installWebIDEWidget: function () { - if (this.isWebIDEWidgetInstalled()) { + if ((typeof CustomizableUI === "undefined") || this.isWebIDEWidgetInstalled()) { return; } @@ -374,6 +380,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { }, isWebIDEWidgetInstalled: function () { + if (typeof CustomizableUI === "undefined") { + return false; + } let widgetWrapper = CustomizableUI.getWidget("webide-button"); return !!(widgetWrapper && widgetWrapper.provider == CustomizableUI.PROVIDER_API); }, @@ -387,6 +396,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { * Uninstall WebIDE widget */ uninstallWebIDEWidget: function () { + if (typeof CustomizableUI === "undefined") { + return; + } if (this.isWebIDEWidgetInstalled()) { CustomizableUI.removeWidgetFromArea("webide-button"); } @@ -398,6 +410,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { */ // Used by webide.js moveWebIDEWidgetInNavbar: function () { + if (typeof CustomizableUI === "undefined") { + return; + } CustomizableUI.addWidgetToArea("webide-button", CustomizableUI.AREA_NAVBAR); }, -- cgit v1.2.3 From de97da2446fe6eb72b8920cd09a510e5ee9ddc68 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 8 Apr 2018 08:21:28 +0200 Subject: Use preprocessing instead of AppConstants.jsm --- devtools/client/framework/devtools-browser.js | 39 ++++++++++++++++----------- devtools/client/framework/moz.build | 5 +++- 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'devtools') diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index 5193592ddf..2c7f76e95d 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -28,10 +28,9 @@ loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", loader.lazyRequireGetter(this, "BrowserMenus", "devtools/client/framework/browser-menus"); loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); - -if (AppConstants.MOZ_APP_NAME.toLowerCase() != "palemoon") { +#ifdef MC_BASILISK loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm"); -} +#endif const {LocalizationHelper} = require("devtools/shared/l10n"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); @@ -298,9 +297,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { * Install Developer widget */ installDeveloperWidget: function () { - if (typeof CustomizableUI === "undefined") { - return; - } +#ifdef MC_BASILISK let id = "developer-button"; let widget = CustomizableUI.getWidget(id); if (widget && widget.provider == CustomizableUI.PROVIDER_API) { @@ -349,6 +346,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { doc.getElementById("PanelUI-multiView").appendChild(view); } }); +#else + return; +#endif }, /** @@ -356,7 +356,8 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { */ // Used by itself installWebIDEWidget: function () { - if ((typeof CustomizableUI === "undefined") || this.isWebIDEWidgetInstalled()) { +#ifdef MC_BASILISK + if (this.isWebIDEWidgetInstalled()) { return; } @@ -377,14 +378,18 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { gDevToolsBrowser.openWebIDE(); } }); +#else + return; +#endif }, isWebIDEWidgetInstalled: function () { - if (typeof CustomizableUI === "undefined") { - return false; - } +#ifdef MC_BASILISK let widgetWrapper = CustomizableUI.getWidget("webide-button"); return !!(widgetWrapper && widgetWrapper.provider == CustomizableUI.PROVIDER_API); +#else + return false; +#endif }, /** @@ -396,13 +401,14 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { * Uninstall WebIDE widget */ uninstallWebIDEWidget: function () { - if (typeof CustomizableUI === "undefined") { - return; - } +#ifdef MC_BASILISK if (this.isWebIDEWidgetInstalled()) { CustomizableUI.removeWidgetFromArea("webide-button"); } CustomizableUI.destroyWidget("webide-button"); +#else + return; +#endif }, /** @@ -410,10 +416,11 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = { */ // Used by webide.js moveWebIDEWidgetInNavbar: function () { - if (typeof CustomizableUI === "undefined") { - return; - } +#ifdef MC_BASILISK CustomizableUI.addWidgetToArea("webide-button", CustomizableUI.AREA_NAVBAR); +#else + return; +#endif }, /** diff --git a/devtools/client/framework/moz.build b/devtools/client/framework/moz.build index 7b28b4b9e7..407e21f8bc 100644 --- a/devtools/client/framework/moz.build +++ b/devtools/client/framework/moz.build @@ -13,7 +13,6 @@ DevToolsModules( 'about-devtools-toolbox.js', 'attach-thread.js', 'browser-menus.js', - 'devtools-browser.js', 'devtools.js', 'gDevTools.jsm', 'location-store.js', @@ -31,3 +30,7 @@ DevToolsModules( 'toolbox.js', 'ToolboxProcess.jsm', ) + +FINAL_TARGET_PP_FILES.chrome.devtools.modules.devtools.client.framework += [ + 'devtools-browser.js', +] -- cgit v1.2.3 From 7a480d55716ee5d01d65e3f1a3ae9a15d4de9c7a Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 8 Apr 2018 08:23:40 +0200 Subject: Style clean up --- devtools/client/framework/devtools-browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'devtools') diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index 2c7f76e95d..7b0647d19b 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -29,7 +29,7 @@ loader.lazyRequireGetter(this, "BrowserMenus", "devtools/client/framework/browse loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); #ifdef MC_BASILISK - loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm"); +loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm"); #endif const {LocalizationHelper} = require("devtools/shared/l10n"); -- cgit v1.2.3