Commit d415be61 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] one more array with nullified __proto__

+ little reduction of injected-script-source size.

Bug: chromium:759651
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia5d0b31fddc9f6c6c7e547618a6a01e93564bcbc
Reviewed-on: https://chromium-review.googlesource.com/660409Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47958}
parent 695cc8fe
......@@ -76,17 +76,6 @@ function toStringDescription(obj)
return toString(obj);
}
/**
* @param {number|string} obj
* @return {boolean}
*/
function isUInt32(obj)
{
if (typeof obj === "number")
return obj >>> 0 === obj && (obj > 0 || 1 / obj > 0);
return "" + (obj >>> 0) === obj;
}
/**
* FireBug's array detection.
* @param {*} obj
......@@ -101,7 +90,8 @@ function isArrayLike(obj)
if (!InjectedScriptHost.objectHasOwnProperty(/** @type {!Object} */ (obj), "length"))
return false;
var len = InjectedScriptHost.getProperty(obj, "length");
return typeof len === "number" && isUInt32(len);
// is len uint32?
return typeof len === "number" && len >>> 0 === len && (len > 0 || 1 / len > 0);
}
return false;
}
......@@ -184,16 +174,18 @@ InjectedScript.primitiveTypes = {
* @type {!Object<string, string>}
* @const
*/
InjectedScript.closureTypes = { __proto__: null };
InjectedScript.closureTypes["local"] = "Local";
InjectedScript.closureTypes["closure"] = "Closure";
InjectedScript.closureTypes["catch"] = "Catch";
InjectedScript.closureTypes["block"] = "Block";
InjectedScript.closureTypes["script"] = "Script";
InjectedScript.closureTypes["with"] = "With Block";
InjectedScript.closureTypes["global"] = "Global";
InjectedScript.closureTypes["eval"] = "Eval";
InjectedScript.closureTypes["module"] = "Module";
InjectedScript.closureTypes = {
"local": "Local",
"closure": "Closure",
"catch": "Catch",
"block": "Block",
"script": "Script",
"with": "With Block",
"global": "Global",
"eval": "Eval",
"module": "Module",
__proto__: null
};
InjectedScript.prototype = {
/**
......@@ -254,6 +246,7 @@ InjectedScript.prototype = {
columns = [columns];
if (InjectedScriptHost.subtype(columns) === "array") {
columnNames = [];
InjectedScriptHost.nullifyPrototype(columnNames);
for (var i = 0; i < columns.length; ++i)
columnNames[i] = toString(columns[i]);
}
......
......@@ -312,6 +312,85 @@ Checks console methods
type : table
}
}
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
className : Array
description : Array(2)
objectId : <objectId>
preview : {
description : Array(2)
overflow : false
properties : [
[0] : {
name : 0
subtype : array
type : object
valuePreview : {
description : Array(2)
overflow : false
properties : [
[0] : {
name : 1
type : number
value : 2
}
]
subtype : array
type : object
}
}
[1] : {
name : 1
subtype : array
type : object
valuePreview : {
description : Array(2)
overflow : false
properties : [
[0] : {
name : 1
type : number
value : 4
}
]
subtype : array
type : object
}
}
]
subtype : array
type : object
}
subtype : array
type : object
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 17
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : table
}
}
{
method : Runtime.consoleAPICalled
params : {
......@@ -327,7 +406,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 17
lineNumber : 18
scriptId : <scriptId>
url : test.js
}
......@@ -359,7 +438,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 18
lineNumber : 19
scriptId : <scriptId>
url : test.js
}
......@@ -391,7 +470,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 19
lineNumber : 20
scriptId : <scriptId>
url : test.js
}
......@@ -423,7 +502,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 20
lineNumber : 21
scriptId : <scriptId>
url : test.js
}
......@@ -455,7 +534,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 21
lineNumber : 22
scriptId : <scriptId>
url : test.js
}
......@@ -487,7 +566,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 22
lineNumber : 23
scriptId : <scriptId>
url : test.js
}
......@@ -519,7 +598,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 23
lineNumber : 24
scriptId : <scriptId>
url : test.js
}
......@@ -551,7 +630,7 @@ Checks console methods
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 24
lineNumber : 25
scriptId : <scriptId>
url : test.js
}
......@@ -583,14 +662,14 @@ Checks console methods
[0] : {
columnNumber : 12
functionName : foo
lineNumber : 26
lineNumber : 27
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 2
functionName : testFunction
lineNumber : 28
lineNumber : 29
scriptId : <scriptId>
url : test.js
}
......@@ -622,14 +701,14 @@ Checks console methods
[0] : {
columnNumber : 12
functionName : foo
lineNumber : 26
lineNumber : 27
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 2
functionName : testFunction
lineNumber : 29
lineNumber : 30
scriptId : <scriptId>
url : test.js
}
......
......@@ -4,6 +4,7 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks console methods');
contextGroup.setupInjectedScriptEnvironment();
contextGroup.addScript(`
function testFunction() {
console.debug('debug');
......@@ -14,6 +15,7 @@ function testFunction() {
console.dir('dir');
console.dirxml('dirxml');
console.table([[1,2],[3,4]]);
console.table([[1,2],[3,4]], [1,2]);
console.trace('trace');
console.trace();
console.group();
......
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