GeezerVison is showing github.com — src: remove calls to deprecated ArrayBuffer methods · e7dal/node@d23eed2
File treeExpand file treeCollapse file tree Open diff view settings test/js-native-api/test_typedarray
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/js_native_api_v8.cc -6Lines changed: 0 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2720,9 +2720,6 @@ napi_status napi_create_external_arraybuffer(napi_env env, | 2720 | 2720 | nullptr); | 2721 | 2721 | v8::Local<v8::ArrayBuffer> buffer = | 2722 | 2722 | v8::ArrayBuffer::New(isolate, std::move(backing)); | 2723 | | - // TODO(thangktran): drop this check when V8 is pumped to 8.0 . | 2724 | | - if (!buffer->IsExternal()) | 2725 | | - buffer->Externalize(buffer->GetBackingStore()); | 2726 | 2723 | v8::Maybe<bool> marked = env->mark_arraybuffer_as_untransferable(buffer); | 2727 | 2724 | CHECK_MAYBE_NOTHING(env, marked, napi_generic_failure); | 2728 | 2725 |
| @@ -3184,9 +3181,6 @@ napi_status napi_detach_arraybuffer(napi_env env, napi_value arraybuffer) { | 3184 | 3181 | env, value->IsArrayBuffer(), napi_arraybuffer_expected); | 3185 | 3182 |
| 3186 | 3183 | v8::Local<v8::ArrayBuffer> it = value.As<v8::ArrayBuffer>(); | 3187 | | - // TODO(addaleax): Remove the first condition once we have V8 8.0. | 3188 | | - RETURN_STATUS_IF_FALSE( | 3189 | | - env, it->IsExternal(), napi_detachable_arraybuffer_expected); | 3190 | 3184 | RETURN_STATUS_IF_FALSE( | 3191 | 3185 | env, it->IsDetachable(), napi_detachable_arraybuffer_expected); | 3192 | 3186 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_buffer.cc -6Lines changed: 0 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -417,9 +417,6 @@ MaybeLocal<Object> New(Environment* env, | 417 | 417 | nullptr); | 418 | 418 | Local<ArrayBuffer> ab = ArrayBuffer::New(env->isolate(), | 419 | 419 | std::move(backing)); | 420 | | - // TODO(thangktran): drop this check when V8 is pumped to 8.0 . | 421 | | - if (!ab->IsExternal()) | 422 | | - ab->Externalize(ab->GetBackingStore()); | 423 | 420 | if (ab->SetPrivate(env->context(), | 424 | 421 | env->arraybuffer_untransferable_private_symbol(), | 425 | 422 | True(env->isolate())).IsNothing()) { | @@ -1212,9 +1209,6 @@ void Initialize(Local<Object> target, | 1212 | 1209 | nullptr); | 1213 | 1210 | Local<ArrayBuffer> array_buffer = | 1214 | 1211 | ArrayBuffer::New(env->isolate(), std::move(backing)); | 1215 | | - // TODO(thangktran): drop this check when V8 is pumped to 8.0 . | 1216 | | - if (!array_buffer->IsExternal()) | 1217 | | - array_buffer->Externalize(array_buffer->GetBackingStore()); | 1218 | 1212 | array_buffer->SetPrivate( | 1219 | 1213 | env->context(), | 1220 | 1214 | env->arraybuffer_untransferable_private_symbol(), | |
Collapse file Copy file name to clipboardExpand all lines: src/node_messaging.cc -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -389,9 +389,6 @@ Maybe<bool> Message::Serialize(Environment* env, | 389 | 389 | for (Local<ArrayBuffer> ab : array_buffers) { | 390 | 390 | // If serialization succeeded, we render it inaccessible in this Isolate. | 391 | 391 | std::shared_ptr<BackingStore> backing_store = ab->GetBackingStore(); | 392 | | - // TODO(addaleax): This can/should be dropped once we have V8 8.0. | 393 | | - if (!ab->IsExternal()) | 394 | | - ab->Externalize(backing_store); | 395 | 392 | ab->Detach(); | 396 | 393 |
| 397 | 394 | array_buffers_.emplace_back(std::move(backing_store)); | |
Collapse file Copy file name to clipboardExpand all lines: test/js-native-api/test_typedarray/test.js +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -78,9 +78,11 @@ nonByteArrayTypes.forEach((currentType) => { | 78 | 78 | // Test detaching | 79 | 79 | arrayTypes.forEach((currentType) => { | 80 | 80 | const buffer = Reflect.construct(currentType, [8]); | 81 | | - assert.throws( | 82 | | - () => test_typedarray.Detach(buffer), | 83 | | - /A detachable arraybuffer was expected/); | | 81 | + assert.strictEqual(buffer.length, 8); | | 82 | + assert.ok(!test_typedarray.IsDetached(buffer.buffer)); | | 83 | + test_typedarray.Detach(buffer); | | 84 | + assert.ok(test_typedarray.IsDetached(buffer.buffer)); | | 85 | + assert.strictEqual(buffer.length, 0); | 84 | 86 | }); | 85 | 87 | { | 86 | 88 | const buffer = test_typedarray.External(); | |
|