From 01cea9a8d8f322b792df42b0eb6ce6d522124cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 9 Apr 2022 11:09:42 +0200 Subject: [PATCH] deps: V8: cherry-pick a2cae2180a7a Original commit message: [runtime] Fix handling of interceptors, pt.2 Stores to undeclared global in strict mode should throw ReferenceError. Bug: chromium:1309225 Change-Id: Iac7c55da2ff9c16e488b4fc66408c5300469873e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3553099 Commit-Queue: Igor Sheludko Auto-Submit: Igor Sheludko Reviewed-by: Toon Verwaest Commit-Queue: Toon Verwaest Cr-Commit-Position: refs/heads/main@{#79625} Refs: https://github.com/v8/v8/commit/a2cae2180a7a6d64ccdede44d730c9fbba690fb7 PR-URL: https://github.com/nodejs/node/pull/42657 Reviewed-By: Darshan Sen Reviewed-By: Richard Lau Reviewed-By: Jiawen Geng Reviewed-By: Michael Dawson --- common.gypi | 2 +- deps/v8/src/objects/objects.cc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index ecb5dd907f2b75..851816e084565d 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.8', + 'v8_embedder_string': '-node.9', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/objects/objects.cc b/deps/v8/src/objects/objects.cc index 3fa06d921c0a8f..e80a6d699cbf6e 100644 --- a/deps/v8/src/objects/objects.cc +++ b/deps/v8/src/objects/objects.cc @@ -2702,6 +2702,10 @@ Maybe Object::SetSuperProperty(LookupIterator* it, Handle value, JSReceiver::GetOwnPropertyDescriptor(&own_lookup, &desc); MAYBE_RETURN(owned, Nothing()); if (!owned.FromJust()) { + if (!CheckContextualStoreToJSGlobalObject(&own_lookup, + should_throw)) { + return Nothing(); + } return JSReceiver::CreateDataProperty(&own_lookup, value, should_throw); }