[FIXED] CB broken on Firefox 48

Post information about bugs here

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

Postby makondo » Fri Mar 18, 2016 7:28 pm

antonglv wrote:
trapper john wrote: ... 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


Thank you!
Last edited by makondo on Fri Mar 18, 2016 7:32 pm, edited 2 times in total.
makondo
 
Posts: 1587
Joined: Sun Dec 25, 2011 7:17 pm

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

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

After re-going through all my buttons with 0.0.5.8.7 that turns out to be the only one. I thought there were a few more but those are good. So it could be related to the clipboard.
trapper john
 
Posts: 102
Joined: Wed Mar 14, 2012 6:58 pm

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

Postby Odyseus » Sat Mar 19, 2016 12:52 am

Hello, g@ys.

@antonglv: It seems that the error in trapper john's code is triggered by custombuttons.cbService.readFromClipboard() which now, on CB 0.0.5.8.7, it requires an argument. Passing null (custombuttons.cbService.readFromClipboard(null)) will fix it.

@trapper john: Just curious. Your code does this. It reads from the clipboard and stores it in a variable, it modifies that variable and then it saves to the clipboard and then it reads from the clipboard again in another variable. Why do all that when you can read from clipboard just once? Like this:
Code: Select all
/*CODE*/
var myURL = gClipboard.read();
myURL = myURL.replace(/(.*anon-www.cgi+[^%2F])/, ""); // remove "anon-www.cgi+[^%2F]" character and all before it

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);
   }
}


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

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

Postby antonglv » Sat Mar 19, 2016 1:03 am

Odyseus wrote:It seems that the error in trapper john's code is triggered by custombuttons.cbService.readFromClipboard() which now, on CB 0.0.5.8.7, it requires an argument.


Since 0.0.5.8.8 the argument to readFromClipboard will be optional.
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 » Sat Mar 19, 2016 1:28 am

@antonglv, 0.0.5.8.8 is working perfectly, thanks very much for this invaluable addon.

@Odyseus, it was a downloaded button and I just changed the characters while keeping everything else the same. There is a purpose between the two versions. In the original code when you copied to the clipboard with the characters to remove included and then re-copied it to Notepad the url is stripped of the characters.

With your revised code when re-copying to Notepad the original url with the characters remain. It all depends on what the user prefers. It was often frustrating for me that the characters were gone so your code is preferable for me.
Last edited by trapper john on Sat Mar 19, 2016 2:18 am, edited 3 times in total.
trapper john
 
Posts: 102
Joined: Wed Mar 14, 2012 6:58 pm

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

Postby makondo » Sat Mar 19, 2016 1:54 am

Thanks, Anton!
makondo
 
Posts: 1587
Joined: Sun Dec 25, 2011 7:17 pm

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

Postby trapper john » Sat Mar 19, 2016 1:36 pm

@antonglv, with 0.0.5.8.8 is the base64 converting in 48.0 for you? I uploaded a png image but nothing happens.
trapper john
 
Posts: 102
Joined: Wed Mar 14, 2012 6:58 pm

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

Postby makondo » Sat Mar 19, 2016 3:55 pm

^ I see this too.
makondo
 
Posts: 1587
Joined: Sun Dec 25, 2011 7:17 pm

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

Postby Odyseus » Sun Mar 20, 2016 3:12 am

Hello, g@ys.

@antonglv: The problem seems to be in the ImageConverter function inside the CustomButtonsService.js file. If I edit the code like this:
Code: Select all
//this.channel = cbs.getChannel(imageURL, Components.interfaces.nsIContentPolicy.TYPE_IMAGE);
this.channel = cbs.getChannel(imageURL);

This forces the content policy argument for the newChannel2 method to be Components.interfaces.nsIContentPolicy.TYPE_OTHER and the image conversion works fine.

By the way, when pressing the => Base64 button something does happen. It throws this error:
Code: Select all
NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 1 [cbICustomButtonsService.getChannel] CustomButtonsService.js:200:0
Odyseus
 
Posts: 434
Joined: Sun Mar 10, 2013 12:51 pm

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

Postby srazzano » Sun Mar 20, 2016 6:19 am

In CustomButtonsService.js file, function ImageConverter (imageURL, id, topic)
Replace:
Code: Select all
var cbs = Components. classes ["@xsms.nm.ru/custombuttons/cbservice;1"]. getService (Components. interfaces. cbICustomButtonsService);
this. channel = cbs. getChannel (imageURL, Components. interfaces. nsIContentPolicy. TYPE_IMAGE);

With:
Code: Select all
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
this.channel = ios.newChannelFromURIWithLoadInfo(ios.newURI(imageURL, null, null), null);
srazzano
 
Posts: 1473
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

PreviousNext

Return to Bug report

cron