Important: v27.1 changed usage of "let"

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35597
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Important: v27.1 changed usage of "let"

Unread post by Moonchild » 2017-02-10, 09:47

For people running into extensions that suddenly stopped working/working properly in v27.1 that worked properly in v27.0.*, it is likely that the problem is the change of the "let" keyword in JavaScript.

To cater to an increasing number of websites that treat "let" as a versionless keyword (because other browsers *cough* Chrome *cough* do) we've had to make this keyword versionless as well. This meant, however, that the old JS versions of the let keyword (let expressions and let blocks) can no longer be used, and must be rewritten into let definitions inside scoped blocks. If extensions use these let expressions or blocks, they will break (Pale Moon has already emitted warnings previously about this use).

For extension developers:

What no longer works:

Code: Select all

let (x=y) express(x);

let (x=y) {
  do_something(x);
  do_something_else(x);
}
Functional equivalent:

Code: Select all

{
  let x=y;
  express(x);
}

{
  let x=y;
  do_something(x);
  do_something_else(x);
}
It is important to note the { } around the entire block of code in the new equivalent, because of the way let is a scoped keyword. Don't forget the curly braces!
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked