Broken Add-ons in Firefox 46

A lot of add-ons are being broken by a subtle change in Firefox 46, in particular the removal of legacy array/generator comprehension.

Most of these add-ons (including mine) did not use array comprehension intentionally, but they copied some code from this page on developer.mozilla.org for doing an md5 hash of a string. It looked like this:

var s = [toHexString(hash.charCodeAt(i)) for (i in hash)].join("");

You should search through your source code for toHexString and make sure you aren’t using this. MDN was updated in January to fix this. Here’s what the new code looks like:

var s = Array.from(hash, (c, i) => toHexString(hash.charCodeAt(i))).join("");

The new code will only work in Firefox 32 and beyond. If for some reason you need an older version, you can go through the history of the page to find the array based version.

Using this old code will cause a syntax error, so it will cause much more breakage than you realize. You’ll want to get it fixed sooner than later because Firefox 46 started rolling out yesterday.

As a side note, Giorgio Maone caught this in January, but unfortunately all that was updated was the MDN page.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

11 thoughts on “Broken Add-ons in Firefox 46

  1. [for (c of hash) toHexString(c.charCodeAt())].join(“”) works I think in Firefox 30 and later, or you could go with hash.replace(/[^]/g, function(c) { return toHexString(c.charCodeAt());}) which would work in even older versions. (Note that in that case I would recommend writing charToHexSring as a separate function.)

    • Ok, I tested it and it works. There is one question left: Do you have any idea or maybe already a solution to replace the distribution/bundles folder in Thunderbird 45? It would be a great help for the deployment of Thunderbird. I read on bugzilla, that it is unsupported after Thunderbird 40.

      • Andre,

        Did you have to do anything differently in Firefox 46 to get CCK2 to work? With the new version, I have move the autoconfig.zip file to C:\Program Files (x86)\Mozilla Firefox\ and unzipped, I see the cck2.cfg file and associated other files, but when I run Firefox there are no configurations present. I have also included an override.ini file in C:\Program Files (x86)\Mozilla Firefox\browser but Firefox 46 still asks to import settings from other browsers.

        I have tested this same method on previous versions of Firefox (42, 41, 40) and have tested it on the latest ESR release (45.1) and haven’t had any issues.

        I even tried to make sure I create the autoconfig.zip file with Firefox 46 and the latest plugin but no luck. If you have any thoughts, that would be greatly appreciated.

        • That’s odd. I’m having no problems with FF 46. What files are in the defaults/prefs directory?

          • There was only one thing I did. I installed the newest CCK2 Wizard and with it I created a new autoconfig folder with a new version. Older autoconfig-packets didn’t work.

        • Mike/Andre,

          I realized my error, I accidentally had two versions of Firefox installed. I had 42 from earlier, then installed 46 without uninstalling 42. This seems to have been causing issues. Once I uninstalled both and started fresh, everything works great with Firefox 46. Thank you for reaching out and thank you for the product.