Commit c1622945 authored by machenbach's avatar machenbach Committed by Commit bot

Revert of [inspector] make console.assert much faster (patchset #3 id:40001 of...

Revert of [inspector] make console.assert much faster (patchset #3 id:40001 of https://codereview.chromium.org/2505493002/ )

Reason for revert:
Speculative revert as there seems to be a layout test crash:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/11585

Please reland if it doesn't get green.

Original issue's description:
> [inspector] make console.assert much faster
>
> New console.assert implementation is faster then custom user implementation.
>
> BUG=chromium:663845
> R=dgozman@chromium.org
>
> Committed: https://crrev.com/f658e41d864267fb9e99ea76faa7758b0b63d5c9
> Cr-Commit-Position: refs/heads/master@{#41227}

TBR=dgozman@chromium.org,yangguo@chromium.org,kozyatinskiy@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:663845

Review-Url: https://codereview.chromium.org/2521323005
Cr-Commit-Position: refs/heads/master@{#41231}
parent 1a4294b1
......@@ -714,28 +714,6 @@ v8::Local<v8::Object> V8Console::createConsole(
createBoundFunctionProperty(context, console, "timeStamp",
V8Console::timeStampCallback);
const char* jsConsoleAssert =
"(function(){\n"
" var originAssert = this.assert;\n"
" originAssert.apply = Function.prototype.apply;\n"
" this.assert = assertWrapper;\n"
" assertWrapper.toString = () => originAssert.toString();\n"
" function assertWrapper(){\n"
" if (!!arguments[0]) return;\n"
" originAssert.apply(null, arguments);\n"
" }\n"
"})";
v8::Local<v8::String> assertSource = toV8String(isolate, jsConsoleAssert);
V8InspectorImpl* inspector = inspectedContext->inspector();
v8::Local<v8::Value> setupFunction;
if (inspector->compileAndRunInternalScript(context, assertSource)
.ToLocal(&setupFunction) &&
setupFunction->IsFunction()) {
inspector->callFunction(v8::Local<v8::Function>::Cast(setupFunction),
context, console, 0, nullptr);
}
if (hasMemoryAttribute)
console->SetAccessorProperty(
toV8StringInternalized(isolate, "memory"),
......
......@@ -80,7 +80,7 @@ assertTrue(extension_count == 2 || extension_count == 3);
// This script, test-api.js and mjsunit.js has been loaded. If using d8, d8
// loads a normal script during startup too.
assertTrue(normal_count == 3 || normal_count == 4);
assertTrue(inspector_count == 2);
assertTrue(inspector_count == 1);
// Test a builtins script.
var array_script = Debug.findScript('native array.js');
......
Checks that console.assert works and points to correct call frame.
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : console.assert
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 4
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url : evaluate.js
}
]
}
timestamp : <timestamp>
type : assert
}
}
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 1
type : number
value : 1
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 5
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url : evaluate.js
}
]
}
timestamp : <timestamp>
type : assert
}
}
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 1
type : number
value : 1
}
[1] : {
description : 2
type : number
value : 2
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 6
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url : evaluate.js
}
]
}
timestamp : <timestamp>
type : assert
}
}
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : console.assert
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 10
functionName : testFunction
lineNumber : 7
scriptId : <scriptId>
url : test.js
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url : evaluate.js
}
]
}
timestamp : <timestamp>
type : assert
}
}
{
id : <messageId>
result : {
result : {
className : Function
description : function assert() { [native code] }
objectId : <objectId>
type : function
}
}
}
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
print("Checks that console.assert works and points to correct call frame.");
InspectorTest.addScript(`
function testFunction() {
Function.prototype.apply = () => console.error('Should never call this');
console.assert(true);
console.assert(false);
console.assert(false, 1);
console.assert(false, 1, 2);
console.assert();
return console.assert;
}
//# sourceURL=test.js`);
Protocol.Runtime.onConsoleAPICalled(InspectorTest.logMessage);
Protocol.Runtime.enable();
Protocol.Runtime.evaluate({
expression: "testFunction()//# sourceURL=evaluate.js" })
.then(InspectorTest.logMessage)
.then(InspectorTest.completeTest);
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