electron/patches/node/fix_add_property_query_interceptors.patch
electron-roller[bot] 8a8241163d
chore: bump chromium to 128.0.6558.0 (main) (#42413)
* chore: bump chromium in DEPS to 127.0.6526.0

* chore: update network_service_allow_remote_certificate_verification_logic.patch

manually apply patch due to minor upstream shear

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5598454

* chore: update fix_move_autopipsettingshelper_behind_branding_buildflag.patch

No manual changes; patch applied with fuzz 1

* chore: update refactor_expose_file_system_access_blocklist.patch

No manual changes; patch applied with fuzz 2

* chore: update revert_heap_add_checks_position_info.patch

No manual changes; patch applied with fuzz 1

* chore: e patches all

* chore: bump chromium in DEPS to 127.0.6527.0

* chore: update patches

* chore: bump chromium in DEPS to 127.0.6529.0

* chore: bump chromium in DEPS to 127.0.6531.0

* chore: update patches

* 5596349: Remove PDF OCR toggle from settings.

https://chromium-review.googlesource.com/c/chromium/src/+/5596349

* 5585932: [video-pip] Add minimize button to video picture-in-picture window

https://chromium-review.googlesource.com/c/chromium/src/+/5585932

* 5604487: Reland "[api] Deprecate v8::FunctionCallbackInfo::Holder() for real"

https://chromium-review.googlesource.com/c/v8/v8/+/5604487

* 5581721: [DEPS] Update clang-format location

https://chromium-review.googlesource.com/c/chromium/src/+/5581721

* 5597904: [Windows] Remove ConvertToLongPath from Sandbox Utilities.

https://chromium-review.googlesource.com/c/chromium/src/+/5597904

ResolveNTFunctionPtr was removed in this CL.

* fix: visibility state specs on macOS

Refs https://chromium-review.googlesource.com/c/chromium/src/+/5605407

* Revert "fix: visibility state specs on macOS"

This reverts commit 1eee30a33dfafeec86cdd09526a07b01abca2ed6.

* temp: disable occlusion checker on macOS

* chore: bump chromium in DEPS to 128.0.6535.0

* chore: update patches

* [Extensions] Move some scriptings files out of the API directory.

Refs https://chromium-review.googlesource.com/c/chromium/src/+/5606682

* fix[node]: do not use soon-to-be-deprecated V8 API

* fix: update api_remove_allcan_read_write.patch

* chore: update patches

* chore: update patches

* chore: fix lf mismatch in api_remove_allcan_read_write.patch

* chore: update patches

* chore: bump chromium in DEPS to 128.0.6538.0

* chore: update v8 patches

* chore: update patches

* ui/gl/features.gni: Set use_egl=true unconditionally.

Refs https://chromium-review.googlesource.com/c/chromium/src/+/5569748
Refs https://issues.chromium.org/issues/344606399

* chore: bump chromium in DEPS to 128.0.6540.0

* chore: bump chromium in DEPS to 128.0.6541.0

* chore: update patches

* chore: fix nan read/write patch

* chore: bump chromium in DEPS to 128.0.6543.0

* 5626254: Use sandbox_type instead of process_type | https://chromium-review.googlesource.com/c/chromium/src/+/5626254

* chore: update patches

* rework nan patches

* 5621488: Apply consistent naming conventions to zoom values | https://chromium-review.googlesource.com/c/chromium/src/+/5621488

* chore: bump chromium in DEPS to 128.0.6544.0

* 5605693: Remove files from third_party/ninja | https://chromium-review.googlesource.com/c/chromium/src/+/5605693

* chore: update patches

* chore: maybe fix nan patch, part 3

* chore: delete nan patch

* chore: re-add nan patch (attempt 2)

* chore: add test patch

* fixup! add test patch

* chore: bump chromium in DEPS to 128.0.6549.0

* chore: bump chromium in DEPS to 128.0.6551.0

* 5637699: Add command line to ASAN Additional Info section | https://chromium-review.googlesource.com/c/chromium/src/+/5637699

* chore: update patches

* chore: bump chromium in DEPS to 128.0.6553.0

* chore: bump chromium in DEPS to 128.0.6555.0

* fix: add property query interceptors

* chore: bump chromium in DEPS to 128.0.6557.0

* 5583182: Automatic Fullscreen: Prototype Permissions API query support | https://chromium-review.googlesource.com/c/chromium/src/+/5583182

* 5613297: Move render input router and related dependencies to //components/input | https://chromium-review.googlesource.com/c/chromium/src/+/5613297

* chore: update patches

* test: skip methodswithdata-test.js nan test

* chore: bump chromium in DEPS to 128.0.6558.0

* chore: update patches

* build: reference correct ninja cipd ref

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5605693

* update libcxx filenames

* refactor: CursorManager moved to //components/input

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5613297

* refactor: spanify mojo Read/WriteData methods

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5619291

* refactor: remove constexpr from KeyboardCodeFromKeyIdentifier

Ref: unknown

Added TODO to investigate after

* chore: update patches

* refactor: improve type safety of a11y ids

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5614590

* chore: disable tls node tests that don't apply given boringssl tls configuration

Ref: https://boringssl-review.googlesource.com/c/boringssl/+/68487

* chore: add patch to fix nan v8 incompat with NamedPropertyHandlerConfiguration and IndexedPropertyHandlerConfiguration

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/5630388

* fix: limit subspan length per feedback

* Fix incorrect CalculateInsetsInDIP check

* 5645742: Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al""

https://chromium-review.googlesource.com/c/chromium/src/+/5645742

* chore: more Windows logging

* 5617471: Add NPU blocking to chromium blocklist

https://chromium-review.googlesource.com/c/chromium/src/+/5617471

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Alice Zhao <alice@makenotion.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-07-02 09:51:33 +02:00

574 lines
22 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <vertedinde@electronjs.org>
Date: Mon, 24 Jun 2024 21:48:40 -0700
Subject: fix: add property query interceptors
This commit cherry-picks an upstream interceptor API change
from node-v8/canary to accomodate V8's upstream changes to old
interceptor APIs.
Node PR: https://github.com/nodejs/node-v8/commit/d1f18b0bf16efbc1e54ba04a54735ce4683cb936
CL: https://chromium-review.googlesource.com/c/v8/v8/+/5630388
This patch can be removed when the node change is incorporated into main.
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index f6969e635f692b17b4efca1dfbee086a0199db6e..6ace71b04e9da761c77838dde2abd8088abcb6c4 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -49,6 +49,7 @@ using v8::FunctionTemplate;
using v8::HandleScope;
using v8::IndexedPropertyHandlerConfiguration;
using v8::Int32;
+using v8::Intercepted;
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -457,14 +458,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
}
// static
-void ContextifyContext::PropertyGetterCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::PropertyGetterCallback(
+ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@@ -488,18 +490,22 @@ void ContextifyContext::PropertyGetterCallback(
rv = ctx->global_proxy();
args.GetReturnValue().Set(rv);
+ return Intercepted::kYes;
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertySetterCallback(
+Intercepted ContextifyContext::PropertySetterCallback(
Local<Name> property,
Local<Value> value,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
PropertyAttribute attributes = PropertyAttribute::None;
@@ -517,8 +523,9 @@ void ContextifyContext::PropertySetterCallback(
(static_cast<int>(attributes) &
static_cast<int>(PropertyAttribute::ReadOnly));
- if (read_only)
- return;
+ if (read_only) {
+ return Intercepted::kNo;
+ }
// true for x = 5
// false for this.x = 5
@@ -537,11 +544,16 @@ void ContextifyContext::PropertySetterCallback(
bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
- !is_function)
- return;
+ !is_function) {
+ return Intercepted::kNo;
+ }
- if (!is_declared && property->IsSymbol()) return;
- if (ctx->sandbox()->Set(context, property, value).IsNothing()) return;
+ if (!is_declared && property->IsSymbol()) {
+ return Intercepted::kNo;
+ }
+ if (ctx->sandbox()->Set(context, property, value).IsNothing()) {
+ return Intercepted::kNo;
+ }
Local<Value> desc;
if (is_declared_on_sandbox &&
@@ -555,19 +567,23 @@ void ContextifyContext::PropertySetterCallback(
// We have to specify the return value for any contextual or get/set
// property
if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) ||
- desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false))
+ desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false)) {
args.GetReturnValue().Set(value);
+ return Intercepted::kYes;
+ }
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertyDescriptorCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::PropertyDescriptorCallback(
+ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
@@ -577,19 +593,23 @@ void ContextifyContext::PropertyDescriptorCallback(
Local<Value> desc;
if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) {
args.GetReturnValue().Set(desc);
+ return Intercepted::kYes;
}
}
+ return Intercepted::kNo;
}
// static
-void ContextifyContext::PropertyDefinerCallback(
+Intercepted ContextifyContext::PropertyDefinerCallback(
Local<Name> property,
const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Local<Context> context = ctx->context();
Isolate* isolate = context->GetIsolate();
@@ -608,7 +628,7 @@ void ContextifyContext::PropertyDefinerCallback(
// If the property is set on the global as neither writable nor
// configurable, don't change it on the global or sandbox.
if (is_declared && read_only && dont_delete) {
- return;
+ return Intercepted::kNo;
}
Local<Object> sandbox = ctx->sandbox();
@@ -631,6 +651,9 @@ void ContextifyContext::PropertyDefinerCallback(
desc.has_set() ? desc.set() : Undefined(isolate).As<Value>());
define_prop_on_sandbox(&desc_for_sandbox);
+ // TODO(https://github.com/nodejs/node/issues/52634): this should return
+ // kYes to behave according to the expected semantics.
+ return Intercepted::kNo;
} else {
Local<Value> value =
desc.has_value() ? desc.value() : Undefined(isolate).As<Value>();
@@ -642,26 +665,32 @@ void ContextifyContext::PropertyDefinerCallback(
PropertyDescriptor desc_for_sandbox(value);
define_prop_on_sandbox(&desc_for_sandbox);
}
+ // TODO(https://github.com/nodejs/node/issues/52634): this should return
+ // kYes to behave according to the expected semantics.
+ return Intercepted::kNo;
}
}
// static
-void ContextifyContext::PropertyDeleterCallback(
- Local<Name> property,
- const PropertyCallbackInfo<Boolean>& args) {
+Intercepted ContextifyContext::PropertyDeleterCallback(
+ Local<Name> property, const PropertyCallbackInfo<Boolean>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property);
- if (success.FromMaybe(false))
- return;
+ if (success.FromMaybe(false)) {
+ return Intercepted::kNo;
+ }
// Delete failed on the sandbox, intercept and do not delete on
// the global object.
args.GetReturnValue().Set(false);
+ return Intercepted::kYes;
}
// static
@@ -681,76 +710,84 @@ void ContextifyContext::PropertyEnumeratorCallback(
}
// static
-void ContextifyContext::IndexedPropertyGetterCallback(
- uint32_t index,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::IndexedPropertyGetterCallback(
+ uint32_t index, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyGetterCallback(
+ return ContextifyContext::PropertyGetterCallback(
Uint32ToName(ctx->context(), index), args);
}
-
-void ContextifyContext::IndexedPropertySetterCallback(
+Intercepted ContextifyContext::IndexedPropertySetterCallback(
uint32_t index,
Local<Value> value,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertySetterCallback(
+ return ContextifyContext::PropertySetterCallback(
Uint32ToName(ctx->context(), index), value, args);
}
// static
-void ContextifyContext::IndexedPropertyDescriptorCallback(
- uint32_t index,
- const PropertyCallbackInfo<Value>& args) {
+Intercepted ContextifyContext::IndexedPropertyDescriptorCallback(
+ uint32_t index, const PropertyCallbackInfo<Value>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyDescriptorCallback(
+ return ContextifyContext::PropertyDescriptorCallback(
Uint32ToName(ctx->context(), index), args);
}
-void ContextifyContext::IndexedPropertyDefinerCallback(
+Intercepted ContextifyContext::IndexedPropertyDefinerCallback(
uint32_t index,
const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& args) {
+ const PropertyCallbackInfo<void>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
- ContextifyContext::PropertyDefinerCallback(
+ return ContextifyContext::PropertyDefinerCallback(
Uint32ToName(ctx->context(), index), desc, args);
}
// static
-void ContextifyContext::IndexedPropertyDeleterCallback(
- uint32_t index,
- const PropertyCallbackInfo<Boolean>& args) {
+Intercepted ContextifyContext::IndexedPropertyDeleterCallback(
+ uint32_t index, const PropertyCallbackInfo<Boolean>& args) {
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
- if (IsStillInitializing(ctx)) return;
+ if (IsStillInitializing(ctx)) {
+ return Intercepted::kNo;
+ }
Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), index);
- if (success.FromMaybe(false))
- return;
+ if (success.FromMaybe(false)) {
+ return Intercepted::kNo;
+ }
// Delete failed on the sandbox, intercept and do not delete on
// the global object.
args.GetReturnValue().Set(false);
+ return Intercepted::kYes;
}
void ContextifyScript::CreatePerIsolateProperties(
diff --git a/src/node_contextify.h b/src/node_contextify.h
index d42b5e0c544e726fc3f6d8392a554df9aa480fe9..ea2d513463057715127cb4b4f2d66b4cfcf71351 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -107,42 +107,39 @@ class ContextifyContext : public BaseObject {
const v8::FunctionCallbackInfo<v8::Value>& args);
static void WeakCallback(
const v8::WeakCallbackInfo<ContextifyContext>& data);
- static void PropertyGetterCallback(
+ static v8::Intercepted PropertyGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertySetterCallback(
+ static v8::Intercepted PropertySetterCallback(
v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDescriptorCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted PropertyDescriptorCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDefinerCallback(
+ static v8::Intercepted PropertyDefinerCallback(
v8::Local<v8::Name> property,
const v8::PropertyDescriptor& desc,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void PropertyDeleterCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted PropertyDeleterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Boolean>& args);
static void PropertyEnumeratorCallback(
const v8::PropertyCallbackInfo<v8::Array>& args);
- static void IndexedPropertyGetterCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertySetterCallback(
+ static v8::Intercepted IndexedPropertyGetterCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
+ static v8::Intercepted IndexedPropertySetterCallback(
uint32_t index,
v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDescriptorCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDefinerCallback(
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted IndexedPropertyDescriptorCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
+ static v8::Intercepted IndexedPropertyDefinerCallback(
uint32_t index,
const v8::PropertyDescriptor& desc,
- const v8::PropertyCallbackInfo<v8::Value>& args);
- static void IndexedPropertyDeleterCallback(
- uint32_t index,
- const v8::PropertyCallbackInfo<v8::Boolean>& args);
+ const v8::PropertyCallbackInfo<void>& args);
+ static v8::Intercepted IndexedPropertyDeleterCallback(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& args);
v8::Global<v8::Context> context_;
std::unique_ptr<v8::MicrotaskQueue> microtask_queue_;
diff --git a/src/node_env_var.cc b/src/node_env_var.cc
index bce7ae07214ddf970a530db29ed6970e14b7a5ed..85f82180d48d6cfd7738cd7b1e504f23b38153e8 100644
--- a/src/node_env_var.cc
+++ b/src/node_env_var.cc
@@ -16,6 +16,7 @@ using v8::DontEnum;
using v8::FunctionTemplate;
using v8::HandleScope;
using v8::Integer;
+using v8::Intercepted;
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -336,24 +337,27 @@ Maybe<bool> KVStore::AssignToObject(v8::Isolate* isolate,
return Just(true);
}
-static void EnvGetter(Local<Name> property,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvGetter(Local<Name> property,
+ const PropertyCallbackInfo<Value>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsSymbol()) {
- return info.GetReturnValue().SetUndefined();
+ info.GetReturnValue().SetUndefined();
+ return Intercepted::kYes;
}
CHECK(property->IsString());
MaybeLocal<String> value_string =
env->env_vars()->Get(env->isolate(), property.As<String>());
if (!value_string.IsEmpty()) {
info.GetReturnValue().Set(value_string.ToLocalChecked());
+ return Intercepted::kYes;
}
+ return Intercepted::kNo;
}
-static void EnvSetter(Local<Name> property,
- Local<Value> value,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvSetter(Local<Name> property,
+ Local<Value> value,
+ const PropertyCallbackInfo<void>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
// calling env->EmitProcessEnvWarning() sets a variable indicating that
@@ -369,35 +373,40 @@ static void EnvSetter(Local<Name> property,
"the "
"value to a string before setting process.env with it.",
"DEP0104")
- .IsNothing())
- return;
+ .IsNothing()) {
+ return Intercepted::kNo;
+ }
}
Local<String> key;
Local<String> value_string;
if (!property->ToString(env->context()).ToLocal(&key) ||
!value->ToString(env->context()).ToLocal(&value_string)) {
- return;
+ return Intercepted::kNo;
}
env->env_vars()->Set(env->isolate(), key, value_string);
- // Whether it worked or not, always return value.
- info.GetReturnValue().Set(value);
+ return Intercepted::kYes;
}
-static void EnvQuery(Local<Name> property,
- const PropertyCallbackInfo<Integer>& info) {
+static Intercepted EnvQuery(Local<Name> property,
+ const PropertyCallbackInfo<Integer>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsString()) {
int32_t rc = env->env_vars()->Query(env->isolate(), property.As<String>());
- if (rc != -1) info.GetReturnValue().Set(rc);
+ if (rc != -1) {
+ // Return attributes for the property.
+ info.GetReturnValue().Set(v8::None);
+ return Intercepted::kYes;
+ }
}
+ return Intercepted::kNo;
}
-static void EnvDeleter(Local<Name> property,
- const PropertyCallbackInfo<Boolean>& info) {
+static Intercepted EnvDeleter(Local<Name> property,
+ const PropertyCallbackInfo<Boolean>& info) {
Environment* env = Environment::GetCurrent(info);
CHECK(env->has_run_bootstrapping_code());
if (property->IsString()) {
@@ -407,6 +416,7 @@ static void EnvDeleter(Local<Name> property,
// process.env never has non-configurable properties, so always
// return true like the tc39 delete operator.
info.GetReturnValue().Set(true);
+ return Intercepted::kYes;
}
static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
@@ -417,9 +427,9 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
env->env_vars()->Enumerate(env->isolate()));
}
-static void EnvDefiner(Local<Name> property,
- const PropertyDescriptor& desc,
- const PropertyCallbackInfo<Value>& info) {
+static Intercepted EnvDefiner(Local<Name> property,
+ const PropertyDescriptor& desc,
+ const PropertyCallbackInfo<void>& info) {
Environment* env = Environment::GetCurrent(info);
if (desc.has_value()) {
if (!desc.has_writable() ||
@@ -430,6 +440,7 @@ static void EnvDefiner(Local<Name> property,
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
} else if (!desc.configurable() ||
!desc.enumerable() ||
!desc.writable()) {
@@ -438,6 +449,7 @@ static void EnvDefiner(Local<Name> property,
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
} else {
return EnvSetter(property, desc.value(), info);
}
@@ -447,12 +459,14 @@ static void EnvDefiner(Local<Name> property,
"'process.env' does not accept an"
" accessor(getter/setter)"
" descriptor");
+ return Intercepted::kYes;
} else {
THROW_ERR_INVALID_OBJECT_DEFINE_PROPERTY(env,
"'process.env' only accepts a "
"configurable, writable,"
" and enumerable "
"data descriptor");
+ return Intercepted::kYes;
}
}
diff --git a/src/node_external_reference.h b/src/node_external_reference.h
index 9238f2d4d7376b22e264dbc9359b480937d29676..b5c1df6941616642075babdad81be00ce63ffd56 100644
--- a/src/node_external_reference.h
+++ b/src/node_external_reference.h
@@ -59,16 +59,17 @@ class ExternalReferenceRegistry {
V(v8::FunctionCallback) \
V(v8::AccessorNameGetterCallback) \
V(v8::AccessorNameSetterCallback) \
- V(v8::GenericNamedPropertyDefinerCallback) \
- V(v8::GenericNamedPropertyDeleterCallback) \
- V(v8::GenericNamedPropertyEnumeratorCallback) \
- V(v8::GenericNamedPropertyQueryCallback) \
- V(v8::GenericNamedPropertySetterCallback) \
- V(v8::IndexedPropertySetterCallback) \
- V(v8::IndexedPropertyDefinerCallback) \
- V(v8::IndexedPropertyDeleterCallback) \
- V(v8::IndexedPropertyQueryCallback) \
- V(v8::IndexedPropertyDescriptorCallback) \
+ V(v8::NamedPropertyGetterCallback) \
+ V(v8::NamedPropertyDefinerCallback) \
+ V(v8::NamedPropertyDeleterCallback) \
+ V(v8::NamedPropertyEnumeratorCallback) \
+ V(v8::NamedPropertyQueryCallback) \
+ V(v8::NamedPropertySetterCallback) \
+ V(v8::IndexedPropertyGetterCallbackV2) \
+ V(v8::IndexedPropertySetterCallbackV2) \
+ V(v8::IndexedPropertyDefinerCallbackV2) \
+ V(v8::IndexedPropertyDeleterCallbackV2) \
+ V(v8::IndexedPropertyQueryCallbackV2) \
V(const v8::String::ExternalStringResourceBase*)
#define V(ExternalReferenceType) \