Skip to content

Commit 35b8e5c

Browse files
authored
Revert "vm,src: add property query interceptors"
This reverts commit d1f18b0. Closes: #53346 PR-URL: #53348 Fixes: #53346 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
1 parent 5469d04 commit 35b8e5c

File tree

3 files changed

+3
-156
lines changed

3 files changed

+3
-156
lines changed

src/node_contextify.cc

+2-66
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ using v8::FunctionTemplate;
5151
using v8::HandleScope;
5252
using v8::IndexedPropertyHandlerConfiguration;
5353
using v8::Int32;
54-
using v8::Integer;
5554
using v8::Intercepted;
5655
using v8::Isolate;
5756
using v8::Just;
@@ -177,22 +176,20 @@ void ContextifyContext::InitializeGlobalTemplates(IsolateData* isolate_data) {
177176
NamedPropertyHandlerConfiguration config(
178177
PropertyGetterCallback,
179178
PropertySetterCallback,
180-
PropertyQueryCallback,
179+
PropertyDescriptorCallback,
181180
PropertyDeleterCallback,
182181
PropertyEnumeratorCallback,
183182
PropertyDefinerCallback,
184-
PropertyDescriptorCallback,
185183
{},
186184
PropertyHandlerFlags::kHasNoSideEffect);
187185

188186
IndexedPropertyHandlerConfiguration indexed_config(
189187
IndexedPropertyGetterCallback,
190188
IndexedPropertySetterCallback,
191-
IndexedPropertyQueryCallback,
189+
IndexedPropertyDescriptorCallback,
192190
IndexedPropertyDeleterCallback,
193191
PropertyEnumeratorCallback,
194192
IndexedPropertyDefinerCallback,
195-
IndexedPropertyDescriptorCallback,
196193
{},
197194
PropertyHandlerFlags::kHasNoSideEffect);
198195

@@ -357,14 +354,12 @@ void ContextifyContext::RegisterExternalReferences(
357354
ExternalReferenceRegistry* registry) {
358355
registry->Register(MakeContext);
359356
registry->Register(CompileFunction);
360-
registry->Register(PropertyQueryCallback);
361357
registry->Register(PropertyGetterCallback);
362358
registry->Register(PropertySetterCallback);
363359
registry->Register(PropertyDescriptorCallback);
364360
registry->Register(PropertyDeleterCallback);
365361
registry->Register(PropertyEnumeratorCallback);
366362
registry->Register(PropertyDefinerCallback);
367-
registry->Register(IndexedPropertyQueryCallback);
368363
registry->Register(IndexedPropertyGetterCallback);
369364
registry->Register(IndexedPropertySetterCallback);
370365
registry->Register(IndexedPropertyDescriptorCallback);
@@ -463,51 +458,6 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
463458
return ctx == nullptr || ctx->context_.IsEmpty();
464459
}
465460

466-
// static
467-
Intercepted ContextifyContext::PropertyQueryCallback(
468-
Local<Name> property, const PropertyCallbackInfo<Integer>& args) {
469-
ContextifyContext* ctx = ContextifyContext::Get(args);
470-
471-
// Still initializing
472-
if (IsStillInitializing(ctx)) {
473-
return Intercepted::kNo;
474-
}
475-
476-
Local<Context> context = ctx->context();
477-
Local<Object> sandbox = ctx->sandbox();
478-
479-
PropertyAttribute attr;
480-
481-
Maybe<bool> maybe_has = sandbox->HasRealNamedProperty(context, property);
482-
if (maybe_has.IsNothing()) {
483-
return Intercepted::kNo;
484-
} else if (maybe_has.FromJust()) {
485-
Maybe<PropertyAttribute> maybe_attr =
486-
sandbox->GetRealNamedPropertyAttributes(context, property);
487-
if (!maybe_attr.To(&attr)) {
488-
return Intercepted::kNo;
489-
}
490-
args.GetReturnValue().Set(attr);
491-
return Intercepted::kYes;
492-
} else {
493-
maybe_has = ctx->global_proxy()->HasRealNamedProperty(context, property);
494-
if (maybe_has.IsNothing()) {
495-
return Intercepted::kNo;
496-
} else if (maybe_has.FromJust()) {
497-
Maybe<PropertyAttribute> maybe_attr =
498-
ctx->global_proxy()->GetRealNamedPropertyAttributes(context,
499-
property);
500-
if (!maybe_attr.To(&attr)) {
501-
return Intercepted::kNo;
502-
}
503-
args.GetReturnValue().Set(attr);
504-
return Intercepted::kYes;
505-
}
506-
}
507-
508-
return Intercepted::kNo;
509-
}
510-
511461
// static
512462
Intercepted ContextifyContext::PropertyGetterCallback(
513463
Local<Name> property, const PropertyCallbackInfo<Value>& args) {
@@ -759,20 +709,6 @@ void ContextifyContext::PropertyEnumeratorCallback(
759709
args.GetReturnValue().Set(properties);
760710
}
761711

762-
// static
763-
Intercepted ContextifyContext::IndexedPropertyQueryCallback(
764-
uint32_t index, const PropertyCallbackInfo<Integer>& args) {
765-
ContextifyContext* ctx = ContextifyContext::Get(args);
766-
767-
// Still initializing
768-
if (IsStillInitializing(ctx)) {
769-
return Intercepted::kNo;
770-
}
771-
772-
return ContextifyContext::PropertyQueryCallback(
773-
Uint32ToName(ctx->context(), index), args);
774-
}
775-
776712
// static
777713
Intercepted ContextifyContext::IndexedPropertyGetterCallback(
778714
uint32_t index, const PropertyCallbackInfo<Value>& args) {

src/node_contextify.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ class ContextifyContext : public BaseObject {
9494
bool produce_cached_data,
9595
v8::Local<v8::Symbol> id_symbol,
9696
const errors::TryCatchScope& try_catch);
97-
static void WeakCallback(
98-
const v8::WeakCallbackInfo<ContextifyContext>& data);
99-
static v8::Intercepted PropertyQueryCallback(
100-
v8::Local<v8::Name> property,
101-
const v8::PropertyCallbackInfo<v8::Integer>& args);
97+
static void WeakCallback(const v8::WeakCallbackInfo<ContextifyContext>& data);
10298
static v8::Intercepted PropertyGetterCallback(
10399
v8::Local<v8::Name> property,
104100
const v8::PropertyCallbackInfo<v8::Value>& args);
@@ -118,8 +114,6 @@ class ContextifyContext : public BaseObject {
118114
const v8::PropertyCallbackInfo<v8::Boolean>& args);
119115
static void PropertyEnumeratorCallback(
120116
const v8::PropertyCallbackInfo<v8::Array>& args);
121-
static v8::Intercepted IndexedPropertyQueryCallback(
122-
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& args);
123117
static v8::Intercepted IndexedPropertyGetterCallback(
124118
uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
125119
static v8::Intercepted IndexedPropertySetterCallback(

test/parallel/test-vm-global-property-prototype.js

-83
This file was deleted.

0 commit comments

Comments
 (0)