Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces significant updates to the library files to improve ES6 compatibility and default parameter handling, including the transition to ES6 module output in tests. A critical issue was identified in src/lib/libglemu.js where initializing materialShininess to an empty array [] changes its truthiness and could lead to runtime errors; the reviewer suggests using a safe default value like [0.0] instead.
sbc100
force-pushed
the
fix-closure-all-es6
branch
from
October 29, 2026 17:40
341d848 to
5566eaa
Compare
kripken
reviewed
Oct 29, 2026
kripken
reviewed
Oct 29, 2026
sbc100
force-pushed
the
fix-closure-all-es6
branch
2 times, most recently
from
October 29, 2026 21:01
43196b0 to
f1713f7
Compare
Unlike the other material properties (`materialAmbient`, `materialDiffuse`, `materialSpecular`, and `materialEmission`), which are 4-component vectors passed to `GLctx.uniform4fv`, `materialShininess` is a single float passed to `GLctx.uniform1f`. Store `GLEmulation.materialShininess` directly as a number initialized to `0` (matching other scalar uniforms such as `fogStart` and `alphaTestRef`) instead of wrapping it in a 1-element `Float32Array`. This also avoids a Closure Compiler type warning on `GLEmulation.materialShininess[0]` when compiling with `-sEXPORT_ES6`. Split out from emscripten-core#27747
Followup to emscripten-core#27749. Make all remaining JS libraries compatible with Closure compiler in ES6 module mode (`-sEXPORT_ES6`). - Change loop variables in `$miniTempWebGLFloatBuffers__postset` and `$miniTempWebGLIntBuffers__postset` from `var` to `let` to prevent duplicate top-level `var` declaration collisions in ES module scope. - Remove duplicate forward `var` declarations in `$GLEmulation__postset` and initialize `GLEmulation.fogColor` as `[]`. - Provide default values for optional arguments across `libbrowser.js`, `libglfw.js`, `libhtml5.js`, `libopenal.js`, `libsdl.js`, `libwasmfs.js`, `libfs_shared.js`, `libworkerfs.js`, `libproxyfs.js`, and `liblz4.js`. - Remove surplus argument passed to `GL.postDrawHandleClientVertexAttribBindings` in `libwebgl.js`. - Remove unused parameter from `GLImmediate.createRenderer`. - Define `source: null` on `SDL.music` in `libsdl.js`. - Avoid `this.socketEvent` receiver collapse warning in `libwebsocket.js`. - In `libcore.js`, fix missing `typeof` check for `globalThis.performance?.now`. - Only generate `FS_<symbol>` function aliases in `libfs.js` for lowercase function properties. - Update `test_closure_full_js_library` to run with `-sEXPORT_ES6` and remove temporary `test_closure_fs_es6`. See: emscripten-core#27747
sbc100
force-pushed
the
fix-closure-all-es6
branch
from
October 29, 2026 23:08
f1713f7 to
21f6cb7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Followup to #27749.
Make all remaining JS libraries compatible with Closure compiler in ES6 module mode (
-sEXPORT_ES6).$miniTempWebGLFloatBuffers__postsetand$miniTempWebGLIntBuffers__postsetfromvartoletto prevent duplicate top-levelvardeclaration collisions in ES module scope.vardeclarations in$GLEmulation__postsetand initializeGLEmulation.fogColoras[].libbrowser.js,libglfw.js,libhtml5.js,libopenal.js,libsdl.js,libwasmfs.js,libfs_shared.js,libworkerfs.js,libproxyfs.js, andliblz4.js.GL.postDrawHandleClientVertexAttribBindingsinlibwebgl.js.GLImmediate.createRenderer.source: nullonSDL.musicinlibsdl.js.this.socketEventreceiver collapse warning inlibwebsocket.js.libcore.js, fix missingtypeofcheck forglobalThis.performance?.now.FS_<symbol>function aliases inlibfs.jsfor lowercase function properties.test_closure_full_js_libraryto run with-sEXPORT_ES6and remove temporarytest_closure_fs_es6.See: #27747