diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc index a10f39536e..59d2cfa4d8 100644 --- a/src/wasm/wasm-js.cc +++ b/src/wasm/wasm-js.cc @@ -1517,6 +1517,10 @@ void WebAssemblyGlobalSetValue( thrower.TypeError("Can't set the value of an immutable global."); return; } + if (args[0]->IsUndefined()) { + thrower.TypeError("Argument 0: must be a value"); + return; + } switch (receiver->type()) { case i::wasm::kWasmI32: { diff --git a/test/mjsunit/wasm/anyref-globals.js b/test/mjsunit/wasm/anyref-globals.js index 7f14f962a0..64f56366e0 100644 --- a/test/mjsunit/wasm/anyref-globals.js +++ b/test/mjsunit/wasm/anyref-globals.js @@ -164,7 +164,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); } TestGlobal(null); - TestGlobal(undefined); + assertThrows(() => TestGlobal(undefined), TypeError); TestGlobal(1663); TestGlobal("testmyglobal"); TestGlobal({a: 11}); diff --git a/test/wasm-js/wasm-js.status b/test/wasm-js/wasm-js.status index 0155d568ff..856a50aed0 100644 --- a/test/wasm-js/wasm-js.status +++ b/test/wasm-js/wasm-js.status @@ -9,7 +9,6 @@ 'table/grow': [FAIL], 'table/get-set': [FAIL], 'module/customSections': [FAIL], - 'global/value-get-set': [FAIL], }], # ALWAYS [ALWAYS, {