Skip to content

Commit 812b126

Browse files
targosrichardlau
authored andcommitted
deps: V8: cherry-pick d90d4533b053
Original commit message: Fix reading integer-indexed import assertions in dynamic import Use GetPropertyOrElement instead of GetProperty to read import assertion values from the import assertions object, to support cases in which the key is an integer index such as `"0"`. The added test case, when using GetProperty, triggers the following DCHECK in debug builds: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/lookup-inl.h;l=108;drc=515f187ba067ee4a99fdf5198cca2c97abd342fd In release builds it silently fails to read the property, and thus throws about it not being a valid string. Bug: v8:14069 Change-Id: Ifd4645b7bd9bfd07f06fa33727441d27eabc4d32 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4614489 Reviewed-by: Victor Gomes <[email protected]> Commit-Queue: Marja Hölttä <[email protected]> Reviewed-by: Marja Hölttä <[email protected]> Cr-Commit-Position: refs/heads/main@{#88267} Refs: v8/v8@d90d453 PR-URL: #50077 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 9ab8c3d commit 812b126

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.35',
39+
'v8_embedder_string': '-node.36',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/execution/isolate.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -4796,8 +4796,8 @@ MaybeHandle<FixedArray> Isolate::GetImportAssertionsFromArgument(
47964796
for (int i = 0; i < assertion_keys->length(); i++) {
47974797
Handle<String> assertion_key(String::cast(assertion_keys->get(i)), this);
47984798
Handle<Object> assertion_value;
4799-
if (!JSReceiver::GetProperty(this, import_assertions_object_receiver,
4800-
assertion_key)
4799+
if (!Object::GetPropertyOrElement(this, import_assertions_object_receiver,
4800+
assertion_key)
48014801
.ToHandle(&assertion_value)) {
48024802
// This can happen if the property has a getter function that throws
48034803
// an error.

deps/v8/test/mjsunit/harmony/modules-import-assertions-dynamic-6.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ var life;
88
import('modules-skip-1.json', { assert: { type: 'json', notARealAssertion: 'value' } }).then(
99
namespace => life = namespace.default.life);
1010

11+
var life2;
12+
import('modules-skip-1.json', { assert: { 0: 'value', type: 'json' } }).then(
13+
namespace => life2 = namespace.default.life);
14+
1115
%PerformMicrotaskCheckpoint();
1216

1317
assertEquals(42, life);
18+
assertEquals(42, life2);

0 commit comments

Comments
 (0)