Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,144 @@
Tests that creating multiple sessions works.
Connecting session 1
From session 1
{
method : Runtime.executionContextCreated
params : {
context : {
id : 1
name :
origin :
uniqueId : <uniqueId>
}
}
}
Connecting session 2
From session 2
{
method : Runtime.executionContextCreated
params : {
context : {
id : 1
name :
origin :
uniqueId : <uniqueId>
}
}
}
Reconnecting session 2
From session 2
{
method : Runtime.executionContextCreated
params : {
context : {
id : 1
name :
origin :
uniqueId : <uniqueId>
}
}
}
Reconnecting session 1
From session 1
{
method : Runtime.executionContextCreated
params : {
context : {
id : 1
name :
origin :
uniqueId : <uniqueId>
}
}
}
Connecting session 3
From session 3
{
method : Runtime.executionContextCreated
params : {
context : {
id : 1
name :
origin :
uniqueId : <uniqueId>
}
}
}
Destroying and creating context
From session 2
{
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true
From session 1
{
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true
From session 3
{
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true
From session 2
{
method : Runtime.executionContextCreated
params : {
context : {
id : 2
name :
origin :
uniqueId : <uniqueId>
}
}
}
From session 1
{
method : Runtime.executionContextCreated
params : {
context : {
id : 2
name :
origin :
uniqueId : <uniqueId>
}
}
}
From session 3
{
method : Runtime.executionContextCreated
params : {
context : {
id : 2
name :
origin :
uniqueId : <uniqueId>
}
}
}
Disconnecting all sessions
Connecting session 4
From session 4
{
method : Runtime.executionContextCreated
params : {
context : {
id : 2
name :
origin :
uniqueId : <uniqueId>
}
}
}

View File

@ -0,0 +1,58 @@
// 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('Tests that creating multiple sessions works.');
function connect(contextGroup, num) {
var session = contextGroup.connect();
var executionContextId;
session.Protocol.Runtime.onExecutionContextCreated(message => {
InspectorTest.log('From session ' + num);
InspectorTest.logMessage(message);
executionContextId = message.params.context.id;
});
session.Protocol.Runtime.onExecutionContextDestroyed(message => {
InspectorTest.log('From session ' + num);
InspectorTest.logMessage(message);
InspectorTest.log('id matching: ' + (message.params.executionContextId === executionContextId));
});
return session;
}
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
InspectorTest.log('Connecting session 1');
var session1 = connect(contextGroup, 1);
await session1.Protocol.Runtime.enable();
InspectorTest.log('Connecting session 2');
var session2 = connect(contextGroup, 2);
await session2.Protocol.Runtime.enable();
InspectorTest.log('Reconnecting session 2');
session2.reconnect();
await session2.Protocol.Runtime.enable();
InspectorTest.log('Reconnecting session 1');
session1.reconnect();
await session1.Protocol.Runtime.enable();
InspectorTest.log('Connecting session 3');
var session3 = connect(contextGroup, 3);
await session3.Protocol.Runtime.enable();
InspectorTest.log('Destroying and creating context');
await session2.Protocol.Runtime.evaluate({expression: 'inspector.fireContextDestroyed(); inspector.fireContextCreated(); '});
InspectorTest.log('Disconnecting all sessions');
session1.disconnect();
session2.disconnect();
session3.disconnect();
InspectorTest.log('Connecting session 4');
var session4 = connect(contextGroup, 4);
await session4.Protocol.Runtime.enable();
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,231 @@
Tests how multiple sessions interact while pausing, stepping, setting breakpoints and blackboxing.
Connecting session 1
Pausing in 1
Paused in 1:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Connecting session 2
Paused in 2:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Resuming in 2
Resumed in 1
Resumed in 2
Setting breakpoints in 1
Setting breakpoints in 2
Evaluating common breakpoint in 1
Paused in 1:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Paused in 2:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Evaluating debugger in 1
Paused in 1:
reason: other
hit breakpoints:
location: bar@26
data: null
Paused in 2:
reason: other
hit breakpoints:
location: bar@26
data: null
Resuming in 2
Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 1
Paused in 1:
reason: other
hit breakpoints: 1:14:0:test.js
location: baz@14
data: null
Paused in 2:
reason: other
hit breakpoints:
location: baz@14
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Evaluating common breakpoint in 2
Paused in 1:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Paused in 2:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Resuming in 2
Resumed in 1
Resumed in 2
Evaluating debugger in 2
Paused in 1:
reason: other
hit breakpoints:
location: bar@26
data: null
Paused in 2:
reason: other
hit breakpoints:
location: bar@26
data: null
Resuming in 2
Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 2
Paused in 1:
reason: other
hit breakpoints: 1:14:0:test.js
location: baz@14
data: null
Paused in 2:
reason: other
hit breakpoints:
location: baz@14
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Evaluating stepping in 1
Paused in 1:
reason: other
hit breakpoints:
location: stepping@17
data: null
Paused in 2:
reason: other
hit breakpoints:
location: stepping@17
data: null
Stepping into in 2
Resumed in 1
Resumed in 2
Paused in 1:
reason: step
hit breakpoints:
location: stepping@18
data: null
Paused in 2:
reason: step
hit breakpoints:
location: stepping@18
data: null
Stepping over in 1
Resumed in 1
Resumed in 2
Paused in 1:
reason: step
hit breakpoints:
location: stepping@19
data: null
Paused in 2:
reason: step
hit breakpoints:
location: stepping@19
data: null
Stepping out in 2
Resumed in 1
Resumed in 2
Paused in 1:
reason: step
hit breakpoints:
location: <anonymous>@0
data: null
Paused in 2:
reason: step
hit breakpoints:
location: <anonymous>@0
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Paused in 2:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 1
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Paused in 2:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 2
Resumed in 1
Resumed in 2
Blackboxing bar() in 2
Evaluating bar() in 2
Paused in 1:
reason: other
hit breakpoints:
location: bar@26
data: null
Resuming in 1
Resumed in 1
Blackboxing bar() in 1
Evaluating bar() in 2
Skipping pauses in 1
Evaluating common breakpoint in 1
Paused in 2:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Resuming in 2
Resumed in 2
Skipping pauses in 2
Evaluating common breakpoint in 1
Unskipping pauses in 1
Unskipping pauses in 2
Deactivating breakpoints in 1
Evaluating common breakpoint in 1
Paused in 2:
reason: other
hit breakpoints: 1:11:0:test.js
location: foo@11
data: null
Resuming in 2
Resumed in 2
Deactivating breakpoints in 2
Evaluating common breakpoint in 1
Activating breakpoints in 1
Activating breakpoints in 2
Disabling debugger agent in 1
Evaluating breakpoint in 1 (should not be triggered)
Paused in 2:
reason: other
hit breakpoints:
location: <anonymous>@1
data: null
Activating debugger agent in 1
Disabling debugger agent in 2
Disabling debugger agent in 1

View File

@ -0,0 +1,222 @@
// 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('Tests how multiple sessions interact while pausing, stepping, setting breakpoints and blackboxing.');
var contextGroup = new InspectorTest.ContextGroup();
contextGroup.addInlineScript(
`
function foo() {
return 1;
}
function baz() {
return 2;
}
function stepping() {
debugger;
var a = 1;
var b = 1;
}`,
'test.js');
contextGroup.addInlineScript(
`
function bar() {
debugger;
}`,
'test2.js');
(async function test() {
InspectorTest.log('Connecting session 1');
var session1 = contextGroup.connect();
await session1.Protocol.Debugger.enable();
InspectorTest.log('Pausing in 1');
session1.Protocol.Runtime.evaluate({expression: 'debugger;'});
await waitForPaused(session1, 1);
InspectorTest.log('Connecting session 2');
var session2 = contextGroup.connect();
var enabledPromise = session2.Protocol.Debugger.enable();
await waitForPaused(session2, 2);
await enabledPromise;
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Setting breakpoints in 1');
await session1.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 11});
await session1.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 14});
InspectorTest.log('Setting breakpoints in 2');
await session2.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 11});
InspectorTest.log('Evaluating common breakpoint in 1');
session1.Protocol.Runtime.evaluate({expression: 'foo();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating debugger in 1');
session1.Protocol.Runtime.evaluate({expression: 'bar();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating exclusive breakpoint in 1');
session1.Protocol.Runtime.evaluate({expression: 'baz();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating common breakpoint in 2');
session2.Protocol.Runtime.evaluate({expression: 'foo();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating debugger in 2');
session2.Protocol.Runtime.evaluate({expression: 'bar();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating exclusive breakpoint in 2');
session2.Protocol.Runtime.evaluate({expression: 'baz();'});
await waitForBothPaused();
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Evaluating stepping in 1');
session1.Protocol.Runtime.evaluate({expression: 'stepping();'});
await waitForBothPaused();
InspectorTest.log('Stepping into in 2');
session2.Protocol.Debugger.stepInto();
await waitForBothResumed();
await waitForBothPaused();
InspectorTest.log('Stepping over in 1');
session1.Protocol.Debugger.stepOver();
await waitForBothResumed();
await waitForBothPaused();
InspectorTest.log('Stepping out in 2');
session2.Protocol.Debugger.stepOut();
await waitForBothResumed();
await waitForBothPaused();
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Pausing in next statement');
contextGroup.schedulePauseOnNextStatement('some-reason', JSON.stringify({a: 42}));
session2.Protocol.Runtime.evaluate({expression: 'var a = 1;'});
await waitForBothPaused();
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Pausing in next statement');
contextGroup.schedulePauseOnNextStatement('some-reason', JSON.stringify({a: 42}));
session2.Protocol.Runtime.evaluate({expression: 'var a = 1;'});
await waitForBothPaused();
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Blackboxing bar() in 2');
await session2.Protocol.Debugger.setBlackboxPatterns({patterns: ['test2.js']});
InspectorTest.log('Evaluating bar() in 2');
session2.Protocol.Runtime.evaluate({expression: 'bar();'});
await waitForPaused(session1, 1);
InspectorTest.log('Resuming in 1');
session1.Protocol.Debugger.resume();
await waitForResumed(session1, 1);
InspectorTest.log('Blackboxing bar() in 1');
await session1.Protocol.Debugger.setBlackboxPatterns({patterns: ['test2.js']});
InspectorTest.log('Evaluating bar() in 2');
await session2.Protocol.Runtime.evaluate({expression: 'bar();'});
InspectorTest.log('Skipping pauses in 1');
await session1.Protocol.Debugger.setSkipAllPauses({skip: true});
InspectorTest.log('Evaluating common breakpoint in 1');
session1.Protocol.Runtime.evaluate({expression: 'foo();'});
await waitForPaused(session2, 2);
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForResumed(session2, 2);
InspectorTest.log('Skipping pauses in 2');
await session2.Protocol.Debugger.setSkipAllPauses({skip: true});
InspectorTest.log('Evaluating common breakpoint in 1');
await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
InspectorTest.log('Unskipping pauses in 1');
await session1.Protocol.Debugger.setSkipAllPauses({skip: false});
InspectorTest.log('Unskipping pauses in 2');
await session2.Protocol.Debugger.setSkipAllPauses({skip: false});
InspectorTest.log('Deactivating breakpoints in 1');
await session1.Protocol.Debugger.setBreakpointsActive({active: false});
InspectorTest.log('Evaluating common breakpoint in 1');
session1.Protocol.Runtime.evaluate({expression: 'foo();'});
await waitForPaused(session2, 2);
InspectorTest.log('Resuming in 2');
session2.Protocol.Debugger.resume();
await waitForResumed(session2, 2);
InspectorTest.log('Deactivating breakpoints in 2');
await session2.Protocol.Debugger.setBreakpointsActive({active: false});
InspectorTest.log('Evaluating common breakpoint in 1');
await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
InspectorTest.log('Activating breakpoints in 1');
await session1.Protocol.Debugger.setBreakpointsActive({active: true});
InspectorTest.log('Activating breakpoints in 2');
await session2.Protocol.Debugger.setBreakpointsActive({active: true});
InspectorTest.log('Disabling debugger agent in 1');
await session1.Protocol.Debugger.disable();
InspectorTest.log('Evaluating breakpoint in 1 (should not be triggered)');
session2.Protocol.Runtime.evaluate({expression: 'baz();\ndebugger;'});
await waitForPaused(session2, 2);
session1.Protocol.Debugger.onResumed(() => InspectorTest.log('session1 is resumed'));
session2.Protocol.Debugger.onResumed(() => InspectorTest.log('session2 is resumed'));
InspectorTest.log('Activating debugger agent in 1');
await session1.Protocol.Debugger.enable();
InspectorTest.log('Disabling debugger agent in 2');
await session2.Protocol.Debugger.disable();
InspectorTest.log('Disabling debugger agent in 1');
await session1.Protocol.Debugger.disable();
InspectorTest.completeTest();
function waitForBothPaused() {
return Promise.all([waitForPaused(session1, 1), waitForPaused(session2, 2)]);
}
function waitForBothResumed() {
return Promise.all([waitForResumed(session1, 1), waitForResumed(session2, 2)]);
}
})();
function waitForPaused(session, num) {
return session.Protocol.Debugger.oncePaused().then(message => {
InspectorTest.log(`Paused in ${num}:`);
InspectorTest.log(` reason: ${message.params.reason}`);
InspectorTest.log(` hit breakpoints: ${(message.params.hitBreakpoints || []).join(';')}`);
var callFrame = message.params.callFrames[0];
InspectorTest.log(` location: ${callFrame.functionName || '<anonymous>'}@${callFrame.location.lineNumber}`);
InspectorTest.log(` data: ${JSON.stringify(message.params.data || null)}`);
});
}
function waitForResumed(session, num) {
return session.Protocol.Debugger.onceResumed().then(message => {
InspectorTest.log(`Resumed in ${num}`);
});
}

View File

@ -0,0 +1,24 @@
Tests that multiple sessions pause once on console.assert.
Pausing on exceptions in 1
Asserting in 1
Paused in 1 with reason assert
Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert
Paused in 2 with reason assert
Pausing on exceptions in both
Asserting in 1
Paused in 1 with reason assert
Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert
Paused in 2 with reason assert
Not pausing on exceptions
Asserting in 1
Asserting in 2
Pausing on exceptions in 3 (different context group)
Asserting in 3
Paused in 3 with reason assert
Asserting in 1
Paused in 1 with reason assert
Paused in 2 with reason assert

View File

@ -0,0 +1,54 @@
// 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('Tests that multiple sessions pause once on console.assert.');
(async function test() {
var contextGroup1 = new InspectorTest.ContextGroup();
var session1 = await connect(contextGroup1, 1);
var session2 = await connect(contextGroup1, 2);
var contextGroup2 = new InspectorTest.ContextGroup();
var session3 = await connect(contextGroup2, 3);
InspectorTest.log('Pausing on exceptions in 1');
await session1.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
InspectorTest.log('Asserting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Asserting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Pausing on exceptions in both');
await session2.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
InspectorTest.log('Asserting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Asserting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Not pausing on exceptions');
await session1.Protocol.Debugger.setPauseOnExceptions({state: 'none'});
await session2.Protocol.Debugger.setPauseOnExceptions({state: 'none'});
InspectorTest.log('Asserting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Asserting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Pausing on exceptions in 3 (different context group)');
await session3.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
InspectorTest.log('Asserting in 3');
await session3.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.log('Asserting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
InspectorTest.completeTest();
})();
async function connect(contextGroup, num) {
var session = contextGroup.connect();
await session.Protocol.Debugger.enable();
session.Protocol.Debugger.onPaused(message => {
InspectorTest.log(`Paused in ${num} with reason ${message.params.reason}`);
session.Protocol.Debugger.resume();
});
return session;
}

View File

@ -0,0 +1,218 @@
Tests that multiple sessions do not share command line api.
Setting $0 in 1
Evaluating $0 in 1
{
id : <messageId>
result : {
result : {
description : 42
type : number
value : 42
}
}
}
Evaluating $0 in 2
{
id : <messageId>
result : {
result : {
type : undefined
}
}
}
Setting $0 in 2
Evaluating $0 in 1
{
id : <messageId>
result : {
result : {
description : 42
type : number
value : 42
}
}
}
Evaluating $0 in 2
{
id : <messageId>
result : {
result : {
description : 17
type : number
value : 17
}
}
}
Setting $_ in 1
Evaluating $_ in 1
{
id : <messageId>
result : {
result : {
description : 42
type : number
value : 42
}
}
}
Evaluating $_ in 2
{
id : <messageId>
result : {
result : {
type : undefined
}
}
}
Setting $_ in 2
Evaluating $_ in 1
{
id : <messageId>
result : {
result : {
description : 42
type : number
value : 42
}
}
}
Evaluating $_ in 2
{
id : <messageId>
result : {
result : {
description : 17
type : number
value : 17
}
}
}
Inspecting in 1
inspectRequested from 1
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 42
type : number
value : 42
}
}
}
Inspecting in 1 through variable
inspectRequested from 1
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 42
type : number
value : 42
}
}
}
Inspecting in 2
inspectRequested from 2
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 17
type : number
value : 17
}
}
}
Inspecting in 2 through variable
inspectRequested from 2
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 17
type : number
value : 17
}
}
}
Inspecting in 2 through variable from 1
inspectRequested from 1
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 42
type : number
value : 42
}
}
}
Disconnecting 1
Evaluating $0 in 2
{
id : <messageId>
result : {
result : {
description : 17
type : number
value : 17
}
}
}
Evaluating $_ in 2
{
id : <messageId>
result : {
result : {
description : 17
type : number
value : 17
}
}
}
Inspecting in 2
inspectRequested from 2
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 17
type : number
value : 17
}
}
}
Inspecting in 2 through variable from 1
Inspecting in 2 through variable
inspectRequested from 2
{
method : Runtime.inspectRequested
params : {
executionContextId : <executionContextId>
hints : {
}
object : {
description : 17
type : number
value : 17
}
}
}

View File

@ -0,0 +1,76 @@
// 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('Tests that multiple sessions do not share command line api.');
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
var session1 = contextGroup.connect();
await session1.Protocol.Runtime.enable();
session1.Protocol.Runtime.onInspectRequested(message => {
InspectorTest.log('inspectRequested from 1');
InspectorTest.logMessage(message);
});
var session2 = contextGroup.connect();
await session2.Protocol.Runtime.enable();
session2.Protocol.Runtime.onInspectRequested(message => {
InspectorTest.log('inspectRequested from 2');
InspectorTest.logMessage(message);
});
InspectorTest.log('Setting $0 in 1');
await session1.addInspectedObject(42);
InspectorTest.log('Evaluating $0 in 1');
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
InspectorTest.log('Evaluating $0 in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
InspectorTest.log('Setting $0 in 2');
await session2.addInspectedObject(17);
InspectorTest.log('Evaluating $0 in 1');
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
InspectorTest.log('Evaluating $0 in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
InspectorTest.log('Setting $_ in 1');
await session1.Protocol.Runtime.evaluate({expression: '42', objectGroup: 'console', includeCommandLineAPI: true});
InspectorTest.log('Evaluating $_ in 1');
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
InspectorTest.log('Evaluating $_ in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
InspectorTest.log('Setting $_ in 2');
await session2.Protocol.Runtime.evaluate({expression: '17', objectGroup: 'console', includeCommandLineAPI: true});
InspectorTest.log('Evaluating $_ in 1');
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
InspectorTest.log('Evaluating $_ in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
InspectorTest.log('Inspecting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'var inspect1=inspect; inspect(42)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 1 through variable');
await session1.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'var inspect2=inspect; inspect(17)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 2 through variable');
await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 2 through variable from 1');
await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
InspectorTest.log('Disconnecting 1');
session1.disconnect();
InspectorTest.log('Evaluating $0 in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
InspectorTest.log('Evaluating $_ in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
InspectorTest.log('Inspecting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'inspect(17)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 2 through variable from 1');
await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
InspectorTest.log('Inspecting in 2 through variable');
await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeCommandLineAPI: true});
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,217 @@
Tests that all sessions get console api notifications.
Error in 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 1
type : number
value : 1
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : error
}
}
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 1
type : number
value : 1
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : error
}
}
Logging in 1
From session 1
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 2
type : number
value : 2
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
description : 2
type : number
value : 2
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}
Error in setTimeout 1
From session 1
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : a
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : error
}
}
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : a
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : error
}
}
Logging in setTimeout 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : b
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : b
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}

View File

@ -0,0 +1,38 @@
// 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('Tests that all sessions get console api notifications.');
function connect(contextGroup, num) {
var session = contextGroup.connect();
session.Protocol.Runtime.onConsoleAPICalled(message => {
InspectorTest.log('From session ' + num);
InspectorTest.logMessage(message);
});
return session;
}
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
var session1 = connect(contextGroup, 1);
var session2 = connect(contextGroup, 2);
await session1.Protocol.Runtime.enable();
await session2.Protocol.Runtime.enable();
InspectorTest.log('Error in 2');
await session2.Protocol.Runtime.evaluate({expression: 'console.error(1)'});
InspectorTest.log('Logging in 1');
await session1.Protocol.Runtime.evaluate({expression: 'console.log(2)'});
InspectorTest.log('Error in setTimeout 1');
await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.error("a"), 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Logging in setTimeout 2');
await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.log("b"), 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,277 @@
Tests that all sessions get exception notifications.
Throwing in 2
Throwing in 1
Throwing in setTimeout 1
From session 1
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 19
exception : {
type : string
value : error3
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 19
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error3
}
timestamp : <timestamp>
}
}
From session 2
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 19
exception : {
type : string
value : error3
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 19
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error3
}
timestamp : <timestamp>
}
}
Throwing in setTimeout 2
From session 1
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 19
exception : {
type : string
value : error4
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 19
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error4
}
timestamp : <timestamp>
}
}
From session 2
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 19
exception : {
type : string
value : error4
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 19
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error4
}
timestamp : <timestamp>
}
}
Rejecting in 2
From session 1
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 40
exception : {
type : string
value : error5
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 40
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error5
}
timestamp : <timestamp>
}
}
From session 2
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 40
exception : {
type : string
value : error5
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 40
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error5
}
timestamp : <timestamp>
}
}
Revoking in 2
From session 1
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
Rejecting in 1
From session 1
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 40
exception : {
type : string
value : error6
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 40
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error6
}
timestamp : <timestamp>
}
}
From session 2
{
method : Runtime.exceptionThrown
params : {
exceptionDetails : {
columnNumber : 40
exception : {
type : string
value : error6
}
exceptionId : <exceptionId>
executionContextId : <executionContextId>
lineNumber : 0
stackTrace : {
callFrames : [
[0] : {
columnNumber : 40
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
text : Uncaught error6
}
timestamp : <timestamp>
}
}
Revoking in 1
From session 1
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true

View File

@ -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.
InspectorTest.log('Tests that all sessions get exception notifications.');
function connect(contextGroup, num) {
var session = contextGroup.connect();
var exceptionId;
session.Protocol.Runtime.onExceptionThrown(message => {
InspectorTest.log('From session ' + num);
InspectorTest.logMessage(message);
exceptionId = message.params.exceptionDetails.exceptionId;
});
session.Protocol.Runtime.onExceptionRevoked(message => {
InspectorTest.log('From session ' + num);
InspectorTest.logMessage(message);
InspectorTest.log('id matching: ' + (message.params.exceptionId === exceptionId));
});
return session;
}
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
var session1 = connect(contextGroup, 1);
var session2 = connect(contextGroup, 2);
await session1.Protocol.Runtime.enable();
await session2.Protocol.Runtime.enable();
InspectorTest.log('Throwing in 2');
await session2.Protocol.Runtime.evaluate({expression: 'throw "error1";'});
InspectorTest.log('Throwing in 1');
await session1.Protocol.Runtime.evaluate({expression: 'throw "error2";'});
InspectorTest.log('Throwing in setTimeout 1');
await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error3"; }, 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Throwing in setTimeout 2');
await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error4"; }, 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Rejecting in 2');
await session2.Protocol.Runtime.evaluate({expression: 'var p2; setTimeout(() => { p2 = Promise.reject("error5") }, 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Revoking in 2');
await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p2.catch(()=>{}) }, 0);'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Rejecting in 1');
await session1.Protocol.Runtime.evaluate({expression: 'var p1; setTimeout(() => { p1 = Promise.reject("error6")} , 0)'});
await InspectorTest.waitForPendingTasks();
InspectorTest.log('Revoking in 1');
await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p1.catch(()=>{}) }, 0);'});
await InspectorTest.waitForPendingTasks();
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,25 @@
Tests that multiple sessions share the context.
Assigning in 1
Evaluating in 2
{
id : <messageId>
result : {
result : {
description : 42
type : number
value : 42
}
}
}
Awaiting in 1
Resolving in 2
Should resolve in 1
{
id : <messageId>
result : {
result : {
type : string
value : foo
}
}
}

View File

@ -0,0 +1,25 @@
// 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('Tests that multiple sessions share the context.');
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
var session1 = contextGroup.connect();
var session2 = contextGroup.connect();
InspectorTest.log('Assigning in 1');
await session1.Protocol.Runtime.evaluate({expression: 'var a = 42;'});
InspectorTest.log('Evaluating in 2');
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: 'a'}));
InspectorTest.log('Awaiting in 1');
var promise = session1.Protocol.Runtime.evaluate({expression: 'var cb; new Promise(f => cb = f)', awaitPromise: true});
InspectorTest.log('Resolving in 2');
await session2.Protocol.Runtime.evaluate({expression: 'cb("foo")'});
InspectorTest.log('Should resolve in 1');
InspectorTest.logMessage(await promise);
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,97 @@
Tests that multiple sessions do not interfere with each other's remote objects.
Evaluating in 1
Evaluating in 2
Retrieving properties in 2
{
id : <messageId>
result : {
internalProperties : [
[0] : {
name : [[Prototype]]
value : {
className : Object
description : Object
objectId : <objectId>
type : object
}
}
]
result : [
[0] : {
configurable : true
enumerable : true
isOwn : true
name : a
value : {
description : 17
type : number
value : 17
}
writable : true
}
]
}
}
Retrieving properties in 1
{
id : <messageId>
result : {
internalProperties : [
[0] : {
name : [[Prototype]]
value : {
className : Object
description : Object
objectId : <objectId>
type : object
}
}
]
result : [
[0] : {
configurable : true
enumerable : true
isOwn : true
name : a
value : {
description : 42
type : number
value : 42
}
writable : true
}
]
}
}
Disconnecting 2
Retrieving properties in 1
{
id : <messageId>
result : {
internalProperties : [
[0] : {
name : [[Prototype]]
value : {
className : Object
description : Object
objectId : <objectId>
type : object
}
}
]
result : [
[0] : {
configurable : true
enumerable : true
isOwn : true
name : a
value : {
description : 42
type : number
value : 42
}
writable : true
}
]
}
}

View File

@ -0,0 +1,30 @@
// 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('Tests that multiple sessions do not interfere with each other\'s remote objects.');
(async function test() {
var contextGroup = new InspectorTest.ContextGroup();
var session1 = contextGroup.connect();
var session2 = contextGroup.connect();
InspectorTest.log('Evaluating in 1');
var result1 = await session1.Protocol.Runtime.evaluate({expression: '({a: 42})'});
InspectorTest.log('Evaluating in 2');
var result2 = await session2.Protocol.Runtime.evaluate({expression: '({a: 17})'});
await print(2, session2, result2);
await print(1, session1, result1);
InspectorTest.log('Disconnecting 2');
session2.disconnect();
await print(1, session1, result1);
InspectorTest.completeTest();
})();
async function print(num, session, message) {
InspectorTest.log('Retrieving properties in ' + num);
var objectId = message.result.result.objectId;
InspectorTest.logMessage(await session.Protocol.Runtime.getProperties({objectId, ownProperties: true}));
}