[Signed fixed extension attached] CB broken on Firefox 48+

Post information about bugs here

[Signed fixed extension attached] CB broken on Firefox 48+

Postby Odyseus » Thu May 05, 2016 1:54 pm

Signed fixed version attached to this topic.

Hello, everybody.

Like the title says, Custom Buttons add-on is broken on all Firefox versions higher than 48.

Error number one
Some button properties defined by the add-on, like this.Help, are undefined. And some global properties, like window.name, throws errors (TypeError: this.hasAttribute is not a function). It seems that it has something to do with bug 943958, but I'm not sure.
I fixed this by simply editing the file cbbuttonimpl.js. I changed all instances of __defineGetter__ and __defineSetter__ to this.__defineGetter__ and this.__defineSetter__. I don't know if this is the right way to fix this. Like always, that's for the experts to decide.

Error number two
The console is broken again. Instead of opening the edit window of the button with the line highlighted, it tries to directly open the chrome://custombuttons-context/content/button.js file. This has happened several times before in other CB breakages, but this time I don't know how to fix it.

Error number three
This is more an annoyance than an error. Since the changes on Custom Buttons add-on to fix the newChannel deprecation on the nsIIOService service, every time a button is edited and/or initialized, the console is poluted with warnings like this:
Code: Select all
Warning: 'nsIOService::NewChannel()' deprecated, please use 'nsIOService::NewChannel2()'

Inverting the condition in the getChannel method inside the CustomButtonsService.js file seems to get rid of that annoying warning.
Code: Select all
getChannel: function (aSpec, aContentPolicy) {
    var ios = Components. classes ["@mozilla.org/network/io-service;1"]. getService (Components. interfaces.nsIIOService);
    var chan;
    var contentPolicy = aContentPolicy || Components. interfaces. nsIContentPolicy. TYPE_OTHER;
    if ("newChannel2" in ios)
        chan = ios. newChannel2 (
            aSpec,
            null,
            null,
            null,
            Components. classes ["@mozilla.org/systemprincipal;1"]. createInstance (Components. interfaces.nsIPrincipal),
            null,
            Components. interfaces. nsILoadInfo. SEC_NORMAL,
            contentPolicy);
    else
        chan = ios. newChannel (aSpec, null, null);
    return chan;
}


The following two attached extensions are packaged by InfoCatcher and are the same files added by him on several messages in this very topic. Both attached extensions are exactly the same. One is signed and the other isn't. Install the one you need to.

Fixes by InfoCatcher and Dumby

  • Fixed the errors reported on this topic.
  • Fixed the error reported in this other topic (DOMParser breakage).
  • Fixed base64 converter and opening editor from console in Firefox 55+ (due to nsISupportsArray removal).

Remove the ".zip" extension from the file name to be able to install the attached extension.
Also uninstall or disable any other version of Custom Buttons add-on from your browser.
Attachments
custom_buttons-0.0.5.8.9-fixed4-signed.xpi.zip
Signed extension
(126.83 KiB) Downloaded 543 times
custom_buttons-0.0.5.8.9-fixed4.xpi.zip
Unsigned extension
(117.44 KiB) Downloaded 136 times
Last edited by Odyseus on Fri Mar 10, 2017 9:13 pm, edited 16 times in total.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: CB broken on all Firefox versions higher than 48

Postby leamphil » Sat Aug 06, 2016 12:29 pm

When I upgrade to FF 48 the Custom Buttons extension (which I updated with this version) is disabled because it is not signed - is there a way round this ?
leamphil
 
Posts: 5
Joined: Fri Feb 12, 2016 11:28 am

Re: CB broken on all Firefox versions higher than 48

Postby Odyseus » Sat Aug 06, 2016 8:29 pm

Hello, leamphil.

Mozilla has made the add-on signing "feature" mandatory in Firefox Stable (48) and Beta (49). Your only choices as of now is to switch to any other version of Firefox in which add-on signing can be disabled (Firefox ESR (40)/Developer Edition (50)/Nightly (51)).

There is another option. Install an Unbranded build of Firefox Stable/Beta. Until recently, the stable version wasn't available, but I checked now and it's there to download. In the Unbranded versions, the add-on signing "feature" can be disabled.

Edit
I forgot to mention 2 things about these "unbranded" versions.
  • These versions are called Nightly. It doesn't matter if you install the Unbranded Stable (48) or Beta (49).
  • There is (or was) a bug in these versions that would update them to their "branded" counterparts. Mozilla suggests to disable the update functionality for the time being until the bug is resolved (app.update.enabled to false).

In case you don't know how to disable add-on signing, you just have to set the preference called xpinstall.signatures.required to false and restart.

Image
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: CB broken on all Firefox versions higher than 48

Postby srazzano » Sat Aug 06, 2016 11:47 pm

Or Comodo IceDragon. A fork of Firefox 47.0.2, with added security. Just ensure the about:config pref xpinstall.signatures.required is set to false.
srazzano
 
Posts: 1472
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: CB broken on all Firefox versions higher than 48

Postby leamphil » Sun Aug 07, 2016 9:03 am

Any chance of getting a signed version of Custom Buttons ?
leamphil
 
Posts: 5
Joined: Fri Feb 12, 2016 11:28 am

Re: CB broken on all Firefox versions higher than 48

Postby morat » Sun Aug 07, 2016 2:24 pm

Does the autoconfig hack work with the Firefox release build?

In FF 48, how do I enable unsigned extensions? (post by paltus)
http://forums.mozillazine.org/viewtopic ... &t=3016811

I couldn't get it to work with the Firefox Portable release build.

Deploying Firefox in an enterprise environment
http://developer.mozilla.org/en-US/Fire ... deployment
morat
 
Posts: 944
Joined: Wed Dec 28, 2011 2:38 pm

Re: CB broken on all Firefox versions higher than 48

Postby Odyseus » Sun Aug 07, 2016 8:28 pm

Hello, g@ys.

leamphil wrote:Any chance of getting a signed version of Custom Buttons ?

Yes, there is a way. You can read about it in the link that I posted in my previous message (How do I get my add-ons signed if they are not hosted on addons.mozilla.org (AMO)?). But I'm not willing to go through that bother.

Your best option is to change the Firefox version you are using to any of the Firefox versions in which add-on signing can still be disabled, or to a Firefox fork of your choice. Read bellow for another option.

@morat: Infinite thanks for that!!! And infinite thanks to Dumby too!! He is a freaking genius!!! Just today my Firefox updated to 48 and I tested that method you posted. It works great. It doesn't even matter if the preference xpinstall.signatures.required is set to true or false. Although, I have to say, I found a side effect to that tweak. It always opens Firefox with its window un-maximized.

Here are the details to disable add-on signing with the method posted above by morat.

Create a file called config.js in Firefox install folder with this content (Copy the code EXACTLY how is presented!!!):
Code: Select all
//
try {
   Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {})
      .eval("SIGNED_TYPES.clear()");
} catch (ex) {}


Edit
If the side effect of this tweak (Firefox starting un-miximized) is a problem, it can be "fixed" with this code on the config.js file:
Code: Select all
//
try {
   Components.utils.import("resource://gre/modules/Services.jsm");
   var bsp = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
   bsp.eval("SIGNED_TYPES.clear();");

   var topic = "browser-delayed-startup-finished";
   Services.obs.addObserver({
      observe(aWin) {
         Services.obs.removeObserver(this, topic);
         aWin.maximize();
      }
   }, topic, false);
} catch (ex) {}


Create a file called config-prefs.js in [Firefox install folder]/defaults/pref folder with this content:
Code: Select all
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");


After restart, all unsigned extensions can be enabled. If not, it might be necessary to re-install all unsigned extensions.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: CB broken on all Firefox versions higher than 48

Postby morat » Mon Aug 08, 2016 1:42 pm

Okay. I got it working with Firefox Portable. I forgot to start with a comment.

Configuration
http://developer.mozilla.org/en-US/Fire ... figuration

* C:\FirefoxPortable\App\Firefox\defaults\pref\autoconfig.js

Code: Select all
// autoconfig.js file needs to start with a comment

pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);

* C:\FirefoxPortable\App\Firefox\mozilla.cfg

Code: Select all
// mozilla.cfg file needs to start with a comment

pref("browser.startup.homepage", "about:logo"); // test

try {
  Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}).
    eval("SIGNED_TYPES.clear()");
} catch (e) {}

XPIProvider.jsm
http://dxr.mozilla.org/mozilla-release/ ... ovider.jsm

Code: Select all
const SIGNED_TYPES = new Set([
  "webextension",
  "extension",
  "experiment",
]);

Set object
http://developer.mozilla.org/en-US/docs ... bjects/Set
http://developer.mozilla.org/en-US/docs ... /Set/clear
morat
 
Posts: 944
Joined: Wed Dec 28, 2011 2:38 pm

Re: CB broken on all Firefox versions higher than 48

Postby morat » Mon Aug 08, 2016 11:31 pm

In FF 48, how do I enable unsigned extensions?
http://forums.mozillazine.org/viewtopic ... &t=3016811

The requested topic does not exist.

I bet a Mozilla developer asked a moderator to delete the topic.

I guess the hack will stop working in a future version.
morat
 
Posts: 944
Joined: Wed Dec 28, 2011 2:38 pm

Re: CB broken on all Firefox versions higher than 48

Postby tk2hmpY152doGUEZ » Fri Aug 12, 2016 1:14 am

Has this extension been abandoned? Is there any hope for an update?
tk2hmpY152doGUEZ
 
Posts: 19
Joined: Sun Aug 17, 2014 8:29 pm

Next

Return to Bug report