let and const compliancy breaks some add-ons. ex sticky
- streetwolf
- Posts: 2706
- Joined: August 21st, 2011, 8:07 am
- Location: NJ (USA)
let and const compliancy breaks some add-ons. ex sticky
A patch on Nightly to enforce let and const compliancy has broken some add-ons. So if your favorite add-on isn't working this may be the cause.
Last edited by LoudNoise on November 21st, 2015, 3:17 pm, edited 3 times in total.
Reason: Made into a sixty day sticky
Reason: Made into a sixty day sticky
Intel i9-13900K | ASUS ROG MAXIMUS Z790 HERO DDR5 | 64GB CORSAIR VENGEANCE DDR5 @ 6600 Mhz.
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
- streetwolf
- Posts: 2706
- Joined: August 21st, 2011, 8:07 am
- Location: NJ (USA)
Re: let and const compliancy breaks some add-ons.
Here's a read on what's happening: ES6 In Depth: let and const ★ Mozilla Hacks – the Web developer blog
Intel i9-13900K | ASUS ROG MAXIMUS Z790 HERO DDR5 | 64GB CORSAIR VENGEANCE DDR5 @ 6600 Mhz.
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
-
- Posts: 1030
- Joined: June 28th, 2008, 4:57 am
Re: let and const compliancy breaks some add-ons.
IIUC, let and const bindings in global scope used to behave exactly the same as var bindings - so for the most part, if things break you can just change all your global lets to vars. However, the change may cause some problems when loading things from other JSMs (which are specific to Gecko, and fulfill a similar purpose to the ES6 'modules' that are in the process of being implemented), as some things that used to be shared automatically in weird ways now no longer are. I'm not sure exactly what the difference is from the old system, as several solutions were considered and I'm not sure what they settled on (the devil is in the details for this one).
The announcement on the mozilla.dev.platform newsgroup contains more technical details.
The announcement on the mozilla.dev.platform newsgroup contains more technical details.
-
- Posts: 3664
- Joined: September 15th, 2010, 9:03 am
Re: let and const compliancy breaks some add-ons.
One area of concern might be the very common "const Ci = Components.interfaces" type declarations. Redeclarations of the const would cause a syntax error, but replacing const with var would magically make it go away. Now that would be a problem. Just guessing since I haven't seen any actual problems yet.
-
- Posts: 455
- Joined: November 7th, 2002, 3:22 pm
- Location: the palouse, SE. WA, USA
Re: let and const compliancy breaks some add-ons.
streetwolf wrote:Don't know if this made it to Nightly yet but a patch to enforce let and const compliancy has broken some add-ons.
Some bug links:
Edit: NoScript seems fixed as of 2.6.9.38rc1
Bug 1212968 - JPM based add-ons are completely broken by bug 1202902
Bug 1202902 - Give loader scripts and XUL frame scripts a lexical scope that doesn't break everything?
Bug 1212848 - Add-on options are missing since 2015-10-08 -> Comment 7:
Bug 1212968 has updated JPM to fix the issue so updating JPM to 1.0.2 and rebuilding your add-on would solve your problem.
Last edited by bomfog on October 9th, 2015, 8:20 am, edited 1 time in total.
- streetwolf
- Posts: 2706
- Joined: August 21st, 2011, 8:07 am
- Location: NJ (USA)
Re: let and const compliancy breaks some add-ons.
You have to let the add-on developers know. I contacted a few and they provided me with the proper fix.
Intel i9-13900K | ASUS ROG MAXIMUS Z790 HERO DDR5 | 64GB CORSAIR VENGEANCE DDR5 @ 6600 Mhz.
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
-
- Posts: 475
- Joined: March 21st, 2012, 7:09 am
Re: let and const compliancy breaks some add-ons.
This change has crippled Custom Buttons and nuked NoScript and downthemall.
NS will probably get fixed in time but the other two not sure.
NS will probably get fixed in time but the other two not sure.
- LoudNoise
- New Member
- Posts: 39900
- Joined: October 18th, 2007, 1:45 pm
- Location: Next door to the west
Re: let and const compliancy breaks some add-ons.
Your choice folks, but would it make sense to move this to Extension Dev?
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."
- patrickjdempsey
- Posts: 23686
- Joined: October 23rd, 2008, 11:43 am
- Location: Asheville NC
- Contact:
Re: let and const compliancy breaks some add-ons.
streetwolf wrote:Here's a read on what's happening: ES6 In Depth: let and const ★ Mozilla Hacks – the Web developer blog
Ver Greeneyes wrote:The announcement on the mozilla.dev.platform newsgroup contains more technical details.
So Mozilla got all excited about let and used it everywhere for everything and now they've got to back up and only use it when it's called for, and revert back to var for globals. Now that is funny. Presumably extensions written by low-level morons like me that don't use let or const aren't bothered by this enforcement?
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
-
- Posts: 1030
- Joined: June 28th, 2008, 4:57 am
Re: let and const compliancy breaks some add-ons.
Yes, behavior of good old var is unchanged. The behavior of let and const in function and block scopes is also unchanged - the last change to that behavior was the addition of the 'temporal dead zone', which makes things likepatrickjdempsey wrote:Presumably extensions written by low-level morons like me that don't use let or const aren't bothered by this enforcement?
Code: Select all
x = 5;
let x;
-
- Posts: 3664
- Joined: September 15th, 2010, 9:03 am
Re: let and const compliancy breaks some add-ons.
Not just the addition of the temporal dead zone, but the changing from window-global scope to its own global scope. I think people are both more aware and more understanding of the temporal dead zone, perhaps not by name but at least infrequently trying to use a let variable before it is declared. The change in scope is going to bite a lot of people, and not necessarily for doing dumb stuff. It is easy to say that the behaviour of var has not changed, but the interaction of var with let and const *has* changed, so it is entirely possible for a var statement to now produce an error where it didn't before. Redeclaring a global let or const using var used to work, but won't now.
The behaviour of let in simple for loops was changed in FF39, so that each loop iteration receives its own binding of the let variable, affecting closures. for...in and for...of loops are not yet changed but it should land soon. I suspect a few people are going to be affected by this and it will be a bear to track down.
Still, I have little sympathy for people who get bitten by these changes. I've been shouting in the dark for years that let (and const) are not standards compliant and their behaviour would sooner or later change, so please avoid them unless you know exactly what you're letting yourself in for. The MDN pages even warned more or less the same thing. let might be the new var now (or soon), but the people who've been treating it that way for the last five years or so are going to be busy bees.
A move to extensions dev would be useful. If not, I'll start a new thread there since people are going to need information about this.
The behaviour of let in simple for loops was changed in FF39, so that each loop iteration receives its own binding of the let variable, affecting closures. for...in and for...of loops are not yet changed but it should land soon. I suspect a few people are going to be affected by this and it will be a bear to track down.
Still, I have little sympathy for people who get bitten by these changes. I've been shouting in the dark for years that let (and const) are not standards compliant and their behaviour would sooner or later change, so please avoid them unless you know exactly what you're letting yourself in for. The MDN pages even warned more or less the same thing. let might be the new var now (or soon), but the people who've been treating it that way for the last five years or so are going to be busy bees.
A move to extensions dev would be useful. If not, I'll start a new thread there since people are going to need information about this.
-
- Posts: 1030
- Joined: June 28th, 2008, 4:57 am
Re: let and const compliancy breaks some add-ons.
Ah, it seems I'm more out of the loop than I thought. Thanks for the clarifications, toolithopsian wrote:The behaviour of let in simple for loops was changed in FF39, so that each loop iteration receives its own binding of the let variable, affecting closures. for...in and for...of loops are not yet changed but it should land soon. I suspect a few people are going to be affected by this and it will be a bear to track down.
By the way, I believe Shu is preparing a blog post about the changes to explain them in more detail. I don't think it's been posted yet.
- joeg
- Posts: 2616
- Joined: October 10th, 2003, 12:37 pm
- Location: How can you be in two places at once, when you're not anywhere at all?
Re: let and const compliancy breaks some add-ons.
If you happen to use the Status-4-Evar extension and have been affected by this change, the author has provided a fix.
https://addons.mozilla.org/de/firefox/a ... /versions/
https://addons.mozilla.org/de/firefox/a ... /versions/
Although every day is Judgment Day, I nonetheless feel like a room without a roof.
-
- Posts: 475
- Joined: March 21st, 2012, 7:09 am
Re: let and const compliancy breaks some add-ons.
For Custom Buttons users Odyseus has uploaded a temporary fix:
http://custombuttons.sourceforge.net/fo ... d3326c5aee
http://custombuttons.sourceforge.net/fo ... d3326c5aee
-
- Posts: 1030
- Joined: June 28th, 2008, 4:57 am
Re: let and const compliancy breaks some add-ons.
Said blog post: Breaking changes in let and const in Firefox Nightly 44Ver Greeneyes wrote:By the way, I believe Shu is preparing a blog post about the changes to explain them in more detail.