Enforce stricter file-level closures in JavaScript code.

Review Request #9189 - Created Sept. 8, 2017 and submitted

Christian Hammond
Review Board
release-3.0.x
bf99cd9...
reviewboard

With the move to ES6, we've been using { ... } around files that need
to define local variables and assuming Babel would do the right thing.

It doesn't.

Each resulting variable defined on a file level ran the risk of being
redefined by another file, and this would break all sorts of things in
confusing ways when that variable is accessed by any other code. The fix
to this is to go back to wrapping files with (function() { ... })(),
which is the only way to guarantee safety.

All files using simple braces around the file contents to enforce scope
have been updated. All future files will need to use the old form to
ensure safe scoping rules.

Unit tests pass.

Verified this fixed the problem found in production.

David Trowbridge
Christian Hammond
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (3214808)
Loading...