#36 Stop using js expression closures

Open
opened 6 months ago by mattatobin · 0 comments

We extensively use non-standard JS expression closures (function definitions as expressions) in our frontend code and MozJSMs. If we ever decide to wholesale update or Moonchild gets his head out of his ass and we can ally for the original SpiderMonkey refresh project then this would block it as the later versions of the engine no longer allow this.

Effectively, it’s:

function (arg) arg.something && somethingElse();

to become:

function (arg) { 
  return arg.something && somethingElse();
}

or potentially using arrow functions (be careful if it’s using "this"!). This isn't difficult just tedious.


Mozilla Bug 1083459

We extensively use non-standard JS expression closures (function definitions as expressions) in our frontend code and MozJSMs. If we ever decide to wholesale update or Moonchild gets his head out of his ass and we can ally for the original `SpiderMonkey` refresh project then this would block it as the later versions of the engine no longer allow this. Effectively, it’s: ``` function (arg) arg.something && somethingElse(); ``` to become: ``` function (arg) { return arg.something && somethingElse(); } ``` or potentially using arrow functions (be careful if it’s using "this"!). This isn't difficult just tedious. ---- Mozilla [Bug 1083459](https://bugzilla.mozilla.org/show_bug.cgi?id=1083459)
Sign in to join this conversation.
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.