0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

core: disable resizable ArrayBuffer and growable SharedArrayBuffer (#18395)

This commit is contained in:
Bartek Iwańczuk 2023-03-23 20:25:07 +01:00 committed by GitHub
parent eb25e50edb
commit 09ddb35265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,6 +215,7 @@ fn v8_init(
" --no-validate-asm",
" --turbo_fast_api_calls",
" --harmony-change-array-by-copy",
" --no-harmony-rab-gsab",
);
if predictable {
@ -4874,6 +4875,25 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
.is_ok());
}
#[test]
fn test_resizable_array_buffer() {
// Verify that "resizable ArrayBuffer" is disabled
let mut runtime = JsRuntime::new(Default::default());
runtime
.execute_script(
"test_rab.js",
r#"const a = new ArrayBuffer(100, {maxByteLength: 200});
if (a.byteLength !== 100) {
throw new Error('wrong byte length');
}
if (a.maxByteLength !== undefined) {
throw new Error("ArrayBuffer shouldn't have maxByteLength");
}
"#,
)
.unwrap();
}
#[tokio::test]
async fn cant_load_internal_module_when_snapshot_is_loaded_and_not_snapshotting(
) {