MozillaZine

let and const compliancy breaks some add-ons. ex sticky

Discussion about official Mozilla Firefox builds
streetwolf

User avatar
 
Posts: 2093
Joined: August 21st, 2011, 8:07 am
Location: NJ (USA)

Post Posted October 8th, 2015, 4:40 am

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
Intel i7 Quad Core 3770K @ 5Ghz|ASUS P8Z77-V Deluxe|Corsair 1050W PSU|Corsair H100iV2 CPU Cooler|Corsair 16GB RAM|Sapphire Nitro R9 390 8GB|DUAL ASUS PA249Q IPS 24" LCDs|Samsung SSD 830, 840 256GB|2TB Seagate|Windows 10 Pro x64|AMD Crimson 17.10.1|FIOS 1Gb Internet

streetwolf

User avatar
 
Posts: 2093
Joined: August 21st, 2011, 8:07 am
Location: NJ (USA)

Post Posted October 8th, 2015, 5:50 am

Intel i7 Quad Core 3770K @ 5Ghz|ASUS P8Z77-V Deluxe|Corsair 1050W PSU|Corsair H100iV2 CPU Cooler|Corsair 16GB RAM|Sapphire Nitro R9 390 8GB|DUAL ASUS PA249Q IPS 24" LCDs|Samsung SSD 830, 840 256GB|2TB Seagate|Windows 10 Pro x64|AMD Crimson 17.10.1|FIOS 1Gb Internet

Ver Greeneyes
 
Posts: 999
Joined: June 28th, 2008, 4:57 am

Post Posted October 8th, 2015, 6:33 am

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.

lithopsian
 
Posts: 3663
Joined: September 15th, 2010, 9:03 am

Post Posted October 8th, 2015, 6:58 am

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.

bomfog
 
Posts: 455
Joined: November 7th, 2002, 3:22 pm
Location: the palouse, SE. WA, USA

Post Posted October 8th, 2015, 2:54 pm

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:

Bug 1212707 - NoScript has stopped being able to unblock sites on the latest Firefox trunk (soon to be Nightly)
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

User avatar
 
Posts: 2093
Joined: August 21st, 2011, 8:07 am
Location: NJ (USA)

Post Posted October 8th, 2015, 3:05 pm

You have to let the add-on developers know. I contacted a few and they provided me with the proper fix.
Intel i7 Quad Core 3770K @ 5Ghz|ASUS P8Z77-V Deluxe|Corsair 1050W PSU|Corsair H100iV2 CPU Cooler|Corsair 16GB RAM|Sapphire Nitro R9 390 8GB|DUAL ASUS PA249Q IPS 24" LCDs|Samsung SSD 830, 840 256GB|2TB Seagate|Windows 10 Pro x64|AMD Crimson 17.10.1|FIOS 1Gb Internet

marty60
 
Posts: 466
Joined: March 21st, 2012, 7:09 am

Post Posted October 8th, 2015, 6:24 pm

This change has crippled Custom Buttons and nuked NoScript and downthemall.

NS will probably get fixed in time but the other two not sure.

LoudNoise
Moderator

User avatar
 
Posts: 40048
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Post Posted October 8th, 2015, 6:33 pm

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."

patrickjdempsey

User avatar
 
Posts: 23734
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC

Post Posted October 8th, 2015, 6:39 pm

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/

Ver Greeneyes
 
Posts: 999
Joined: June 28th, 2008, 4:57 am

Post Posted October 9th, 2015, 3:52 am

patrickjdempsey wrote:Presumably extensions written by low-level morons like me that don't use let or const aren't bothered by this enforcement?
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 like
Code: Select all
x = 5;
let x;
an error (lets are not hoisted like vars). There are still some changes to come for let and const I believe - their behavior in for loops should be slightly different IIRC - but it's mostly minor stuff.

lithopsian
 
Posts: 3663
Joined: September 15th, 2010, 9:03 am

Post Posted October 9th, 2015, 6:10 am

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.

Ver Greeneyes
 
Posts: 999
Joined: June 28th, 2008, 4:57 am

Post Posted October 9th, 2015, 6:43 am

lithopsian 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.
Ah, it seems I'm more out of the loop than I thought. Thanks for the clarifications, too :)

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

User avatar
 
Posts: 2615
Joined: October 10th, 2003, 12:37 pm
Location: How can you be in two places at once, when you're not anywhere at all?

Post Posted October 11th, 2015, 9:35 am

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/
Although every day is Judgment Day, I nonetheless feel like a room without a roof.

marty60
 
Posts: 466
Joined: March 21st, 2012, 7:09 am

Post Posted October 11th, 2015, 10:44 am

For Custom Buttons users Odyseus has uploaded a temporary fix:

http://custombuttons.sourceforge.net/fo ... d3326c5aee

Ver Greeneyes
 
Posts: 999
Joined: June 28th, 2008, 4:57 am

Post Posted October 15th, 2015, 3:07 pm

Ver Greeneyes wrote:By the way, I believe Shu is preparing a blog post about the changes to explain them in more detail.

Said blog post: Breaking changes in let and const in Firefox Nightly 44

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 2 guests