refactor(wasm): drop withdrawn type reflection API

This commit is contained in:
ldm0
2026-09-03 15:17:48 +08:00
committed by Donough Liu
parent 271335c08a
commit 51a9923eef
3 changed files with 4 additions and 28 deletions
@@ -211,7 +211,6 @@ pub(in crate::context_bootstrap) fn install_webassembly_runtime_extensions(
install_table_constructor(scope, webassembly)?;
install_global_constructor(scope, webassembly)?;
install_tag_constructor(scope, webassembly)?;
install_function_shape(scope, webassembly);
install_exception_shape(scope, webassembly)?;
define_non_enumerable_bool_property(scope, webassembly, WASM_RUNTIME_INSTALLED_SLOT, true);
Ok(())
@@ -1907,23 +1906,6 @@ fn global_value_setter_callback<'s>(
let _ = setter.call(scope, args.this().into(), &[value]);
}
fn install_function_shape<'s>(
scope: &mut v8::PinScope<'s, '_>,
webassembly: v8::Local<'s, v8::Object>,
) {
if let Some(function) = webassembly_constructor(scope, webassembly, "Function") {
let _ = define_value_property(
scope,
function.into(),
"length",
v8::Integer::new(scope, 2).into(),
false,
false,
true,
);
}
}
fn install_exception_shape<'s>(
scope: &mut v8::PinScope<'s, '_>,
webassembly: v8::Local<'s, v8::Object>,
@@ -7119,8 +7119,6 @@ fn webassembly_runtime_exposes_type_reflection_surface() {
globalConstructorOrder.push("value valueOf()");
}
});
const wasmFunction = new WebAssembly.Function({ parameters: ["i32"], results: ["i32"] }, value => value + 1);
const wasmFunctionType = wasmFunction.type();
const arrayFrom = Array.from;
Array.from = () => { throw new Error("WebAssembly descriptor reflection must not use Array.from"); };
const tag = new WebAssembly.Tag({
@@ -7156,11 +7154,7 @@ fn webassembly_runtime_exposes_type_reflection_surface() {
missingSetterResult,
missingSetterValue: mutableGlobal.value,
globalConstructorOrder: globalConstructorOrder.join("|"),
wasmFunctionConstructorLength: WebAssembly.Function.length,
wasmFunctionCall: wasmFunction(4),
wasmFunctionInstance: wasmFunction instanceof WebAssembly.Function,
wasmFunctionParameters: wasmFunctionType.parameters,
wasmFunctionResults: wasmFunctionType.results,
wasmFunction: typeof WebAssembly.Function,
tagType,
exceptionLength: WebAssembly.Exception.length,
exceptionOutOfRange: throwsName(() => exception.getArg(tag, 2)),
@@ -7180,7 +7174,7 @@ fn webassembly_runtime_exposes_type_reflection_surface() {
assert_eq!(
result,
r#"{"memoryTypeMinimum":2,"memoryTypeMaximum":4,"memoryBothBounds":"TypeError","memoryPlainReceiver":"TypeError","memorySpoofedReceiver":"TypeError","tableTypeMinimum":1,"tableTypeMaximum":3,"tableTypeElement":"funcref","tableBothBounds":"TypeError","tablePlainReceiver":"TypeError","tableSpoofedReceiver":"TypeError","globalTypeMutable":false,"globalTypeValue":"funcref","globalTypeKeys":["mutable","value"],"globalValueSetterName":"set value","globalValueSetterLength":1,"missingSetterValue":0,"globalConstructorOrder":"descriptor mutable|descriptor value|descriptor value toString|value valueOf()","wasmFunctionConstructorLength":2,"wasmFunctionCall":5,"wasmFunctionInstance":true,"wasmFunctionParameters":["i32"],"wasmFunctionResults":["i32"],"tagType":{"parameters":["i32","i64"]},"exceptionLength":2,"exceptionOutOfRange":"RangeError","exceptionValue":"9","namespaceInstanceName":"namespaceInstance","namespaceInstanceLength":1,"namespaceInstanceEnumerable":false,"namespaceInstanceWritable":true,"namespaceInstanceConfigurable":true,"namespaceInstancePlainObject":"TypeError","namespaceInstanceMissing":"TypeError"}"#
r#"{"memoryTypeMinimum":2,"memoryTypeMaximum":4,"memoryBothBounds":"TypeError","memoryPlainReceiver":"TypeError","memorySpoofedReceiver":"TypeError","tableTypeMinimum":1,"tableTypeMaximum":3,"tableTypeElement":"funcref","tableBothBounds":"TypeError","tablePlainReceiver":"TypeError","tableSpoofedReceiver":"TypeError","globalTypeMutable":false,"globalTypeValue":"funcref","globalTypeKeys":["mutable","value"],"globalValueSetterName":"set value","globalValueSetterLength":1,"missingSetterValue":0,"globalConstructorOrder":"descriptor mutable|descriptor value|descriptor value toString|value valueOf()","wasmFunction":"undefined","tagType":{"parameters":["i32","i64"]},"exceptionLength":2,"exceptionOutOfRange":"RangeError","exceptionValue":"9","namespaceInstanceName":"namespaceInstance","namespaceInstanceLength":1,"namespaceInstanceEnumerable":false,"namespaceInstanceWritable":true,"namespaceInstanceConfigurable":true,"namespaceInstancePlainObject":"TypeError","namespaceInstanceMissing":"TypeError"}"#
);
}
#[test]
+2 -2
View File
@@ -69,9 +69,9 @@ pub(crate) fn initialization_flags() -> &'static str {
// Debug Rust frames are much larger than release frames. Keep V8's
// debug JS stack budget above its small default, but still well below
// the render runtime's 8 MiB native stack.
"--stack-size=4096 --harmony-import-attributes --js-source-phase-imports --experimental-wasm-type-reflection"
"--stack-size=4096 --harmony-import-attributes --js-source-phase-imports"
} else {
"--harmony-import-attributes --js-source-phase-imports --experimental-wasm-type-reflection"
"--harmony-import-attributes --js-source-phase-imports"
}
}