[inspector] console.table should not crash on empty preview
Types such as "function" have a ValueMirror that does not override "buildObjectPreview()". This CL updates clients to check that the preview was actually built after call it. Bug: chromium:907400 Change-Id: Id569c98363d47b259a40790b596efedb3d14abc2 Reviewed-on: https://chromium-review.googlesource.com/c/1347067 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Erik Luo <luoe@chromium.org> Cr-Commit-Position: refs/heads/master@{#57703}
This commit is contained in:
parent
ad0afdae9f
commit
54f92d52c6
@ -451,6 +451,7 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(
|
||||
int limit = 1000;
|
||||
mirror->buildObjectPreview(context, true /* generatePreviewForTable */,
|
||||
&limit, &limit, &preview);
|
||||
if (!preview) return nullptr;
|
||||
|
||||
Array<PropertyPreview>* columns = preview->getProperties();
|
||||
std::unordered_set<String16> selectedColumns;
|
||||
|
@ -953,3 +953,166 @@ Checks console methods
|
||||
type : warning
|
||||
}
|
||||
}
|
||||
{
|
||||
method : Runtime.consoleAPICalled
|
||||
params : {
|
||||
args : [
|
||||
[0] : {
|
||||
type : string
|
||||
value : foo
|
||||
}
|
||||
]
|
||||
executionContextId : <executionContextId>
|
||||
stackTrace : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 10
|
||||
functionName : testFunction
|
||||
lineNumber : 41
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
}
|
||||
timestamp : <timestamp>
|
||||
type : table
|
||||
}
|
||||
}
|
||||
{
|
||||
method : Runtime.consoleAPICalled
|
||||
params : {
|
||||
args : [
|
||||
[0] : {
|
||||
description : 2
|
||||
type : number
|
||||
value : 2
|
||||
}
|
||||
]
|
||||
executionContextId : <executionContextId>
|
||||
stackTrace : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 10
|
||||
functionName : testFunction
|
||||
lineNumber : 42
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
}
|
||||
timestamp : <timestamp>
|
||||
type : table
|
||||
}
|
||||
}
|
||||
{
|
||||
method : Runtime.consoleAPICalled
|
||||
params : {
|
||||
args : [
|
||||
[0] : {
|
||||
description : 2n
|
||||
type : bigint
|
||||
unserializableValue : 2n
|
||||
}
|
||||
]
|
||||
executionContextId : <executionContextId>
|
||||
stackTrace : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 10
|
||||
functionName : testFunction
|
||||
lineNumber : 43
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
}
|
||||
timestamp : <timestamp>
|
||||
type : table
|
||||
}
|
||||
}
|
||||
{
|
||||
method : Runtime.consoleAPICalled
|
||||
params : {
|
||||
args : [
|
||||
[0] : {
|
||||
description : Symbol(foo)
|
||||
objectId : <objectId>
|
||||
type : symbol
|
||||
}
|
||||
]
|
||||
executionContextId : <executionContextId>
|
||||
stackTrace : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 10
|
||||
functionName : testFunction
|
||||
lineNumber : 44
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
}
|
||||
timestamp : <timestamp>
|
||||
type : table
|
||||
}
|
||||
}
|
||||
{
|
||||
method : Runtime.consoleAPICalled
|
||||
params : {
|
||||
args : [
|
||||
[0] : {
|
||||
type : string
|
||||
value : function() {}
|
||||
}
|
||||
]
|
||||
executionContextId : <executionContextId>
|
||||
stackTrace : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 10
|
||||
functionName : testFunction
|
||||
lineNumber : 45
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
}
|
||||
timestamp : <timestamp>
|
||||
type : table
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,11 @@ function testFunction() {
|
||||
console.countReset('default');
|
||||
console.count();
|
||||
console.countReset('countReset');
|
||||
console.table('foo');
|
||||
console.table(2);
|
||||
console.table(2n);
|
||||
console.table(Symbol('foo'));
|
||||
console.table(function() {});
|
||||
}
|
||||
//# sourceURL=test.js`, 7, 26);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user