[FIXED] CB broken on Firefox 48

Post information about bugs here

[FIXED] CB broken on Firefox 48

Postby Odyseus » Mon Mar 14, 2016 12:46 am

EDIT: The problems described in this post where fixed on version 0.0.5.8.9 of Custom Buttons add-on.
Consider the attached files as obsolete.


Hello, everybody.

I would like to report that the current version of Custom Buttons add-on (0.0.5.8.6) is broken on Firefox version 48 Nightly.

Details
Buttons can't be installed/edited and the list of buttons in about:addons is empty.
This was relatively easy to fix. It seems that Mozilla removed the "newChannel" method from the nsIIOService service (¬¬). I just changed all instances of newChannel to newChannel2 and passed some more arguments needed. This fixed the button installation/edition problem, the list of buttons on about:addons being empty and the image conversion to Base64.

Update March 15, 2016
Based on the suggestion by InfoCatcher, I changed the code to use newChannelFromURIWithLoadInfo instead of newChannel2. I tested this changes on Palemoon, SeaMonkey, Firefox Stable/Dev. Edition/Nightly. Everything works as it should. Thanks, InfoCatcher!

Attached to this post can be found a fixed version of Custom Buttons add-on.

Changes made to the attached file
File chrome/custombuttons/content/custombuttons/protocol/CustomButtonProtocol.js inside getXULTemplate method.
Changed:
Code: Select all
var xulchan = ios.newChannel("chrome://custombuttons/content/tcbbutton.xul", null, null);

To:
Code: Select all
var url = "chrome://custombuttons/content/tcbbutton.xul";
var xulchan = "newChannel" in ios ?
   ios.newChannel(url, null, null) :
   ios.newChannelFromURIWithLoadInfo(ios.newURI(url, null, null), null);


File components/CustomButtonsService.js inside ImageConverter function.
Changed:
Code: Select all
this.channel = ios.newChannel(imageURL, null, null);

To:
Code: Select all
this.channel = "newChannel" in ios ?
   ios.newChannel(imageURL, null, null) :
   ios.newChannelFromURIWithLoadInfo(ios.newURI(imageURL, null, null), null);


File components/CustomButtonsService.js inside get overlayDocument method.
Changed:
Code: Select all
var xulchan = ios.newChannel(uri, null, null);

To:
Code: Select all
var xulchan = "newChannel" in ios ?
   ios.newChannel(uri, null, null) :
   ios.newChannelFromURIWithLoadInfo(ios.newURI(uri, null, null), null);


File modules/addons4.js inside getOverlayDocument method.
Changed:
Code: Select all
var xulchan = ios.newChannel(uri, null, null);

To:
Code: Select all
var xulchan = "newChannel" in ios ?
   ios.newChannel(uri, null, null) :
   ios.newChannelFromURIWithLoadInfo(ios.newURI(uri, null, null), null);


Notes to "End users"
The fixed add-on attached to this post is only necessary for Firefox 48 (Nightly as of now). Any other version of Firefox with CB add-on installed from AMO (addons.mozilla.org) will have absolutelly no problems (other than the known ones, of cource).

Rename the .zip file extension to .xpi to install
Attachments
custom_buttons-0.0.5.8.6-sm tb fx.zip
Custom Buttons add-on fixed for Firefox 48
(151.28 KiB) Downloaded 60 times
Last edited by Odyseus on Mon Apr 04, 2016 2:09 am, edited 6 times in total.
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

Re: Custom Buttons broken on Firefox version 48

Postby makondo » Mon Mar 14, 2016 2:19 am

Image
makondo
 
Posts: 1620
Joined: Sun Dec 25, 2011 7:17 pm

Re: Custom Buttons broken on Firefox version 48

Postby Infocatcher » Tue Mar 15, 2016 2:17 pm

Simplified replacement for ios.newChannel():
https://forum.mozilla-russia.org/viewtopic.php?pid=710007#p710007
But looks like newChannelFromURIWithLoadInfo(nsIURI, null) works only in Firefox 44+ (but this method exists since Firefox 37+).
So, should be used newChannel(), if available, like
Code: Select all
    this. channel = "newChannel" in ios
        ? ios. newChannel (imageURL, null, null)
        : ios. newChannelFromURIWithLoadInfo (ios. newURI (imageURL, null, null), null);
Infocatcher
 
Posts: 123
Joined: Sat Jul 21, 2012 5:04 pm

Re: Custom Buttons broken on Firefox version 48

Postby Odyseus » Tue Mar 15, 2016 9:26 pm

Thank you very much for your suggestion, Infocatcher! I already changed the code and the attached extension on my first post. And thanks to Dumby (a user from Mozilla Russian forum) too.

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

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby trapper john » Fri Mar 18, 2016 1:02 pm

A fix for the 48.0 break was officially released by antonglv on the Mozilla addon page version 0.0.5.8.7 but with that many of the buttons don't work and in about:addons there's nothing to edit, it's blank. For now I went back to this.
trapper john
 
Posts: 107
Joined: Wed Mar 14, 2012 6:58 pm

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby makondo » Fri Mar 18, 2016 5:13 pm

5.8.7 works for me (Fx48), try reinstalling it.
What does it mean: "... in about:addons there's nothing to edit, it's blank ..."? What's 'blank'?
makondo
 
Posts: 1620
Joined: Sun Dec 25, 2011 7:17 pm

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby trapper john » Fri Mar 18, 2016 6:43 pm

makondo wrote:5.8.7 works for me (Fx48), try reinstalling it.
What does it mean: "... in about:addons there's nothing to edit, it's blank ..."? What's 'blank'?

In about:addons on the left pane the bottom button is the Custom Button configuration window to edit your buttons or delete them. With the official 0.5.8.7 version that's blank, just as it is with earlier versions. Additionally, a few buttons no longer work at all. Everything's fine with Odyseus's fix so I'm just going to stay with that.
trapper john
 
Posts: 107
Joined: Wed Mar 14, 2012 6:58 pm

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby antonglv » Fri Mar 18, 2016 6:53 pm

trapper john wrote:0.0.5.8.7 but with that many of the buttons don't work


Couldn't you point me for these buttons, please?

and in about:addons there's nothing to edit, it's blank. For now I went back to this.


Yes, thank you for your note. I missed changes in modules/addons4.js. Fix will be released next week.
antonglv
Site Admin
 
Posts: 62
Joined: Wed Dec 21, 2011 3:56 pm

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby trapper john » Fri Mar 18, 2016 7:08 pm

Hello antonglv, here's an example of a button broke with 0.0.5.8.7 but works with the Odyseus download:

Code: Select all
/*CODE*/

var MyString = custombuttons.cbService.readFromClipboard();
MyString = MyString. replace (/(.*anon-www.cgi+[^%2F])/, ""); // remove "anon-www.cgi+[^%2F]" character and all before it
gClipboard.write(MyString);

var myurl = gClipboard.read();

  if(myurl.substring(0,8) == "https://")
  {
    //window.open(myurl);
      loadURI(myurl);
  }
  else
  {
    if(myurl.substring(0,7) == "http://")
    {
      //window.open(myurl);
        loadURI(myurl);
    }
    else
   
    {
   
    loadURI("http://" + myurl)
   
    // alert("URL error. Clipboard contents are:- " + myurl);
    }
  }


What this button does is remove certain beginning characters of a url. It's also a paste and go button that should work with any url starting with http or https.
Last edited by trapper john on Fri Mar 18, 2016 7:23 pm, edited 1 time in total.
trapper john
 
Posts: 107
Joined: Wed Mar 14, 2012 6:58 pm

Re: [Fixed ext. attached] CB broken on Firefox 48

Postby antonglv » Fri Mar 18, 2016 7:22 pm

trapper john, thank you. Another question:

trapper john wrote:Additionally, a few buttons no longer work at all.


Do all these buttons work with the clipboard?
antonglv
Site Admin
 
Posts: 62
Joined: Wed Dec 21, 2011 3:56 pm

Next

Return to Bug report