Commit 0832bae3 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] fixed endLine in Debugger.scriptParsed event

BUG=chromium:698077
R=lushnikov@chromium.org,alph@chromium.org

Review-Url: https://codereview.chromium.org/2730813002
Cr-Commit-Position: refs/heads/master@{#43567}
parent dbac9770
......@@ -134,11 +134,6 @@ class ActualScript : public V8DebuggerScript {
if (script->Source().ToLocal(&tmp)) {
m_source = toProtocolString(tmp);
// V8 will not count last line if script source ends with \n.
if (m_source.length() > 0 && m_source[m_source.length() - 1] == '\n') {
m_endLine++;
m_endColumn = 0;
}
}
m_isModule = script->IsModule();
......
Checks that we report correct endLine, endColumn and source for scripts.
{
compiled : {
endColumn : 0
endLine : 0
}
returned : {
endColumn : 0
endLine : 0
}
}
{
compiled : {
endColumn : 1
endLine : 0
}
returned : {
endColumn : 1
endLine : 0
}
}
{
compiled : {
endColumn : 2
endLine : 0
}
returned : {
endColumn : 2
endLine : 0
}
}
{
compiled : {
endColumn : 0
endLine : 1
}
returned : {
endColumn : 0
endLine : 1
}
}
{
compiled : {
endColumn : 1
endLine : 1
}
returned : {
endColumn : 1
endLine : 1
}
}
{
compiled : {
endColumn : 3
endLine : 1
}
returned : {
endColumn : 3
endLine : 1
}
}
{
compiled : {
endColumn : 0
endLine : 2
}
returned : {
endColumn : 0
endLine : 2
}
}
{
compiled : {
endColumn : 1
endLine : 2
}
returned : {
endColumn : 1
endLine : 2
}
}
{
compiled : {
endColumn : 2
endLine : 2
}
returned : {
endColumn : 2
endLine : 2
}
}
// Copyright 2017 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.
InspectorTest.log('Checks that we report correct endLine, endColumn and source for scripts.');
var sources = [
'',
' ',
' ',
`
`,
`
`,
`
`,
`
`,
`
`,
`
`];
(async function test() {
Protocol.Debugger.enable();
for (let source of sources) {
InspectorTest.addScript(source);
var message = await Protocol.Debugger.onceScriptParsed();
var inspectorSource = (await Protocol.Debugger.getScriptSource({ scriptId: message.params.scriptId })).result.scriptSource;
var lines = source.split('\n');
var returned = { endLine: message.params.endLine, endColumn: message.params.endColumn };
var compiled = { endLine: lines.length - 1, endColumn: lines[lines.length - 1].length };
InspectorTest.logObject({ returned, compiled });
if (returned.endLine != compiled.endLine) {
InspectorTest.log('error: incorrect endLine');
}
if (returned.endColumn != compiled.endColumn) {
InspectorTest.log('error: incorrect endColumn');
}
if (source !== inspectorSource) {
InspectorTest.log('error: incorrect source');
}
}
InspectorTest.completeTest();
})();
......@@ -5,7 +5,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -41,7 +41,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -59,7 +59,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -77,7 +77,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -113,7 +113,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -131,7 +131,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -275,7 +275,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -293,7 +293,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -311,7 +311,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -329,7 +329,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 5
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -347,7 +347,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -383,7 +383,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -401,7 +401,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : true
hash : <hash>
......@@ -419,7 +419,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -455,7 +455,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -473,7 +473,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -634,7 +634,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 2
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -652,7 +652,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 3
endLine : 2
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -670,7 +670,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 4
endLine : 3
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......@@ -688,7 +688,7 @@ scriptParsed
}
{
endColumn : 0
endLine : 5
endLine : 4
executionContextId : <executionContextId>
hasSourceURL : false
hash : <hash>
......
......@@ -37,7 +37,7 @@ Checks basic ES6 modules support.
method : Debugger.scriptParsed
params : {
endColumn : 0
endLine : 9
endLine : 8
executionContextId : <executionContextId>
hasSourceURL : false
hash : 54D834614FBF9B389082DAE06CD3EFC499BEBF13
......
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