Commit 0f56f71b authored by Benedikt Meurer's avatar Benedikt Meurer Committed by V8 LUCI CQ

[inspector] Remove unused formatAccessorsAsProperties().

Following up on https://crrev.com/c/3067319 (V8 call site) and
https://crrev.com/c/3080920 (Blink override), we can now safely remove
the formatAccessorsAsProperties() predicate in the inspector API. V8 now
consistently applies the logic to all "inherited", native accessor
properties (which means both Blink IDL attributes and V8 builtins).

Bug: chromium:1076820, chromium:1199247
Change-Id: I156ee43eb87ffd7b1ba69900fe11283f37241dda
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3080568
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76187}
parent e32ec4ba
......@@ -194,9 +194,6 @@ class V8_EXPORT V8InspectorClient {
v8::Local<v8::Context>, v8::Local<v8::Value>) {
return nullptr;
}
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
return false;
}
virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; }
virtual v8::Local<v8::Context> ensureDefaultContextInGroup(
......
......@@ -254,9 +254,6 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
inspector->Set(ToV8String(isolate, "callWithScheduledBreak"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::CallWithScheduledBreak));
inspector->Set(ToV8String(isolate, "allowAccessorFormatting"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::AllowAccessorFormatting));
inspector->Set(
ToV8String(isolate, "markObjectAsNotInspectable"),
v8::FunctionTemplate::New(
......@@ -389,21 +386,6 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
data->CancelPauseOnNextStatement(context_group_id);
}
static void AllowAccessorFormatting(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsObject()) {
return;
}
v8::Local<v8::Object> object = args[0].As<v8::Object>();
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
isolate, ToV8String(isolate, "allowAccessorFormatting"));
object
->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate,
v8::Null(isolate))
.ToChecked();
}
static void MarkObjectAsNotInspectable(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsObject()) {
......
......@@ -445,9 +445,6 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
inspector->Set(isolate, "callWithScheduledBreak",
v8::FunctionTemplate::New(
isolate, &InspectorExtension::CallWithScheduledBreak));
inspector->Set(isolate, "allowAccessorFormatting",
v8::FunctionTemplate::New(
isolate, &InspectorExtension::AllowAccessorFormatting));
inspector->Set(
isolate, "markObjectAsNotInspectable",
v8::FunctionTemplate::New(
......@@ -583,21 +580,6 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
data->CancelPauseOnNextStatement(context_group_id);
}
static void AllowAccessorFormatting(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsObject()) {
FATAL("Internal error: allowAccessorFormatting('object').");
}
v8::Local<v8::Object> object = args[0].As<v8::Object>();
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
isolate, ToV8String(isolate, "allowAccessorFormatting"));
object
->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate,
v8::Null(isolate))
.ToChecked();
}
static void MarkObjectAsNotInspectable(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsObject()) {
......
......@@ -367,17 +367,6 @@ std::vector<int> IsolateData::GetSessionIds(int context_group_id) {
return result;
}
bool IsolateData::formatAccessorsAsProperties(v8::Local<v8::Value> object) {
v8::Local<v8::Context> context = isolate()->GetCurrentContext();
v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
isolate(),
v8::String::NewFromUtf8Literal(isolate(), "allowAccessorFormatting"));
CHECK(object->IsObject());
return object.As<v8::Object>()
->HasPrivate(context, shouldFormatAccessorsPrivate)
.FromMaybe(false);
}
bool IsolateData::isInspectableHeapObject(v8::Local<v8::Object> object) {
v8::Local<v8::Context> context = isolate()->GetCurrentContext();
v8::MicrotasksScope microtasks_scope(
......
......@@ -114,7 +114,6 @@ class IsolateData : public v8_inspector::V8InspectorClient {
std::vector<int> GetSessionIds(int context_group_id);
// V8InspectorClient implementation.
bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
v8::Local<v8::Context> ensureDefaultContextInGroup(
int context_group_id) override;
double currentTimeMS() override;
......
......@@ -188,7 +188,7 @@ InspectorTest.ContextGroup = class {
"PropertyDescriptor","object","get","set","value","configurable",
"enumerable","symbol","getPrototypeOf","nativeAccessorDescriptor",
"isBuiltin","hasGetter","hasSetter","getOwnPropertyDescriptor",
"description","formatAccessorsAsProperties","isOwn","name",
"description","isOwn","name",
"typedArrayProperties","keys","getOwnPropertyNames",
"getOwnPropertySymbols","isPrimitiveValue","com","toLowerCase",
"ELEMENT","trim","replace","DOCUMENT","size","byteLength","toString",
......
......@@ -845,20 +845,6 @@ Running test: testMixedSetPropertiesPreview
type : object
}
Running test: testObjInheritsGetterProperty
{
description : Object
overflow : false
properties : [
[0] : {
name : propNotNamedProto
type : number
value : NaN
}
]
type : object
}
Running test: testObjWithArrayAsProto
{
description : Array
......
......@@ -55,16 +55,6 @@ for (var i = 0; i < 10; i++) {
mixedSet.add(i);
}
var deterministicNativeFunction = Math.log;
var parentObj = {};
Object.defineProperty(parentObj, 'propNotNamedProto', {
get: deterministicNativeFunction,
set: function() {}
});
inspector.allowAccessorFormatting(parentObj);
var objInheritsGetterProperty = {__proto__: parentObj};
inspector.allowAccessorFormatting(objInheritsGetterProperty);
var arrayWithLongValues = ["a".repeat(101), 2n**401n];
`);
......@@ -134,13 +124,6 @@ InspectorTest.runTestSuite([
.then(next);
},
function testObjInheritsGetterProperty(next)
{
Protocol.Runtime.evaluate({ "expression": "objInheritsGetterProperty", "generatePreview": true })
.then(result => InspectorTest.logMessage(result.result.result.preview))
.then(next);
},
function testObjWithArrayAsProto(next)
{
Protocol.Runtime.evaluate({ "expression": "Object.create([1,2])", "generatePreview": true })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment