Commit b482fd76 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Closure-Compile mojo_bindings_lite.js with --isolation_mode=IIFE

IIFE is "Immediately Invoked Function Expression". It wraps the compiled
output like (function () { <compiled code> }).call(this);.

This is the recommendation given at
http://go/js-practices/build-rules#use-isolation-modeiife-or-equivalent

Without it, closure-compiled symbols pollute the global JS context and
can prevent mojo bindings being used in a regular/standalone
closure-compiled app. E.g., errors like,

JS ERROR: '[..:ERROR:CONSOLE(1)] "Uncaught SyntaxError: Identifier 'ra' has already been declared"

Bug: 996088
Change-Id: Icef1a1c0d14a3f2b8cefbce12e08348a8c63b9c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903228Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713629}
parent 88b50247
......@@ -85,6 +85,7 @@ if (enable_mojom_closure_compile || closure_compile) {
"language_out=ECMASCRIPT_2015",
"generate_exports",
"export_local_property_definitions",
"isolation_mode=IIFE",
]
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment