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) ...@@ -76,17 +76,6 @@ function toStringDescription(obj)
return toString(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. * FireBug's array detection.
* @param {*} obj * @param {*} obj
...@@ -101,7 +90,8 @@ function isArrayLike(obj) ...@@ -101,7 +90,8 @@ function isArrayLike(obj)
if (!InjectedScriptHost.objectHasOwnProperty(/** @type {!Object} */ (obj), "length")) if (!InjectedScriptHost.objectHasOwnProperty(/** @type {!Object} */ (obj), "length"))
return false; return false;
var len = InjectedScriptHost.getProperty(obj, "length"); 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; return false;
} }
...@@ -184,16 +174,18 @@ InjectedScript.primitiveTypes = { ...@@ -184,16 +174,18 @@ InjectedScript.primitiveTypes = {
* @type {!Object<string, string>} * @type {!Object<string, string>}
* @const * @const
*/ */
InjectedScript.closureTypes = { __proto__: null }; InjectedScript.closureTypes = {
InjectedScript.closureTypes["local"] = "Local"; "local": "Local",
InjectedScript.closureTypes["closure"] = "Closure"; "closure": "Closure",
InjectedScript.closureTypes["catch"] = "Catch"; "catch": "Catch",
InjectedScript.closureTypes["block"] = "Block"; "block": "Block",
InjectedScript.closureTypes["script"] = "Script"; "script": "Script",
InjectedScript.closureTypes["with"] = "With Block"; "with": "With Block",
InjectedScript.closureTypes["global"] = "Global"; "global": "Global",
InjectedScript.closureTypes["eval"] = "Eval"; "eval": "Eval",
InjectedScript.closureTypes["module"] = "Module"; "module": "Module",
__proto__: null
};
InjectedScript.prototype = { InjectedScript.prototype = {
/** /**
...@@ -254,6 +246,7 @@ InjectedScript.prototype = { ...@@ -254,6 +246,7 @@ InjectedScript.prototype = {
columns = [columns]; columns = [columns];
if (InjectedScriptHost.subtype(columns) === "array") { if (InjectedScriptHost.subtype(columns) === "array") {
columnNames = []; columnNames = [];
InjectedScriptHost.nullifyPrototype(columnNames);
for (var i = 0; i < columns.length; ++i) for (var i = 0; i < columns.length; ++i)
columnNames[i] = toString(columns[i]); columnNames[i] = toString(columns[i]);
} }
......
...@@ -312,6 +312,85 @@ Checks console methods ...@@ -312,6 +312,85 @@ Checks console methods
type : table 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 method : Runtime.consoleAPICalled
params : { params : {
...@@ -327,7 +406,7 @@ Checks console methods ...@@ -327,7 +406,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 17 lineNumber : 18
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -359,7 +438,7 @@ Checks console methods ...@@ -359,7 +438,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 18 lineNumber : 19
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -391,7 +470,7 @@ Checks console methods ...@@ -391,7 +470,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 19 lineNumber : 20
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -423,7 +502,7 @@ Checks console methods ...@@ -423,7 +502,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 20 lineNumber : 21
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -455,7 +534,7 @@ Checks console methods ...@@ -455,7 +534,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 21 lineNumber : 22
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -487,7 +566,7 @@ Checks console methods ...@@ -487,7 +566,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 22 lineNumber : 23
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -519,7 +598,7 @@ Checks console methods ...@@ -519,7 +598,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 23 lineNumber : 24
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -551,7 +630,7 @@ Checks console methods ...@@ -551,7 +630,7 @@ Checks console methods
[0] : { [0] : {
columnNumber : 10 columnNumber : 10
functionName : testFunction functionName : testFunction
lineNumber : 24 lineNumber : 25
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -583,14 +662,14 @@ Checks console methods ...@@ -583,14 +662,14 @@ Checks console methods
[0] : { [0] : {
columnNumber : 12 columnNumber : 12
functionName : foo functionName : foo
lineNumber : 26 lineNumber : 27
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
[1] : { [1] : {
columnNumber : 2 columnNumber : 2
functionName : testFunction functionName : testFunction
lineNumber : 28 lineNumber : 29
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
...@@ -622,14 +701,14 @@ Checks console methods ...@@ -622,14 +701,14 @@ Checks console methods
[0] : { [0] : {
columnNumber : 12 columnNumber : 12
functionName : foo functionName : foo
lineNumber : 26 lineNumber : 27
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
[1] : { [1] : {
columnNumber : 2 columnNumber : 2
functionName : testFunction functionName : testFunction
lineNumber : 29 lineNumber : 30
scriptId : <scriptId> scriptId : <scriptId>
url : test.js url : test.js
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks console methods'); let {session, contextGroup, Protocol} = InspectorTest.start('Checks console methods');
contextGroup.setupInjectedScriptEnvironment();
contextGroup.addScript(` contextGroup.addScript(`
function testFunction() { function testFunction() {
console.debug('debug'); console.debug('debug');
...@@ -14,6 +15,7 @@ function testFunction() { ...@@ -14,6 +15,7 @@ function testFunction() {
console.dir('dir'); console.dir('dir');
console.dirxml('dirxml'); console.dirxml('dirxml');
console.table([[1,2],[3,4]]); console.table([[1,2],[3,4]]);
console.table([[1,2],[3,4]], [1,2]);
console.trace('trace'); console.trace('trace');
console.trace(); console.trace();
console.group(); 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