From 33e31d03f646990e97dc7efe552c3898280d6492 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Wed, 9 Sep 2026 18:24:34 +0000 Subject: [PATCH] Bump google-closure-compiler to 20260831.0.0 Update google-closure-compiler dependency to version 20260831.0.0. Remove the WebAssembly.Memory.prototype.toResizableBuffer extern definition, which is now provided natively by Closure Compiler. Update the fixedGetContext return type annotation to RenderingContext to match Closure's updated HTMLCanvasElement getContext extern. Filter out webgpu-externs.js when building with emdawnwebgpu because Closure Compiler now includes native WebGPU externs (w3c_webgpu.js). Rebaseline codesize test expectations for the updated compiler output. --- package-lock.json | 48 +++++++++---------- package.json | 2 +- src/closure-externs/closure-externs.js | 4 -- src/lib/libwebgl.js | 2 +- test/codesize/test_codesize_cxx_ctors1.json | 8 ++-- test/codesize/test_codesize_cxx_ctors2.json | 8 ++-- test/codesize/test_codesize_cxx_except.json | 8 ++-- .../test_codesize_cxx_except_wasm.json | 8 ++-- .../test_codesize_cxx_except_wasm_legacy.json | 8 ++-- test/codesize/test_codesize_cxx_mangle.json | 8 ++-- test/codesize/test_codesize_cxx_noexcept.json | 8 ++-- test/codesize/test_codesize_file_preload.json | 8 ++-- test/codesize/test_codesize_hello_O0.json | 4 +- test/codesize/test_codesize_hello_dylink.json | 8 ++-- .../test_codesize_hello_dylink_all.json | 4 +- .../test_codesize_minimal_pthreads.json | 8 ++-- ...t_codesize_minimal_pthreads_memgrowth.json | 8 ++-- ...ntime_code_size_random_printf_wasm2js.json | 4 +- tools/building.py | 23 +++++++++ 19 files changed, 99 insertions(+), 80 deletions(-) diff --git a/package-lock.json b/package-lock.json index c3fbb57e74d12..da3422df41091 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "dependencies": { "acorn": "^8.18.0", "acorn-import-phases": "^1.0.4", - "google-closure-compiler": "20260726.0.0", + "google-closure-compiler": "20260831.0.0", "html-minifier-terser": "7.2.0" }, "devDependencies": { @@ -2708,13 +2708,13 @@ } }, "node_modules/google-closure-compiler": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20260726.0.0.tgz", - "integrity": "sha512-MkDkGdQOE7mRPHqcvj9hvaHsbcOBu5Y9TSBi/R91Ozx5AiWylwpNSDSlJGnZybCDCX+Q+0jZjRtcb0Xzl8gDaA==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20260831.0.0.tgz", + "integrity": "sha512-MYpFWZ+YYIe2YA1qcHOktfWkYTf50fq61hHUiM8NTrXq+wQSyhVrvuoJ2ZvDEs8mkWsy9HkxorMuYCVVVsxjdQ==", "license": "Apache-2.0", "dependencies": { "chalk": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 <5.6.1 || ^5.6.2 >5.6.1", - "google-closure-compiler-java": "^20260726.0.0", + "google-closure-compiler-java": "^20260831.0.0", "minimist": "^1.0.0", "vinyl": "^3.0.1", "vinyl-sourcemaps-apply": "^0.2.0" @@ -2726,22 +2726,22 @@ "node": ">=18" }, "optionalDependencies": { - "google-closure-compiler-linux": "^20260726.0.0", - "google-closure-compiler-linux-arm64": "^20260726.0.0", - "google-closure-compiler-macos": "^20260726.0.0", - "google-closure-compiler-windows": "^20260726.0.0" + "google-closure-compiler-linux": "^20260831.0.0", + "google-closure-compiler-linux-arm64": "^20260831.0.0", + "google-closure-compiler-macos": "^20260831.0.0", + "google-closure-compiler-windows": "^20260831.0.0" } }, "node_modules/google-closure-compiler-java": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20260726.0.0.tgz", - "integrity": "sha512-2Y681DFP8E/Mrmb3ZxVBoeP8MVLIrIQ72XPU1ot44/VZua/f7oQv2IIg9RsAKWDX8a/uYzS3JHkoFIudHhE+tg==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20260831.0.0.tgz", + "integrity": "sha512-EQ0cEDOuxDcVVIwQKmTNr/fnDH0mCKKR+DY0lED/hBqncbben1f0gQ9+Lcnese3NCeJIo1UgRPTBLawAXt0wcQ==", "license": "Apache-2.0" }, "node_modules/google-closure-compiler-linux": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20260726.0.0.tgz", - "integrity": "sha512-wqefEjdMZIzlpsG9DoOwhTJvN296gmO0nytWPtl4rKTNQjUwwNqhLhnrCGPhJjg6Rij5EYTXl9irGKLTNfaSLQ==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20260831.0.0.tgz", + "integrity": "sha512-CsJ7ZfrJ4ObeKzqbr/XCIujPrbqHVvKNQ8zmJaVUXiszzyLdGh+tT0M0XhYAyZXXIa/XL0rfM468QugQ98MtPw==", "cpu": [ "x32", "x64" @@ -2753,9 +2753,9 @@ ] }, "node_modules/google-closure-compiler-linux-arm64": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux-arm64/-/google-closure-compiler-linux-arm64-20260726.0.0.tgz", - "integrity": "sha512-Elr1XmBVDH7QUYHGKSF78Eb/GVV1xd91YyR27JcOayuQiZdvPZkdTH6kE/2xyGrLeQSBfvhS/Wmvk0GFJhOtyg==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-linux-arm64/-/google-closure-compiler-linux-arm64-20260831.0.0.tgz", + "integrity": "sha512-5+nolZYk8tFR5vaBrFYnd1cdSDbOrDWc0uOEMZeMMiXufLR1HESQuuf09d0UFuu+KnZ+Vrphtkwl7EPM1Aag3w==", "cpu": [ "arm64" ], @@ -2766,9 +2766,9 @@ ] }, "node_modules/google-closure-compiler-macos": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-macos/-/google-closure-compiler-macos-20260726.0.0.tgz", - "integrity": "sha512-Aek1FeNRCntCBKmhHBCbkR0HmRkDMfBB4YJy1TRIElUApAjONwvkUmW070J6+Cur1cteKZEBOePRRbU5udpLqg==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-macos/-/google-closure-compiler-macos-20260831.0.0.tgz", + "integrity": "sha512-VVyutKNIChNCEKz5pN4a0ivdqUW1N6KNjO/vHSL+F6+P5zUi8zq8N/uhcJ3OR9vwpGAmYnsT5p3PwLNMQtX8wg==", "cpu": [ "arm64" ], @@ -2779,9 +2779,9 @@ ] }, "node_modules/google-closure-compiler-windows": { - "version": "20260726.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20260726.0.0.tgz", - "integrity": "sha512-Alg9hH8c+qo9PFrPn12TzUjfBE10gphvgDyTrj2TMmrwkZnHd3BwPKEQrkucIxwNSL3FmHwGG7MwLB7/c/YPtg==", + "version": "20260831.0.0", + "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20260831.0.0.tgz", + "integrity": "sha512-O53LMQFMWV11x5qMGkcET752iKbR+1O4DfJmtUW+Olb+F9jgeorcrrmZ2MQfSx2W22fQoVJbY9smayObcPw9hA==", "cpu": [ "x32", "x64" diff --git a/package.json b/package.json index 2fb8b3a41ee6e..930e953546214 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dependencies": { "acorn": "^8.18.0", "acorn-import-phases": "^1.0.4", - "google-closure-compiler": "20260726.0.0", + "google-closure-compiler": "20260831.0.0", "html-minifier-terser": "7.2.0" }, "scripts": { diff --git a/src/closure-externs/closure-externs.js b/src/closure-externs/closure-externs.js index 54484b15cca31..dd885a32f954b 100644 --- a/src/closure-externs/closure-externs.js +++ b/src/closure-externs/closure-externs.js @@ -68,10 +68,6 @@ WebAssembly.Exception.stack; * Note: Closure compiler does not support function overloading, omit this overload for now. * {function(!WebAssembly.Module, Object=):!Promise} */ -/** - * @returns {ArrayBuffer} - */ -WebAssembly.Memory.prototype.toResizableBuffer = function() {}; /** * @param {!Function} func * @returns {Function} diff --git a/src/lib/libwebgl.js b/src/lib/libwebgl.js index 53a1d82435144..ed8c1b2625480 100644 --- a/src/lib/libwebgl.js +++ b/src/lib/libwebgl.js @@ -769,7 +769,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; // version field in above check. if (!canvas.getContextSafariWebGL2Fixed) { canvas.getContextSafariWebGL2Fixed = canvas.getContext; - /** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (Object|null)} */ + /** @type {function(this:HTMLCanvasElement, string, (Object|null)=): (RenderingContext|null)} */ function fixedGetContext(ver, attrs) { var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs); return ((ver == 'webgl') == (gl instanceof WebGLRenderingContext)) ? gl : null; diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index 0f3d4b4977e09..d07b13c10e41c 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { - "a.out.js": 19224, - "a.out.js.gz": 8124, + "a.out.js": 19225, + "a.out.js.gz": 8125, "a.out.nodebug.wasm": 133884, "a.out.nodebug.wasm.gz": 51214, - "total": 153108, - "total_gz": 59338, + "total": 153109, + "total_gz": 59339, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index f722301d313cf..c51a4e04efe2f 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { - "a.out.js": 19201, - "a.out.js.gz": 8107, + "a.out.js": 19202, + "a.out.js.gz": 8109, "a.out.nodebug.wasm": 133313, "a.out.nodebug.wasm.gz": 50910, - "total": 152514, - "total_gz": 59017, + "total": 152515, + "total_gz": 59019, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index cd28d5447e7aa..b2d44ce76a0c6 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { - "a.out.js": 22917, - "a.out.js.gz": 9078, + "a.out.js": 22919, + "a.out.js.gz": 9082, "a.out.nodebug.wasm": 176341, "a.out.nodebug.wasm.gz": 58740, - "total": 199258, - "total_gz": 67818, + "total": 199260, + "total_gz": 67822, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_except_wasm.json b/test/codesize/test_codesize_cxx_except_wasm.json index d81d0b110efc0..205515bf97e1b 100644 --- a/test/codesize/test_codesize_cxx_except_wasm.json +++ b/test/codesize/test_codesize_cxx_except_wasm.json @@ -1,10 +1,10 @@ { - "a.out.js": 19023, - "a.out.js.gz": 8039, + "a.out.js": 19024, + "a.out.js.gz": 8041, "a.out.nodebug.wasm": 149601, "a.out.nodebug.wasm.gz": 56302, - "total": 168624, - "total_gz": 64341, + "total": 168625, + "total_gz": 64343, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_except_wasm_legacy.json b/test/codesize/test_codesize_cxx_except_wasm_legacy.json index c56e97bcb3ee7..2b4cd39773bcb 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,10 +1,10 @@ { - "a.out.js": 19101, - "a.out.js.gz": 8065, + "a.out.js": 19102, + "a.out.js.gz": 8066, "a.out.nodebug.wasm": 147383, "a.out.nodebug.wasm.gz": 55981, - "total": 166484, - "total_gz": 64046, + "total": 166485, + "total_gz": 64047, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_mangle.json b/test/codesize/test_codesize_cxx_mangle.json index f47c94f253f74..514a22f598ff6 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { - "a.out.js": 22967, - "a.out.js.gz": 9098, + "a.out.js": 22969, + "a.out.js.gz": 9103, "a.out.nodebug.wasm": 242621, "a.out.nodebug.wasm.gz": 80965, - "total": 265588, - "total_gz": 90063, + "total": 265590, + "total_gz": 90068, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_noexcept.json b/test/codesize/test_codesize_cxx_noexcept.json index 63a77b2b8131a..1a1221811874e 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { - "a.out.js": 19224, - "a.out.js.gz": 8124, + "a.out.js": 19225, + "a.out.js.gz": 8125, "a.out.nodebug.wasm": 135794, "a.out.nodebug.wasm.gz": 51836, - "total": 155018, - "total_gz": 59960, + "total": 155019, + "total_gz": 59961, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_file_preload.json b/test/codesize/test_codesize_file_preload.json index 8a288445877b2..0ae7719b815e0 100644 --- a/test/codesize/test_codesize_file_preload.json +++ b/test/codesize/test_codesize_file_preload.json @@ -1,10 +1,10 @@ { - "a.out.js": 22203, - "a.out.js.gz": 9267, + "a.out.js": 22205, + "a.out.js.gz": 9269, "a.out.nodebug.wasm": 1198, "a.out.nodebug.wasm.gz": 730, - "total": 23401, - "total_gz": 9997, + "total": 23403, + "total_gz": 9999, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index ded16df663886..e02aa321baf1b 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { "a.out.js": 23471, - "a.out.js.gz": 8555, + "a.out.js.gz": 8556, "a.out.nodebug.wasm": 14228, "a.out.nodebug.wasm.gz": 7062, "total": 37699, - "total_gz": 15617, + "total_gz": 15618, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index c90827e94328f..c250abdf29566 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26258, - "a.out.js.gz": 11211, + "a.out.js": 26261, + "a.out.js.gz": 11210, "a.out.nodebug.wasm": 16992, "a.out.nodebug.wasm.gz": 8679, - "total": 43250, - "total_gz": 19890, + "total": 43253, + "total_gz": 19889, "sent": [ "__syscall_stat64", "emscripten_resize_heap", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index b193194f47af9..9f96044e5e288 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 270584, + "a.out.js": 270729, "a.out.nodebug.wasm": 588233, - "total": 858817, + "total": 858962, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index d0651f8052264..60c0350a91efc 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,10 +1,10 @@ { - "a.out.js": 6883, - "a.out.js.gz": 3422, + "a.out.js": 6895, + "a.out.js.gz": 3425, "a.out.nodebug.wasm": 19132, "a.out.nodebug.wasm.gz": 8845, - "total": 26015, - "total_gz": 12267, + "total": 26027, + "total_gz": 12270, "sent": [ "a (memory)", "b (exit)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index c258456676ca6..e116a22e73781 100644 --- a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json +++ b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json @@ -1,10 +1,10 @@ { - "a.out.js": 7341, - "a.out.js.gz": 3639, + "a.out.js": 7353, + "a.out.js.gz": 3642, "a.out.nodebug.wasm": 19133, "a.out.nodebug.wasm.gz": 8846, - "total": 26474, - "total_gz": 12485, + "total": 26486, + "total_gz": 12488, "sent": [ "a (memory)", "b (exit)", diff --git a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json index ddbb87e507ccb..50e0c3e84af30 100644 --- a/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json +++ b/test/codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json @@ -1,4 +1,4 @@ { - "a.html": 17338, - "a.html.gz": 7629 + "a.html": 17341, + "a.html.gz": 7631 } diff --git a/tools/building.py b/tools/building.py index ccd0a011084f0..3f290788af82e 100644 --- a/tools/building.py +++ b/tools/building.py @@ -22,6 +22,7 @@ diagnostics, feature_matrix, js_optimizer, + ports, response_file, shared, utils, @@ -570,6 +571,26 @@ def version_split(v): return f'{int(major)}.{int(minor)}.{int(rev)}' +def filter_closure_args(args): + # TODO: this can be removed once emdawnwebgpu no longer passes in + # --externs=webgpu-externs.js + # Closure compiler includes WebGPU externs natively (w3c_webgpu.js). + # Exclude webgpu-externs.js (provided by emdawnwebgpu) to avoid duplicate definition errors. + filtered = [] + skip_next = False + for i, arg in enumerate(args): + if skip_next: + skip_next = False + continue + if arg == '--externs' and i + 1 < len(args) and args[i + 1].strip('\'"').endswith('webgpu-externs.js'): + skip_next = True + continue + if arg.startswith('--externs=') and arg.split('=', 1)[1].strip('\'"').endswith('webgpu-externs.js'): + continue + filtered.append(arg) + return filtered + + @ToolchainProfiler.profile() def closure_compiler(filename, advanced=True, extra_closure_args=None): user_args = [] @@ -578,6 +599,8 @@ def closure_compiler(filename, advanced=True, extra_closure_args=None): user_args += shlex.split(env_args) if extra_closure_args: user_args += extra_closure_args + if any('emdawnwebgpu' in p.name for p in ports.get_needed_ports(settings)): + user_args = filter_closure_args(user_args) closure_cmd, env = get_closure_compiler_and_env(user_args)