-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: cherry-pick 50f7455 from upstream V8
Original commit message: [inspector] added Runtime.globalLexicalScopeNames method The method returns names for all available top-level scope variables in giving context. [email protected],[email protected] Bug: chromium:681333 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: I2d0b600e1afbfef9087f53ea9c26abe1e112047c Reviewed-on: https://chromium-review.googlesource.com/719409 Commit-Queue: Aleksey Kozyatinskiy <[email protected]> Reviewed-by: Yang Guo <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#48618} Refs: v8/v8@50f7455 PR-URL: #16591 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
- Loading branch information
1 parent
ffc2659
commit 43fbc39
Showing
9 changed files
with
181 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
deps/v8/test/inspector/runtime/runtime-global-lexical-scope-names-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Test for Runtime.globalLexicalScopeVariablesNames | ||
Running 'let a = 1' | ||
Values: | ||
a = 1 | ||
|
||
Running 'let b = 2' | ||
Values: | ||
a = 1 | ||
b = 2 | ||
|
||
Running 'let b = 3' | ||
Values: | ||
a = 1 | ||
b = 2 | ||
|
||
Running 'const c = 4' | ||
Values: | ||
a = 1 | ||
b = 2 | ||
c = 4 | ||
|
||
Running 'var d = 5' | ||
(should not be in list of scoped variables) | ||
Values: | ||
a = 1 | ||
b = 2 | ||
c = 4 | ||
|
||
Running 'class Foo{}' | ||
Values: | ||
a = 1 | ||
b = 2 | ||
c = 4 | ||
Foo = | ||
{ | ||
className : Function | ||
description : class Foo{} | ||
objectId : <objectId> | ||
type : function | ||
} | ||
|
||
Adding script with scope variables | ||
Values: | ||
a = 1 | ||
b = 2 | ||
c = 4 | ||
Foo = | ||
{ | ||
className : Function | ||
description : class Foo{} | ||
objectId : <objectId> | ||
type : function | ||
} | ||
e = 1 | ||
f = 2 | ||
g = 3 | ||
Boo = | ||
{ | ||
className : Function | ||
description : class Boo {} | ||
objectId : <objectId> | ||
type : function | ||
} |
59 changes: 59 additions & 0 deletions
59
deps/v8/test/inspector/runtime/runtime-global-lexical-scope-names.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// 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. | ||
|
||
let {session, contextGroup, Protocol} = | ||
InspectorTest.start('Test for Runtime.globalLexicalScopeVariablesNames'); | ||
|
||
(async function test() { | ||
InspectorTest.log('Running \'let a = 1\''); | ||
Protocol.Runtime.evaluate({expression: 'let a = 1'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Running \'let b = 2\''); | ||
Protocol.Runtime.evaluate({expression: 'let b = 2'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Running \'let b = 3\''); | ||
Protocol.Runtime.evaluate({expression: 'let b = 3'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Running \'const c = 4\''); | ||
Protocol.Runtime.evaluate({expression: 'const c = 4'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Running \'var d = 5\''); | ||
InspectorTest.log('(should not be in list of scoped variables)'); | ||
Protocol.Runtime.evaluate({expression: 'var d = 5'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Running \'class Foo{}\''); | ||
Protocol.Runtime.evaluate({expression: 'class Foo{}'}); | ||
await dumpGlobalScopeVariables(); | ||
|
||
InspectorTest.log('Adding script with scope variables'); | ||
contextGroup.addScript(` | ||
let e = 1; | ||
const f = 2; | ||
const g = 3; | ||
class Boo {}; | ||
`); | ||
await dumpGlobalScopeVariables(); | ||
InspectorTest.completeTest(); | ||
})(); | ||
|
||
async function dumpGlobalScopeVariables() { | ||
let {result:{names}} = | ||
await Protocol.Runtime.globalLexicalScopeNames(); | ||
InspectorTest.log('Values:'); | ||
for (let name of names) { | ||
let {result:{result}} = await Protocol.Runtime.evaluate({expression: name}); | ||
if (result.value) { | ||
InspectorTest.log(`${name} = ${result.value}`); | ||
} else { | ||
InspectorTest.log(`${name} =`); | ||
InspectorTest.logMessage(result); | ||
} | ||
} | ||
InspectorTest.log(''); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters