Revert "[inspector] queryObjects returns result"
This reverts commit 9732f422c7
.
Reason for revert.
Original change's description:
> [inspector] queryObjects returns result
>
> queryObjects command line API return array instead of sending
> inspectRequest notification.
>
> R=pfeldman@chromium.org
>
> Bug: chromium:825349
> Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
> Change-Id: Ie6c64419cb108b313c43b66eab533c5a7d5d9024
> Reviewed-on: https://chromium-review.googlesource.com/978464
> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
> Reviewed-by: Pavel Feldman <pfeldman@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#52197}
TBR=pfeldman@chromium.org,kozyatinskiy@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:825349
Change-Id: I90f93b96981d8218b9ad1dc0f4ebfb5a7cb671bc
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Reviewed-on: https://chromium-review.googlesource.com/982431
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52254}
This commit is contained in:
parent
8d29d92f4d
commit
caf74f9c61
@ -188,6 +188,9 @@ void createBoundFunctionProperty(v8::Local<v8::Context> context,
|
||||
}
|
||||
createDataProperty(context, console, funcName, func);
|
||||
}
|
||||
|
||||
enum InspectRequest { kRegular, kCopyToClipboard, kQueryObjects };
|
||||
|
||||
} // namespace
|
||||
|
||||
V8Console::V8Console(V8InspectorImpl* inspector) : m_inspector(inspector) {}
|
||||
@ -566,8 +569,8 @@ void V8Console::lastEvaluationResultCallback(
|
||||
|
||||
static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
v8::Local<v8::Value> value, int sessionId,
|
||||
const String16& hint, V8InspectorImpl* inspector) {
|
||||
if (hint.isEmpty()) info.GetReturnValue().Set(value);
|
||||
InspectRequest request, V8InspectorImpl* inspector) {
|
||||
if (request == kRegular) info.GetReturnValue().Set(value);
|
||||
|
||||
v8::debug::ConsoleCallArguments args(info);
|
||||
ConsoleHelper helper(args, v8::debug::ConsoleContext(), inspector);
|
||||
@ -581,8 +584,10 @@ static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
|
||||
std::unique_ptr<protocol::DictionaryValue> hints =
|
||||
protocol::DictionaryValue::create();
|
||||
if (!hint.isEmpty()) {
|
||||
hints->setBoolean(hint, true);
|
||||
if (request == kCopyToClipboard) {
|
||||
hints->setBoolean("copyToClipboard", true);
|
||||
} else if (request == kQueryObjects) {
|
||||
hints->setBoolean("queryObjects", true);
|
||||
}
|
||||
if (V8InspectorSessionImpl* session = helper.session(sessionId)) {
|
||||
session->runtimeAgent()->inspect(std::move(wrappedObject),
|
||||
@ -593,13 +598,13 @@ static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
int sessionId) {
|
||||
if (info.Length() < 1) return;
|
||||
inspectImpl(info, info[0], sessionId, String16(), m_inspector);
|
||||
inspectImpl(info, info[0], sessionId, kRegular, m_inspector);
|
||||
}
|
||||
|
||||
void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
int sessionId) {
|
||||
if (info.Length() < 1) return;
|
||||
inspectImpl(info, info[0], sessionId, "copyToClipboard", m_inspector);
|
||||
inspectImpl(info, info[0], sessionId, kCopyToClipboard, m_inspector);
|
||||
}
|
||||
|
||||
void V8Console::queryObjectsCallback(
|
||||
@ -622,10 +627,7 @@ void V8Console::queryObjectsCallback(
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!arg->IsObject()) return;
|
||||
info.GetReturnValue().Set(m_inspector->debugger()->queryObjects(
|
||||
info.GetIsolate()->GetCurrentContext(),
|
||||
v8::Local<v8::Object>::Cast(arg)));
|
||||
inspectImpl(info, arg, sessionId, kQueryObjects, m_inspector);
|
||||
}
|
||||
|
||||
void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info,
|
||||
|
@ -120,52 +120,61 @@ Running test: testQueryObjects
|
||||
}
|
||||
}
|
||||
}
|
||||
{"injectedScriptId":1,"id":10}
|
||||
{
|
||||
id : <messageId>
|
||||
result : {
|
||||
result : {
|
||||
className : Array
|
||||
description : Array(1)
|
||||
method : Runtime.inspectRequested
|
||||
params : {
|
||||
hints : {
|
||||
queryObjects : true
|
||||
}
|
||||
object : {
|
||||
className : Promise
|
||||
description : Promise
|
||||
objectId : <objectId>
|
||||
subtype : array
|
||||
type : object
|
||||
}
|
||||
}
|
||||
}
|
||||
Is Promise.prototype: true
|
||||
{
|
||||
id : <messageId>
|
||||
result : {
|
||||
result : {
|
||||
className : Array
|
||||
description : Array(1)
|
||||
method : Runtime.inspectRequested
|
||||
params : {
|
||||
hints : {
|
||||
queryObjects : true
|
||||
}
|
||||
object : {
|
||||
className : Promise
|
||||
description : Promise
|
||||
objectId : <objectId>
|
||||
subtype : array
|
||||
type : object
|
||||
}
|
||||
}
|
||||
}
|
||||
Is Promise.prototype: true
|
||||
{
|
||||
id : <messageId>
|
||||
result : {
|
||||
result : {
|
||||
className : Array
|
||||
description : Array(0)
|
||||
method : Runtime.inspectRequested
|
||||
params : {
|
||||
hints : {
|
||||
queryObjects : true
|
||||
}
|
||||
object : {
|
||||
className : Object
|
||||
description : Object
|
||||
objectId : <objectId>
|
||||
subtype : array
|
||||
type : object
|
||||
}
|
||||
}
|
||||
}
|
||||
Is p: true
|
||||
{
|
||||
id : <messageId>
|
||||
result : {
|
||||
result : {
|
||||
className : Array
|
||||
description : Array(0)
|
||||
objectId : <objectId>
|
||||
subtype : array
|
||||
type : object
|
||||
method : Runtime.inspectRequested
|
||||
params : {
|
||||
hints : {
|
||||
queryObjects : true
|
||||
}
|
||||
object : {
|
||||
description : 1
|
||||
type : number
|
||||
value : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,28 +36,25 @@ InspectorTest.runAsyncTestSuite([
|
||||
async function testQueryObjects() {
|
||||
InspectorTest.logMessage(await Protocol.Runtime.evaluate({expression: 'queryObjects', includeCommandLineAPI: true}));
|
||||
await Protocol.Runtime.enable();
|
||||
let {result: {result: {objectId}}} = await Protocol.Runtime.evaluate(
|
||||
{expression: 'class Foo {}; a = new Foo(); Foo'});
|
||||
InspectorTest.logMessage(objectId);
|
||||
const objectGroup = 'query';
|
||||
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
|
||||
expression: 'queryObjects(Foo)',
|
||||
includeCommandLineAPI: true,
|
||||
objectGroup
|
||||
}));
|
||||
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
|
||||
expression: 'queryObjects(Foo.prototype)',
|
||||
includeCommandLineAPI: true,
|
||||
objectGroup
|
||||
}));
|
||||
Protocol.Runtime.releaseObjectGroup({objectGroup})
|
||||
await Protocol.Runtime.evaluate({expression: 'a = null;'});
|
||||
InspectorTest.logMessage(await Protocol.Runtime.evaluate(
|
||||
{expression: 'queryObjects(Foo)', includeCommandLineAPI: true}));
|
||||
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
|
||||
expression: 'queryObjects(Foo.prototype)',
|
||||
includeCommandLineAPI: true
|
||||
}));
|
||||
let {result:{result:{objectId}}} = await Protocol.Runtime.evaluate({expression: 'Promise.prototype'});
|
||||
Protocol.Runtime.evaluate({expression: 'queryObjects(Promise)', includeCommandLineAPI: true});
|
||||
let request = await Protocol.Runtime.onceInspectRequested();
|
||||
InspectorTest.logMessage(request);
|
||||
InspectorTest.logMessage('Is Promise.prototype: ' + await isEqual(objectId, request.params.object.objectId));
|
||||
|
||||
Protocol.Runtime.evaluate({expression: 'queryObjects(Promise.prototype)', includeCommandLineAPI: true});
|
||||
request = await Protocol.Runtime.onceInspectRequested();
|
||||
InspectorTest.logMessage(request);
|
||||
InspectorTest.logMessage('Is Promise.prototype: ' + await isEqual(objectId, request.params.object.objectId));
|
||||
|
||||
({result:{result:{objectId}}} = await Protocol.Runtime.evaluate({expression:'p = {a:1}'}));
|
||||
Protocol.Runtime.evaluate({expression: 'queryObjects(p)', includeCommandLineAPI: true});
|
||||
request = await Protocol.Runtime.onceInspectRequested();
|
||||
InspectorTest.logMessage(request);
|
||||
InspectorTest.logMessage('Is p: ' + await isEqual(objectId, request.params.object.objectId));
|
||||
|
||||
Protocol.Runtime.evaluate({expression: 'queryObjects(1)', includeCommandLineAPI: true});
|
||||
InspectorTest.logMessage(await Protocol.Runtime.onceInspectRequested());
|
||||
await Protocol.Runtime.disable();
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user