Fix Google Closure Compiler / Parcel errors when compiling with GHCJS_BROWSER (#25613)
The PR adds GHCJS_BROWSER preprocessor directives to JavaScript backend files that are crucial for Google Closure Compiler and bundlers (Parcel) to work with generated code.
Upstream PRs: