From 15e27b8858bf6e46fdf2d62b4f5a0818b1e85d55 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Mon, 11 Mar 2019 02:16:57 +0100 Subject: Check how to add the button based on the app ID Unlike checking different versions of Firefox, the features that Basilisk has over Pale Moon (and viceversa) are better known and just checking the application ID is enough to understand how to add the button to the toolbar. --- js/vapi-background.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'js/vapi-background.js') diff --git a/js/vapi-background.js b/js/vapi-background.js index cca47c6..ae933b7 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -2362,24 +2362,16 @@ vAPI.toolbarButton = { /******************************************************************************/ -// Firefox 28 and less - (function() { + // Add toolbar button for not-Basilisk + if (Services.appinfo.ID === "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") { + return; + } + var tbb = vAPI.toolbarButton; if ( tbb.init !== null ) { return; } - var CustomizableUI = null; - var forceLegacyToolbarButton = vAPI.localStorage.getBool('forceLegacyToolbarButton'); - if ( !forceLegacyToolbarButton ) { - try { - CustomizableUI = Cu.import('resource:///modules/CustomizableUI.jsm', null).CustomizableUI; - } catch (ex) { - } - } - if ( CustomizableUI !== null ) { - return; - } tbb.codePath = 'legacy'; tbb.viewId = tbb.id + '-panel'; @@ -2604,13 +2596,20 @@ vAPI.toolbarButton = { /******************************************************************************/ -// Firefox Australis < 36. - (function() { + // Add toolbar button for Basilisk + if (Services.appinfo.ID !== "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") { + return; + } + var tbb = vAPI.toolbarButton; if ( tbb.init !== null ) { return; } + + // The following guard seems to always be false for Basilisk, so + // the button will always be added using the code from this + // branch. if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') >= 0 ) { return null; } -- cgit v1.2.3 From 6fe211f4396445f6ec01eb91ee66ef91956714ff Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Mon, 11 Mar 2019 02:21:36 +0100 Subject: Remove useless preference and check app ID in second Basilisk branch the `forceLegacyToolbarButton' preference is useless because on Pale Moon the button is always added with the "legacy" method, while on Basilisk it's always added with CustomizableUI, so there is nothing to "force" here. Also add a check that was forgotten in the previous commit. --- js/vapi-background.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/vapi-background.js') diff --git a/js/vapi-background.js b/js/vapi-background.js index ae933b7..d60ef53 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -2613,9 +2613,6 @@ vAPI.toolbarButton = { if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') >= 0 ) { return null; } - if ( vAPI.localStorage.getBool('forceLegacyToolbarButton') ) { - return null; - } var CustomizableUI = null; try { CustomizableUI = Cu.import('resource:///modules/CustomizableUI.jsm', null).CustomizableUI; @@ -2739,6 +2736,12 @@ vAPI.toolbarButton = { // It appears that this branch actually works on the latest // Basilisk. Maybe we can simply use this one directly instead of // making checks like it's done now. + + // Add toolbar button for Basilisk + if (Services.appinfo.ID !== "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") { + return; + } + var tbb = vAPI.toolbarButton; if ( tbb.init !== null ) { return; @@ -2746,9 +2749,6 @@ vAPI.toolbarButton = { if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') < 0 ) { return null; } - if ( vAPI.localStorage.getBool('forceLegacyToolbarButton') ) { - return null; - } var CustomizableUI = null; try { CustomizableUI = Cu.import('resource:///modules/CustomizableUI.jsm', null).CustomizableUI; -- cgit v1.2.3 From d6c1aa52f3deb52dd6be7178dae84b6f0f99f8a7 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Thu, 14 Mar 2019 10:25:07 +0100 Subject: Let Basilisk be considered "modern Firefox" --- js/vapi-background.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/vapi-background.js') diff --git a/js/vapi-background.js b/js/vapi-background.js index d60ef53..22210bb 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -48,8 +48,9 @@ const {Services} = Cu.import('resource://gre/modules/Services.jsm', null); var vAPI = self.vAPI = self.vAPI || {}; vAPI.firefox = true; -vAPI.modernFirefox = Services.appinfo.ID === '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}' && - Services.vc.compare(Services.appinfo.platformVersion, '44') > 0; + vAPI.modernFirefox = + Services.appinfo.ID === '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}' + && Services.vc.compare(Services.appinfo.version, '44') > 0; /******************************************************************************/ -- cgit v1.2.3 From 06477d47ccb113847b68af3657438183c5fb12af Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Thu, 14 Mar 2019 10:28:35 +0100 Subject: Use the right property for version checks in Basilisk --- js/vapi-background.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'js/vapi-background.js') diff --git a/js/vapi-background.js b/js/vapi-background.js index 22210bb..6ca7572 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -2608,10 +2608,7 @@ vAPI.toolbarButton = { return; } - // The following guard seems to always be false for Basilisk, so - // the button will always be added using the code from this - // branch. - if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') >= 0 ) { + if ( Services.vc.compare(Services.appinfo.version, '36.0') >= 0 ) { return null; } var CustomizableUI = null; @@ -2747,7 +2744,7 @@ vAPI.toolbarButton = { if ( tbb.init !== null ) { return; } - if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') < 0 ) { + if ( Services.vc.compare(Services.appinfo.version, '36.0') < 0 ) { return null; } var CustomizableUI = null; -- cgit v1.2.3 From 387fb6a0f9a96ff684cea262453a7f5b6afcfbb4 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 23 Apr 2019 15:05:52 +0200 Subject: Use "modern" branch unconditionally Tests showed that it works without any noticeable problems. As such, it was deemed better to throw it in the wild and see what happens. If there are any problems, this commit can simply be reverted. --- js/vapi-background.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'js/vapi-background.js') diff --git a/js/vapi-background.js b/js/vapi-background.js index 6ca7572..08a84bc 100644 --- a/js/vapi-background.js +++ b/js/vapi-background.js @@ -2597,6 +2597,7 @@ vAPI.toolbarButton = { /******************************************************************************/ +/* (function() { // Add toolbar button for Basilisk if (Services.appinfo.ID !== "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") { @@ -2669,7 +2670,7 @@ vAPI.toolbarButton = { CustomizableUI.getWidget(tbb.id).areaType === CustomizableUI.TYPE_MENU_PANEL ); } catch (ex) { - /* noop */ + // noop } }; @@ -2725,16 +2726,18 @@ vAPI.toolbarButton = { cleanupTasks.push(shutdown); }; })(); +*/ /******************************************************************************/ -// Firefox Australis >= 36. - (function() { // It appears that this branch actually works on the latest // Basilisk. Maybe we can simply use this one directly instead of // making checks like it's done now. + // It was decided to use this branch unconditionally. It's still + // experimental though. + // Add toolbar button for Basilisk if (Services.appinfo.ID !== "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") { return; @@ -2744,9 +2747,9 @@ vAPI.toolbarButton = { if ( tbb.init !== null ) { return; } - if ( Services.vc.compare(Services.appinfo.version, '36.0') < 0 ) { - return null; - } + // if ( Services.vc.compare(Services.appinfo.version, '36.0') < 0 ) { + // return null; + // } var CustomizableUI = null; try { CustomizableUI = Cu.import('resource:///modules/CustomizableUI.jsm', null).CustomizableUI; -- cgit v1.2.3