mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
src: set arraybuffer_untransferable_private_symbol
for `ArrayBuffer` whose buffers are not own by `BackingStore`. This would help us avoid problem with the new V8 BackingStore API where new `ArrayBuffer` is allocated at the same place of previous `ArrayBuffer` that is still being tracked in `BackingStore` table. PR-URL: https://github.com/nodejs/node/pull/31053 Refs: https://github.com/nodejs/node/issues/31052 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
643241ae3f
commit
90f7a5c010
@ -1213,6 +1213,10 @@ void Initialize(Local<Object> target,
|
||||
// TODO(thangktran): drop this check when V8 is pumped to 8.0 .
|
||||
if (!array_buffer->IsExternal())
|
||||
array_buffer->Externalize(array_buffer->GetBackingStore());
|
||||
array_buffer->SetPrivate(
|
||||
env->context(),
|
||||
env->arraybuffer_untransferable_private_symbol(),
|
||||
True(env->isolate())).Check();
|
||||
CHECK(target
|
||||
->Set(env->context(),
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "zeroFill"),
|
||||
|
@ -578,6 +578,9 @@ Http2Session::Http2Session(Environment* env,
|
||||
// TODO(thangktran): drop this check when V8 is pumped to 8.0 .
|
||||
if (!ab->IsExternal())
|
||||
ab->Externalize(ab->GetBackingStore());
|
||||
ab->SetPrivate(env->context(),
|
||||
env->arraybuffer_untransferable_private_symbol(),
|
||||
True(env->isolate())).Check();
|
||||
js_fields_ab_.Reset(env->isolate(), ab);
|
||||
Local<Uint8Array> uint8_arr =
|
||||
Uint8Array::New(ab, 0, kSessionUint8FieldCount);
|
||||
|
Loading…
Reference in New Issue
Block a user