diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2023-03-30 12:11:08 +0200 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2023-03-31 14:15:23 +0000 |
commit | f226350fcbebd4449fb0034fdaffa147e4de28ea (patch) | |
tree | 8896397ec8829c238012bfbe9781f4e2d94708bc /deps/v8/test/inspector/runtime | |
parent | 10928cb0a4643a11c02af7bab93fc4b5abe2ce7d (diff) | |
download | node-new-f226350fcbebd4449fb0034fdaffa147e4de28ea.tar.gz |
deps: update V8 to 11.3.244.4
PR-URL: https://github.com/nodejs/node/pull/47251
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Diffstat (limited to 'deps/v8/test/inspector/runtime')
24 files changed, 1026 insertions, 21 deletions
diff --git a/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt b/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt index f98fc43bf9..e05a203c7d 100644 --- a/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt +++ b/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt @@ -208,11 +208,50 @@ Running test: testEvaluateOnExecutionContext } } +Running test: testEvaluateOnUniqueExecutionContext +{ + id : <messageId> + result : { + result : { + description : 70 + type : number + value : 70 + } + } +} + Running test: testPassingBothObjectIdAndExecutionContextId { error : { - code : -32000 - message : ObjectId must not be specified together with executionContextId + code : -32602 + message : ObjectId, executionContextId and uniqueContextId must mutually exclude each other + } + id : <messageId> +} + +Running test: testPassingBothObjectIdAndExecutionContextUniqueId +{ + error : { + code : -32602 + message : ObjectId, executionContextId and uniqueContextId must mutually exclude each other + } + id : <messageId> +} + +Running test: testPassingTwoExecutionContextIds +{ + error : { + code : -32602 + message : ObjectId, executionContextId and uniqueContextId must mutually exclude each other + } + id : <messageId> +} + +Running test: testPassingNeitherContextIdNorObjectId +{ + error : { + code : -32602 + message : Either objectId or executionContextId or uniqueContextId must be specified } id : <messageId> } diff --git a/deps/v8/test/inspector/runtime/call-function-on-async.js b/deps/v8/test/inspector/runtime/call-function-on-async.js index 70f823c52c..18c60a288c 100644 --- a/deps/v8/test/inspector/runtime/call-function-on-async.js +++ b/deps/v8/test/inspector/runtime/call-function-on-async.js @@ -8,10 +8,12 @@ let callFunctionOn = Protocol.Runtime.callFunctionOn.bind(Protocol.Runtime); let remoteObject1; let remoteObject2; let executionContextId; +let executionContextUniqueId; Protocol.Runtime.enable(); Protocol.Runtime.onExecutionContextCreated(messageObject => { executionContextId = messageObject.params.context.id; + executionContextUniqueId = messageObject.params.context.uniqueId; InspectorTest.runAsyncTestSuite(testSuite); }); @@ -135,15 +137,52 @@ let testSuite = [ })); }, + async function testEvaluateOnUniqueExecutionContext() { + InspectorTest.logMessage(await callFunctionOn({ + uniqueContextId: executionContextUniqueId, + functionDeclaration: '(function(arg) { return this.globalObjectProperty + arg; })', + arguments: prepareArguments([ 28 ]), + returnByValue: true, + generatePreview: false, + awaitPromise: false + })); + }, + async function testPassingBothObjectIdAndExecutionContextId() { InspectorTest.logMessage(await callFunctionOn({ executionContextId, objectId: remoteObject1.objectId, functionDeclaration: '(function() { return 42; })', arguments: prepareArguments([]), - returnByValue: true, - generatePreview: false, - awaitPromise: false + returnByValue: true + })); + }, + + async function testPassingBothObjectIdAndExecutionContextUniqueId() { + InspectorTest.logMessage(await callFunctionOn({ + uniqueContextId: executionContextUniqueId, + objectId: remoteObject1.objectId, + functionDeclaration: '(function() { return 42; })', + arguments: prepareArguments([]), + returnByValue: true + })); + }, + + async function testPassingTwoExecutionContextIds() { + InspectorTest.logMessage(await callFunctionOn({ + executionContextId, + uniqueContextId: executionContextUniqueId, + functionDeclaration: '(function() { return 42; })', + arguments: prepareArguments([]), + returnByValue: true + })); + }, + + async function testPassingNeitherContextIdNorObjectId() { + InspectorTest.logMessage(await callFunctionOn({ + functionDeclaration: '(function() { return 42; })', + arguments: prepareArguments([]), + returnByValue: true })); }, diff --git a/deps/v8/test/inspector/runtime/console-spec-expected.txt b/deps/v8/test/inspector/runtime/console-spec-expected.txt index 48cbc70fe2..a7146d5370 100644 --- a/deps/v8/test/inspector/runtime/console-spec-expected.txt +++ b/deps/v8/test/inspector/runtime/console-spec-expected.txt @@ -18,7 +18,7 @@ Running test: prototypeChainMustBeCorrect true Running test: consoleToString -[object Object] +[object console] Running test: consoleMethodPropertyDescriptor { diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt index 9a5e1708c1..381cf88c2e 100644 --- a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt +++ b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt @@ -3,5 +3,6 @@ Tests that contextDesrtoyed nofitication is fired when context is collected. method : Runtime.executionContextDestroyed params : { executionContextId : <executionContextId> + executionContextUniqueId : <executionContextUniqueId> } } diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict-expected.txt b/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict-expected.txt new file mode 100644 index 0000000000..5b92d1c6b4 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict-expected.txt @@ -0,0 +1,55 @@ +Evaluate conflicting private class member out of class scope in Runtime.evaluate() + +class Klass { + #name = "string"; +} +class ClassWithField extends Klass { + #name = "child"; +} +class ClassWithMethod extends Klass { + #name() {} +} +class ClassWithAccessor extends Klass { + get #name() {} + set #name(val) {} +} +class StaticClass extends Klass { + static #name = "child"; +} + + +Running test: evaluatePrivateMembers +Runtime.evaluate: `(new ClassWithField).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at <anonymous>:1:2 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `(new ClassWithMethod).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at <anonymous>:1:2 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `(new ClassWithAccessor).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at <anonymous>:1:2 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `StaticClass.#name` +{ + type : string + value : child +} +Runtime.evaluate: `(new StaticClass).#name` +{ + type : string + value : string +} diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict.js b/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict.js new file mode 100644 index 0000000000..95cc6237c0 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member-conflict.js @@ -0,0 +1,12 @@ +// Copyright 2022 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. + +utils.load('test/inspector/private-class-member-inspector-test.js'); + +const options = { + type: 'private-conflicting-member', + testRuntime: true, + message: `Evaluate conflicting private class member out of class scope in Runtime.evaluate()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member-expected.txt b/deps/v8/test/inspector/runtime/evaluate-private-class-member-expected.txt new file mode 100644 index 0000000000..9a81f57cf7 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member-expected.txt @@ -0,0 +1,231 @@ +Evaluate private class member out of class scope in Runtime.evaluate() + +class Klass { + #field = "string"; + get #getterOnly() { return "getterOnly"; } + set #setterOnly(val) { this.#field = "setterOnlyCalled"; } + get #accessor() { return this.#field } + set #accessor(val) { this.#field = val; } + #method() { return "method"; } +} +const obj = new Klass(); + + +Running test: evaluatePrivateMembers +Checking private fields +Runtime.evaluate: `obj.#field` +{ + type : string + value : string +} +Runtime.evaluate: `obj.#field = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#field` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#field++` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#field` +{ + description : 2 + type : number + value : 2 +} +Runtime.evaluate: `++obj.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `obj.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `obj.#field -= 3` +{ + description : 0 + type : number + value : 0 +} +Runtime.evaluate: `obj.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private getter-only accessors +Runtime.evaluate: `obj.#getterOnly` +{ + type : string + value : getterOnly +} +Runtime.evaluate: `obj.#getterOnly = 1` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:17 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#getterOnly++` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:16 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#getterOnly -= 3` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:17 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#getterOnly` +{ + type : string + value : getterOnly +} +Checking private setter-only accessors +Runtime.evaluate: `obj.#setterOnly` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#setterOnly = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#setterOnly++` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#setterOnly -= 3` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#field` +{ + type : string + value : setterOnlyCalled +} +Checking private accessors +Runtime.evaluate: `obj.#accessor` +{ + type : string + value : setterOnlyCalled +} +Runtime.evaluate: `obj.#accessor = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#field` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#accessor++` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `obj.#field` +{ + description : 2 + type : number + value : 2 +} +Runtime.evaluate: `++obj.#accessor` +{ + type : undefined +} +Runtime.evaluate: `obj.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `obj.#accessor -= 3` +{ + description : 0 + type : number + value : 0 +} +Runtime.evaluate: `obj.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private methods +Runtime.evaluate: `obj.#method` +{ + className : Function + description : #method() { return "method"; } + objectId : <objectId> + type : function +} +Runtime.evaluate: `obj.#method = 1` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:13 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#method++` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:12 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `++obj.#method` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:7 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `obj.#method -= 3` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:13 + objectId : <objectId> + subtype : error + type : object +} diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member-static-expected.txt b/deps/v8/test/inspector/runtime/evaluate-private-class-member-static-expected.txt new file mode 100644 index 0000000000..d52f4960fd --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member-static-expected.txt @@ -0,0 +1,231 @@ +Evaluate static private class member out of class scope in Runtime.evaluate() + +class Klass { + static #field = "string"; + static get #getterOnly() { return "getterOnly"; } + static set #setterOnly(val) { this.#field = "setterOnlyCalled"; } + static get #accessor() { return this.#field } + static set #accessor(val) { this.#field = val; } + static #method() { return "method"; } +} +const obj = new Klass(); + + +Running test: evaluatePrivateMembers +Checking private fields +Runtime.evaluate: `Klass.#field` +{ + type : string + value : string +} +Runtime.evaluate: `Klass.#field = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#field` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#field++` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#field` +{ + description : 2 + type : number + value : 2 +} +Runtime.evaluate: `++Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `Klass.#field -= 3` +{ + description : 0 + type : number + value : 0 +} +Runtime.evaluate: `Klass.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private getter-only accessors +Runtime.evaluate: `Klass.#getterOnly` +{ + type : string + value : getterOnly +} +Runtime.evaluate: `Klass.#getterOnly = 1` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:19 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#getterOnly++` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:18 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#getterOnly -= 3` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at <anonymous>:1:19 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#getterOnly` +{ + type : string + value : getterOnly +} +Checking private setter-only accessors +Runtime.evaluate: `Klass.#setterOnly` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#setterOnly = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#setterOnly++` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#setterOnly -= 3` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at <anonymous>:1:1 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#field` +{ + type : string + value : setterOnlyCalled +} +Checking private accessors +Runtime.evaluate: `Klass.#accessor` +{ + type : string + value : setterOnlyCalled +} +Runtime.evaluate: `Klass.#accessor = 1` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#field` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#accessor++` +{ + description : 1 + type : number + value : 1 +} +Runtime.evaluate: `Klass.#field` +{ + description : 2 + type : number + value : 2 +} +Runtime.evaluate: `++Klass.#accessor` +{ + type : undefined +} +Runtime.evaluate: `Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Runtime.evaluate: `Klass.#accessor -= 3` +{ + description : 0 + type : number + value : 0 +} +Runtime.evaluate: `Klass.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private methods +Runtime.evaluate: `Klass.#method` +{ + className : Function + description : #method() { return "method"; } + objectId : <objectId> + type : function +} +Runtime.evaluate: `Klass.#method = 1` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:15 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#method++` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:14 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `++Klass.#method` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:9 + objectId : <objectId> + subtype : error + type : object +} +Runtime.evaluate: `Klass.#method -= 3` +{ + className : Error + description : Error: Private method '#method' is not writable at <anonymous>:1:15 + objectId : <objectId> + subtype : error + type : object +} diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member-static.js b/deps/v8/test/inspector/runtime/evaluate-private-class-member-static.js new file mode 100644 index 0000000000..1a8b5ed141 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member-static.js @@ -0,0 +1,12 @@ +// Copyright 2022 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. + +utils.load('test/inspector/private-class-member-inspector-test.js'); + +const options = { + type: 'private-static-member', + testRuntime: true, + message: `Evaluate static private class member out of class scope in Runtime.evaluate()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/runtime/evaluate-private-class-member.js b/deps/v8/test/inspector/runtime/evaluate-private-class-member.js new file mode 100644 index 0000000000..dd22e790fb --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-private-class-member.js @@ -0,0 +1,12 @@ +// Copyright 2022 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. + +utils.load('test/inspector/private-class-member-inspector-test.js'); + +const options = { + type: 'private-instance-member', + testRuntime: true, + message: `Evaluate private class member out of class scope in Runtime.evaluate()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions-expected.txt b/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions-expected.txt new file mode 100644 index 0000000000..50fffb0575 --- /dev/null +++ b/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions-expected.txt @@ -0,0 +1,24 @@ +Check that throwing breakpoint conditions report exceptions via Runtime.exceptionThrown. + +Running test: setUp + +Running test: testSyntaxError +Exception thrown: SyntaxError: Unexpected end of input + at smallFnWithLogpoint (test.js:3:17) + at <anonymous>:1:1 + +Running test: testRepeatedErrorsOnlyCauseOneEvent +Exception thrown: SyntaxError: Unexpected end of input + at smallFnWithLogpoint (test.js:3:17) + at <anonymous>:1:29 + +Running test: testSporadicThrowing +Exception thrown: ReferenceError: y is not defined + at eval (eval at smallFnWithLogpoint (test.js:3:17), <anonymous>:1:1) + at smallFnWithLogpoint (test.js:3:17) + at <anonymous>:1:1 +Paused on conditional logpoint +Exception thrown: ReferenceError: y is not defined + at eval (eval at smallFnWithLogpoint (test.js:3:17), <anonymous>:1:1) + at smallFnWithLogpoint (test.js:3:17) + at <anonymous>:1:22 diff --git a/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions.js b/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions.js new file mode 100644 index 0000000000..e569eea8a0 --- /dev/null +++ b/deps/v8/test/inspector/runtime/exception-thrown-breakpoint-conditions.js @@ -0,0 +1,71 @@ +// Copyright 2023 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. + +const { session, contextGroup, Protocol } = InspectorTest.start("Check that throwing breakpoint conditions report exceptions via Runtime.exceptionThrown."); + +contextGroup.addScript(` +function smallFnWithLogpoint(x) { + return x + 42; +} +`, 0, 0, 'test.js'); + +Protocol.Runtime.onExceptionThrown(({ params: { exceptionDetails } }) => { + const { description } = exceptionDetails.exception; + InspectorTest.log(`Exception thrown: ${description}`); +}); + +async function testSyntaxError() { + const { result: { breakpointId } } = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber: 3, + url: 'test.js', + condition: 'x ===', + }); + await Protocol.Runtime.evaluate({ expression: 'smallFnWithLogpoint(5)' }); + await Protocol.Debugger.removeBreakpoint({ breakpointId }); +} + +async function testRepeatedErrorsOnlyCauseOneEvent() { + const { result: { breakpointId } } = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber: 3, + url: 'test.js', + condition: 'x ===', + }); + await Protocol.Runtime.evaluate({ + expression: 'for (let i = 0; i < 5; ++i) smallFnWithLogpoint(5);' }); + await Protocol.Debugger.removeBreakpoint({ breakpointId }); +} + +async function testSporadicThrowing() { + // Tests that a breakpoint condition going from throwing -> succeeding -> throwing + // logs two events. + const { result: { breakpointId } } = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber: 3, + url: 'test.js', + condition: 'y === 42', + }); + // Causes a reference error as `y` is not defined. + await Protocol.Runtime.evaluate({ expression: 'smallFnWithLogpoint(5)' }); + + // Introduce y and trigger breakpoint again. + const evalPromise = Protocol.Runtime.evaluate({ expression: 'globalThis.y = 42; smallFnWithLogpoint(5)' }); + await Protocol.Debugger.oncePaused(); + InspectorTest.log('Paused on conditional logpoint'); + await Promise.all([Protocol.Debugger.resume(), evalPromise]); + + // Delete 'y' again, trigger breakpoint and expect an exception event. + await Protocol.Runtime.evaluate({ expression: 'delete globalThis.y; smallFnWithLogpoint(5)' }); + + await Protocol.Debugger.removeBreakpoint({ breakpointId }); +} + +InspectorTest.runAsyncTestSuite([ + async function setUp() { + Protocol.Debugger.enable(); + Protocol.Runtime.enable(); + await Protocol.Debugger.onceScriptParsed(); + }, + testSyntaxError, + testRepeatedErrorsOnlyCauseOneEvent, + testSporadicThrowing, +]); diff --git a/deps/v8/test/inspector/runtime/function-scopes.js b/deps/v8/test/inspector/runtime/function-scopes.js index c382ccda47..bda069bd9a 100644 --- a/deps/v8/test/inspector/runtime/function-scopes.js +++ b/deps/v8/test/inspector/runtime/function-scopes.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --no-experimental-remove-internal-scopes-property - let {session, contextGroup, Protocol} = InspectorTest.start('Checks [[Scopes]] for functions'); contextGroup.addScript(` diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt index 2e32e48116..a200aab34f 100644 --- a/deps/v8/test/inspector/runtime/get-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -111,6 +111,9 @@ Running test: testArrayBuffer Symbol(Symbol.toStringTag) own string ArrayBuffer byteLength own no value, getter constructor own function undefined + maxByteLength own no value, getter + resizable own no value, getter + resize own function undefined slice own function undefined Internal properties [[Prototype]] object undefined @@ -156,6 +159,9 @@ Running test: testArrayBufferFromWebAssemblyMemory Symbol(Symbol.toStringTag) own string ArrayBuffer byteLength own no value, getter constructor own function undefined + maxByteLength own no value, getter + resizable own no value, getter + resize own function undefined slice own function undefined Internal properties [[Prototype]] object undefined diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt index a0437f4af6..dbb506dcd3 100644 --- a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt @@ -5,10 +5,10 @@ Testing regular Proxy result : { result : { className : Object - description : Proxy + description : Proxy(Object) objectId : <objectId> preview : { - description : Proxy + description : Proxy(Object) overflow : false properties : [ [0] : { @@ -65,10 +65,10 @@ Testing revocable Proxy result : { result : { className : Object - description : Proxy + description : Proxy(Object) objectId : <objectId> preview : { - description : Proxy + description : Proxy(Object) overflow : false properties : [ [0] : { diff --git a/deps/v8/test/inspector/runtime/internal-properties-prototype-chain-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-prototype-chain-expected.txt new file mode 100644 index 0000000000..17a026ef61 --- /dev/null +++ b/deps/v8/test/inspector/runtime/internal-properties-prototype-chain-expected.txt @@ -0,0 +1,61 @@ +Checks that only one of JSGlobalObject/JSGlobalProxy shows up in the prototype chain +Prototype chain for "globalThis": +{ + className : global + description : global + objectId : <objectId> + type : object +} +{ + name : [[Prototype]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } +} +{ + name : [[Prototype]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } +} + +Prototype chain for "var weird = {}; weird.__proto__ = globalThis; weird;": +{ + className : Object + description : Object + objectId : <objectId> + type : object +} +{ + name : [[Prototype]] + value : { + className : global + description : global + objectId : <objectId> + type : object + } +} +{ + name : [[Prototype]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } +} +{ + name : [[Prototype]] + value : { + className : Object + description : Object + objectId : <objectId> + type : object + } +} diff --git a/deps/v8/test/inspector/runtime/internal-properties-prototype-chain.js b/deps/v8/test/inspector/runtime/internal-properties-prototype-chain.js new file mode 100644 index 0000000000..ce48727437 --- /dev/null +++ b/deps/v8/test/inspector/runtime/internal-properties-prototype-chain.js @@ -0,0 +1,39 @@ +// Copyright 2023 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. + +const {session, contextGroup, Protocol} = InspectorTest.start('Checks that only one of JSGlobalObject/JSGlobalProxy shows up in the prototype chain'); + +function findPrototypeObjectId(response) { + const { result: { internalProperties } } = response; + for (const prop of internalProperties || []) { + if (prop.name === '[[Prototype]]') { + return prop; + } + } +} + +async function logPrototypeChain(objectId) { + while (true) { + const response = await Protocol.Runtime.getProperties({ objectId }); + const prototype = findPrototypeObjectId(response); + if (!prototype) break; + + InspectorTest.logMessage(prototype); + objectId = prototype.value.objectId; + } +} + +(async () => { + InspectorTest.log('Prototype chain for "globalThis":'); + const { result: { result } } = await Protocol.Runtime.evaluate({ expression: 'globalThis' }); + InspectorTest.logMessage(result); + await logPrototypeChain(result.objectId); + + InspectorTest.log('\nPrototype chain for "var weird = {}; weird.__proto__ = globalThis; weird;":') + const { result: { result: result2 } } = await Protocol.Runtime.evaluate({ expression: 'var weird = {}; weird.__proto__ = globalThis; weird;' }); + InspectorTest.logMessage(result2); + await logPrototypeChain(result2.objectId); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/runtime/internal-properties.js b/deps/v8/test/inspector/runtime/internal-properties.js index 3e3ce4a197..b4b0bc47fb 100644 --- a/deps/v8/test/inspector/runtime/internal-properties.js +++ b/deps/v8/test/inspector/runtime/internal-properties.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --no-experimental-remove-internal-scopes-property - let {session, contextGroup, Protocol} = InspectorTest.start('Checks internal properties in Runtime.getProperties output'); contextGroup.addScript(` diff --git a/deps/v8/test/inspector/runtime/remote-object-expected.txt b/deps/v8/test/inspector/runtime/remote-object-expected.txt index 14f584831e..765f8e26ef 100644 --- a/deps/v8/test/inspector/runtime/remote-object-expected.txt +++ b/deps/v8/test/inspector/runtime/remote-object-expected.txt @@ -484,6 +484,16 @@ Running test: testRegExp type : object } } +'/w+/v', returnByValue: false, generatePreview: false +{ + result : { + className : RegExp + description : /w+/v + objectId : <objectId> + subtype : regexp + type : object + } +} '/w+/dgimsuy', returnByValue: false, generatePreview: false { result : { @@ -494,6 +504,16 @@ Running test: testRegExp type : object } } +'/w+/dgimsvy', returnByValue: false, generatePreview: false +{ + result : { + className : RegExp + description : /w+/dgimsvy + objectId : <objectId> + subtype : regexp + type : object + } +} 'new RegExp('\w+', 'g')', returnByValue: false, generatePreview: false { result : { @@ -526,6 +546,18 @@ Running test: testRegExp type : object } } +'var re = /./dgimsvy; + re.toString = () => 'foo'; + re', returnByValue: false, generatePreview: false +{ + result : { + className : RegExp + description : /./dgimsvy + objectId : <objectId> + subtype : regexp + type : object + } +} 'var re = new RegExp('\w+', 'g'); re.prop = 32; re', returnByValue: false, generatePreview: true @@ -1598,7 +1630,7 @@ Running test: testProxy { result : { className : Object - description : Proxy + description : Proxy(Object) objectId : <objectId> subtype : proxy type : object @@ -1608,7 +1640,7 @@ Running test: testProxy { result : { className : Object - description : Proxy + description : Proxy(Error) objectId : <objectId> subtype : proxy type : object @@ -1626,10 +1658,10 @@ Running test: testProxy { result : { className : Object - description : Proxy + description : Proxy(Object) objectId : <objectId> preview : { - description : Proxy + description : Proxy(Object) overflow : false properties : [ [0] : { @@ -1659,11 +1691,57 @@ Running test: testProxy name : e subtype : proxy type : object - value : Proxy + value : Proxy(Object) + } + ] + type : object + } + type : object + } +} +'new Proxy([1, 2], {})', returnByValue: false, generatePreview: true +{ + result : { + className : Object + description : Proxy(Array) + objectId : <objectId> + preview : { + description : Proxy(Array) + overflow : false + properties : [ + [0] : { + name : 0 + type : number + value : 1 } + [1] : { + name : 1 + type : number + value : 2 + } + ] + subtype : proxy + type : object + } + subtype : proxy + type : object + } +} +'revocable = Proxy.revocable({}, {}); revocable.revoke(); revocable.proxy', returnByValue: false, generatePreview: true +{ + result : { + className : Object + description : Proxy + objectId : <objectId> + preview : { + description : Proxy + overflow : false + properties : [ ] + subtype : proxy type : object } + subtype : proxy type : object } } @@ -2405,6 +2483,16 @@ Running test: testArrayBuffer type : number value : 0 } + [1] : { + name : maxByteLength + type : number + value : 0 + } + [2] : { + name : resizable + type : boolean + value : false + } ] subtype : arraybuffer type : object @@ -2428,6 +2516,16 @@ Running test: testArrayBuffer type : number value : 400 } + [1] : { + name : maxByteLength + type : number + value : 400 + } + [2] : { + name : resizable + type : boolean + value : false + } ] subtype : arraybuffer type : object diff --git a/deps/v8/test/inspector/runtime/remote-object.js b/deps/v8/test/inspector/runtime/remote-object.js index 9eb38f8a52..ed4e764e43 100644 --- a/deps/v8/test/inspector/runtime/remote-object.js +++ b/deps/v8/test/inspector/runtime/remote-object.js @@ -235,9 +235,15 @@ InspectorTest.runAsyncTestSuite([ expression: '/\w+/y' })).result); InspectorTest.logMessage((await evaluate({ + expression: '/\w+/v' + })).result); + InspectorTest.logMessage((await evaluate({ expression: '/\w+/dgimsuy' })).result); InspectorTest.logMessage((await evaluate({ + expression: '/\w+/dgimsvy' + })).result); + InspectorTest.logMessage((await evaluate({ expression: `new RegExp('\\w+', 'g')`, })).result); InspectorTest.logMessage((await evaluate({ @@ -249,6 +255,11 @@ InspectorTest.runAsyncTestSuite([ re` })).result); InspectorTest.logMessage((await evaluate({ + expression: `var re = /./dgimsvy; + re.toString = () => 'foo'; + re` + })).result); + InspectorTest.logMessage((await evaluate({ expression: `var re = new RegExp('\\w+', 'g'); re.prop = 32; re`, @@ -490,6 +501,14 @@ InspectorTest.runAsyncTestSuite([ expression: '({e: new Proxy({a: 1}, {b: 2})})', generatePreview: true })).result); + InspectorTest.logMessage((await evaluate({ + expression: 'new Proxy([1, 2], {})', + generatePreview: true + })).result); + InspectorTest.logMessage((await evaluate({ + expression: 'revocable = Proxy.revocable({}, {}); revocable.revoke(); revocable.proxy', + generatePreview: true + })).result); }, async function testPromise() { InspectorTest.logMessage((await evaluate({ diff --git a/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger-expected.txt b/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger-expected.txt new file mode 100644 index 0000000000..e90b003193 --- /dev/null +++ b/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger-expected.txt @@ -0,0 +1,12 @@ + +Running test: testTwoSessions +Tests Runtime.runIfWaitingForDebugger +session 1 resumed +session 2 resumed +execution resumed + +Running test: testSessionDisconnect +Tests Runtime.runIfWaitingForDebugger +session 1 resumed +session 2 disconnected +execution resumed diff --git a/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger.js b/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger.js new file mode 100644 index 0000000000..db3036e244 --- /dev/null +++ b/deps/v8/test/inspector/runtime/run-if-waiting-for-debugger.js @@ -0,0 +1,35 @@ +// Copyright 2022 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.runAsyncTestSuite([ + async function testTwoSessions() { + InspectorTest.log('Tests Runtime.runIfWaitingForDebugger'); + + const contextGroup = new InspectorTest.ContextGroup(); + const resumed = contextGroup.waitForDebugger().then(() => InspectorTest.log('execution resumed')); + + const session1 = contextGroup.connect(); + const session2 = contextGroup.connect(); + await session1.Protocol.Runtime.runIfWaitingForDebugger(); + InspectorTest.log('session 1 resumed'); + await session2.Protocol.Runtime.runIfWaitingForDebugger(); + InspectorTest.log('session 2 resumed'); + await resumed; + }, + + async function testSessionDisconnect() { + InspectorTest.log('Tests Runtime.runIfWaitingForDebugger'); + + const contextGroup = new InspectorTest.ContextGroup(); + const resumed = contextGroup.waitForDebugger().then(() => InspectorTest.log('execution resumed')); + + const session1 = contextGroup.connect(); + const session2 = contextGroup.connect(); + await session1.Protocol.Runtime.runIfWaitingForDebugger(); + InspectorTest.log('session 1 resumed'); + session2.disconnect(); + InspectorTest.log('session 2 disconnected'); + await resumed; + } +]); diff --git a/deps/v8/test/inspector/runtime/terminate-execution-expected.txt b/deps/v8/test/inspector/runtime/terminate-execution-expected.txt index 614dc6da1e..ccd85fad3b 100644 --- a/deps/v8/test/inspector/runtime/terminate-execution-expected.txt +++ b/deps/v8/test/inspector/runtime/terminate-execution-expected.txt @@ -70,4 +70,4 @@ Terminate execution with pending microtasks result : { } } - +Terminate execution does not crash on destroy diff --git a/deps/v8/test/inspector/runtime/terminate-execution.js b/deps/v8/test/inspector/runtime/terminate-execution.js index 8af28e4787..3fd6b60242 100644 --- a/deps/v8/test/inspector/runtime/terminate-execution.js +++ b/deps/v8/test/inspector/runtime/terminate-execution.js @@ -66,7 +66,19 @@ let {session, contextGroup, Protocol} = await paused2; Protocol.Runtime.terminateExecution().then(InspectorTest.logMessage); await Protocol.Debugger.resume(); - await Protocol.Runtime.disable(); + + InspectorTest.log('Terminate execution does not crash on destroy'); + Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({ + expression: ` + while(true) { + let p = new Promise(resolve => setTimeout(resolve, 0)); + await p; + }` + }); + Protocol.Runtime.terminateExecution(); + await Protocol.Debugger.disable(); + InspectorTest.completeTest(); })(); |