diff options
Diffstat (limited to 'deps/v8/test/inspector/debugger')
48 files changed, 2032 insertions, 316 deletions
diff --git a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt index a71c5d0ec5..6cdea4819c 100644 --- a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt +++ b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt @@ -49,14 +49,14 @@ Paused #2 - [1] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} Paused #3 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":14,"columnNumber":4} - - [1] {"functionName":"callDebugger","lineNumber":5,"columnNumber":6} - - [2] {"functionName":"redirectFun","lineNumber":8,"columnNumber":6} + - [1] {"functionName":"callDebugger","function_lineNumber":0,"function_columnNumber":105,"lineNumber":5,"columnNumber":6} + - [2] {"functionName":"redirectFun","function_lineNumber":0,"function_columnNumber":110,"lineNumber":8,"columnNumber":6} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":2} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} Paused #4 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":15,"columnNumber":2} - - [1] {"functionName":"callDebugger","lineNumber":5,"columnNumber":6} - - [2] {"functionName":"redirectFun","lineNumber":8,"columnNumber":6} + - [1] {"functionName":"callDebugger","function_lineNumber":0,"function_columnNumber":105,"lineNumber":5,"columnNumber":6} + - [2] {"functionName":"redirectFun","function_lineNumber":0,"function_columnNumber":110,"lineNumber":8,"columnNumber":6} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":2} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} diff --git a/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec-expected.txt b/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec-expected.txt index ac4cfa1485..4f4b101a54 100644 --- a/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec-expected.txt +++ b/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec-expected.txt @@ -9,8 +9,8 @@ Running test: runTestFunction Script nr 2 parsed! Paused #1 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":14,"columnNumber":4} - - [1] {"functionName":"callDebugger","lineNumber":5,"columnNumber":6} - - [2] {"functionName":"redirectFun","lineNumber":8,"columnNumber":6} + - [1] {"functionName":"callDebugger","function_lineNumber":0,"function_columnNumber":105,"lineNumber":5,"columnNumber":6} + - [2] {"functionName":"redirectFun","function_lineNumber":0,"function_columnNumber":110,"lineNumber":8,"columnNumber":6} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":2} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} First time paused, setting breakpoints! @@ -63,8 +63,8 @@ Script nr 3 parsed! Resuming... Paused #2 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":15,"columnNumber":2} - - [1] {"functionName":"callDebugger","lineNumber":5,"columnNumber":6} - - [2] {"functionName":"redirectFun","lineNumber":8,"columnNumber":6} + - [1] {"functionName":"callDebugger","function_lineNumber":0,"function_columnNumber":105,"lineNumber":5,"columnNumber":6} + - [2] {"functionName":"redirectFun","function_lineNumber":0,"function_columnNumber":110,"lineNumber":8,"columnNumber":6} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":2} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} Script nr 4 parsed! diff --git a/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt b/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt index e028f2a595..df92b1516a 100644 --- a/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt @@ -2,8 +2,8 @@ Tests that asm-js scripts produce correct stack Paused on 'debugger;' Number of frames: 5 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":14,"columnNumber":4} - - [1] {"functionName":"callDebugger","lineNumber":5,"columnNumber":6} - - [2] {"functionName":"redirectFun","lineNumber":8,"columnNumber":6} + - [1] {"functionName":"callDebugger","function_lineNumber":0,"function_columnNumber":105,"lineNumber":5,"columnNumber":6} + - [2] {"functionName":"redirectFun","function_lineNumber":0,"function_columnNumber":110,"lineNumber":8,"columnNumber":6} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":2} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} Getting v8-generated stack trace... diff --git a/deps/v8/test/inspector/debugger/break-on-exception-async-gen-expected.txt b/deps/v8/test/inspector/debugger/break-on-exception-async-gen-expected.txt new file mode 100644 index 0000000000..0e529170ae --- /dev/null +++ b/deps/v8/test/inspector/debugger/break-on-exception-async-gen-expected.txt @@ -0,0 +1,45 @@ +Check that "break on exceptions" works for async generators. + +Running test: testSimpleGeneratorThrowCaught +Paused for CAUGHT exception. + +Running test: testSimpleGeneratorThrowUncaught +Paused for UNCAUGHT exception. + +Running test: testYieldBeforeThrowCaught +Paused for CAUGHT exception. + +Running test: testYieldBeforeThrowUncaught +Paused for UNCAUGHT exception. + +Running test: testAwaitBeforeThrowCaught +Paused for CAUGHT exception. + +Running test: testAwaitBeforeThrowUncaught +Paused for UNCAUGHT exception. + +Running test: testYieldBeforeThrowWithAwaitCaught +Paused for CAUGHT exception. + +Running test: testYieldBeforeThrowWithAwaitUncaught +Paused for UNCAUGHT exception. + +Running test: testAwaitBeforeThrowWithYieldCaught +Paused for CAUGHT exception. + +Running test: testAwaitBeforeThrowWithYieldUncaught +Paused for UNCAUGHT exception. + +Running test: testYieldThrowsCaught +Paused for CAUGHT exception. +Paused for CAUGHT exception. + +Running test: testYieldThrowsUncaught +Paused for UNCAUGHT exception. +Paused for UNCAUGHT exception. + +Running test: testAwaitThrowsCaught +Paused for CAUGHT exception. + +Running test: testAwaitThrowsUncaught +Paused for UNCAUGHT exception. diff --git a/deps/v8/test/inspector/debugger/break-on-exception-async-gen.js b/deps/v8/test/inspector/debugger/break-on-exception-async-gen.js new file mode 100644 index 0000000000..7fd0c0c791 --- /dev/null +++ b/deps/v8/test/inspector/debugger/break-on-exception-async-gen.js @@ -0,0 +1,118 @@ +// 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. + +let {session, contextGroup, Protocol} = InspectorTest.start('Check that "break on exceptions" works for async generators.'); + +contextGroup.addScript(` +async function* simpleThrow() { + throw new Error(); +} + +async function* yieldBeforeThrow() { + yield 1; + throw new Error(); +} + +async function* awaitBeforeThrow() { + await 1; + throw new Error(); +} + +async function* yieldBeforeThrowWithAwait() { + await 1; + yield 2; + throw new Error(); +} + +async function* awaitBeforeThrowWithYield() { + yield 1; + await 2; + throw new Error(); +} + +async function* yieldThrows() { + yield 1; + yield thrower(); +} + +async function* awaitThrows() { + yield 1; + await thrower(); +} + +async function runGenWithCatch(gen) { + try { + for await (const val of gen()); + } catch {} +} + +async function runGenWithoutCatch(gen) { + for await (const val of gen()); +} + +async function thrower() { + await 1; // Suspend once. + throw new Error(); +}`); + +Protocol.Debugger.onPaused(async ({ params: { data }}) => { + const caughtOrUncaught = data.uncaught ? 'UNCAUGHT' : 'CAUGHT'; + InspectorTest.log(`Paused for ${caughtOrUncaught} exception.`); + await Protocol.Debugger.resume(); +}); + +async function runTest(expression) { + await Promise.all([ + Protocol.Debugger.enable(), + Protocol.Debugger.setPauseOnExceptions({state: 'all'}), + ]); + + await Protocol.Runtime.evaluate({ expression, awaitPromise: true }); + await Protocol.Debugger.disable(); +} + +InspectorTest.runAsyncTestSuite([ + async function testSimpleGeneratorThrowCaught() { + await runTest('runGenWithCatch(simpleThrow)'); + }, + async function testSimpleGeneratorThrowUncaught() { + await runTest('runGenWithoutCatch(simpleThrow)'); + }, + async function testYieldBeforeThrowCaught() { + await runTest('runGenWithCatch(yieldBeforeThrow)'); + }, + async function testYieldBeforeThrowUncaught() { + await runTest('runGenWithoutCatch(yieldBeforeThrow)'); + }, + async function testAwaitBeforeThrowCaught() { + await runTest('runGenWithCatch(awaitBeforeThrow)'); + }, + async function testAwaitBeforeThrowUncaught() { + await runTest('runGenWithoutCatch(awaitBeforeThrow)'); + }, + async function testYieldBeforeThrowWithAwaitCaught() { + await runTest('runGenWithCatch(yieldBeforeThrowWithAwait)'); + }, + async function testYieldBeforeThrowWithAwaitUncaught() { + await runTest('runGenWithoutCatch(yieldBeforeThrowWithAwait)'); + }, + async function testAwaitBeforeThrowWithYieldCaught() { + await runTest('runGenWithCatch(awaitBeforeThrowWithYield)'); + }, + async function testAwaitBeforeThrowWithYieldUncaught() { + await runTest('runGenWithoutCatch(awaitBeforeThrowWithYield)'); + }, + async function testYieldThrowsCaught() { + await runTest('runGenWithCatch(yieldThrows)'); + }, + async function testYieldThrowsUncaught() { + await runTest('runGenWithoutCatch(yieldThrows)'); + }, + async function testAwaitThrowsCaught() { + await runTest('runGenWithCatch(awaitThrows)'); + }, + async function testAwaitThrowsUncaught() { + await runTest('runGenWithoutCatch(awaitThrows)'); + }, +]); diff --git a/deps/v8/test/inspector/debugger/class-private-fields-scopes-expected.txt b/deps/v8/test/inspector/debugger/class-private-fields-scopes-expected.txt index e9c6a95626..b302e1d465 100644 --- a/deps/v8/test/inspector/debugger/class-private-fields-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-fields-scopes-expected.txt @@ -53,7 +53,7 @@ Running test: testScopesPaused objectId : <objectId> type : object } - url : + url : } [1] : { callFrameId : <callFrameId> @@ -106,7 +106,7 @@ Running test: testScopesPaused objectId : <objectId> type : object } - url : + url : } [2] : { callFrameId : <callFrameId> @@ -116,7 +116,7 @@ Running test: testScopesPaused lineNumber : 0 scriptId : <scriptId> } - functionName : + functionName : location : { columnNumber : 0 lineNumber : 0 @@ -139,6 +139,6 @@ Running test: testScopesPaused objectId : <objectId> type : object } - url : + url : } ] diff --git a/deps/v8/test/inspector/debugger/class-private-methods-empty-inner-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-empty-inner-expected.txt index cb77ef1343..82bb85cf52 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-empty-inner-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-empty-inner-expected.txt @@ -1,4 +1,7 @@ Test empty inner classes with private instance methods in the outer class Running test: testScopesPaused +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() undefined diff --git a/deps/v8/test/inspector/debugger/class-private-methods-empty-inner.js b/deps/v8/test/inspector/debugger/class-private-methods-empty-inner.js index 5a687480be..8d595ceb95 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-empty-inner.js +++ b/deps/v8/test/inspector/debugger/class-private-methods-empty-inner.js @@ -2,6 +2,8 @@ // 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'); + let {session, contextGroup, Protocol} = InspectorTest.start( 'Test empty inner classes with private instance methods in the outer class'); @@ -32,10 +34,7 @@ InspectorTest.runAsyncTestSuite([async function testScopesPaused() { await Protocol.Debugger.oncePaused(); // inside fn() let frame = callFrames[0]; - let {result} = - await Protocol.Runtime.getProperties({objectId: frame.this.objectId}); - - InspectorTest.logObject(result.privateProperties); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); Protocol.Debugger.resume(); Protocol.Debugger.disable(); diff --git a/deps/v8/test/inspector/debugger/class-private-methods-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-expected.txt index 21da2d844c..91e9daba4f 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-expected.txt @@ -1,18 +1,9 @@ Test private class methods Running test: testScopesPaused -private properties on the base class instance +privateProperties from Runtime.getProperties() [ [0] : { - name : #inc - value : { - className : Function - description : #inc() { this.#field++; return this.#field; } - objectId : <objectId> - type : function - } - } - [1] : { name : #writeOnly set : { className : Function @@ -21,7 +12,7 @@ private properties on the base class instance type : function } } - [2] : { + [1] : { get : { className : Function description : get #readOnly() { return this.#field; } @@ -30,7 +21,7 @@ private properties on the base class instance } name : #readOnly } - [3] : { + [2] : { get : { className : Function description : get #accessor() { return this.#field; } @@ -45,7 +36,7 @@ private properties on the base class instance type : function } } - [4] : { + [3] : { name : #field value : { description : 2 @@ -54,7 +45,37 @@ private properties on the base class instance } } ] +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object + } +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #inc() { this.#field++; return this.#field; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} private accessors properties on the base class instance +privateProperties from Runtime.getProperties() [ [0] : { name : #writeOnly @@ -130,18 +151,10 @@ Evaluating write-only accessor value : 0 } } -privateProperties on the subclass instance +private members on the subclass instance +privateProperties from Runtime.getProperties() [ [0] : { - name : #inc - value : { - className : Function - description : #inc() { this.#field++; return this.#field; } - objectId : <objectId> - type : function - } - } - [1] : { name : #writeOnly set : { className : Function @@ -150,7 +163,7 @@ privateProperties on the subclass instance type : function } } - [2] : { + [1] : { get : { className : Function description : get #readOnly() { return this.#field; } @@ -159,7 +172,7 @@ privateProperties on the subclass instance } name : #readOnly } - [3] : { + [2] : { get : { className : Function description : get #accessor() { return this.#field; } @@ -174,7 +187,7 @@ privateProperties on the subclass instance type : function } } - [4] : { + [3] : { name : #field value : { description : 2 @@ -182,25 +195,64 @@ privateProperties on the subclass instance value : 2 } } - [5] : { - name : #subclassMethod - value : { - className : Function - description : #subclassMethod() { return 'subclassMethod'; } - objectId : <objectId> - type : function - } +] +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[3] + objectId : <objectId> + subtype : internal#privateMethodList + type : object } - [6] : { - name : #inc - value : { - className : Function - description : #inc() { return 'subclass #inc'; } - objectId : <objectId> - type : function +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #inc() { this.#field++; return this.#field; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true } - } -] + [1] : { + configurable : true + enumerable : true + isOwn : true + name : 1 + value : { + className : Object + description : #subclassMethod() { return 'subclassMethod'; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + [2] : { + configurable : true + enumerable : true + isOwn : true + name : 2 + value : { + className : Object + description : #inc() { return 'subclass #inc'; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} Evaluating private methods in the base class from the subclass { exceptionDetails : { diff --git a/deps/v8/test/inspector/debugger/class-private-methods-nested-super-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-nested-super-expected.txt index 4e1b681a19..3d9587b109 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-nested-super-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-nested-super-expected.txt @@ -1,30 +1,42 @@ Test getting private class methods from an instance that calls nested super() Running test: testScopesPaused -properties after super() is called in IIFE -[ - [0] : { - name : #b - value : { - className : Function - description : #b() {} - objectId : <objectId> - type : function - } +private members after super() is called in IIFE +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object } -] -privateProperties after super() is called in arrow function +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #b() {} + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} +private members after super() is called in arrow function +privateProperties from Runtime.getProperties() [ [0] : { - name : #b - value : { - className : Function - description : #b() {} - objectId : <objectId> - type : function - } - } - [1] : { get : { className : Function description : get #c() {} @@ -34,18 +46,39 @@ privateProperties after super() is called in arrow function name : #c } ] -privateProperties after super() is called in eval() +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object + } +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #b() {} + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} +private members after super() is called in eval() +privateProperties from Runtime.getProperties() [ [0] : { - name : #b - value : { - className : Function - description : #b() {} - objectId : <objectId> - type : function - } - } - [1] : { get : { className : Function description : get #c() {} @@ -54,7 +87,7 @@ privateProperties after super() is called in eval() } name : #c } - [2] : { + [1] : { name : #d set : { className : Function @@ -64,3 +97,32 @@ privateProperties after super() is called in eval() } } ] +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object + } +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #b() {} + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} diff --git a/deps/v8/test/inspector/debugger/class-private-methods-nested-super.js b/deps/v8/test/inspector/debugger/class-private-methods-nested-super.js index 5a8452f55c..d3c04ef9a8 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-nested-super.js +++ b/deps/v8/test/inspector/debugger/class-private-methods-nested-super.js @@ -2,6 +2,8 @@ // 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'); + let { session, contextGroup, Protocol } = InspectorTest.start( "Test getting private class methods from an instance that calls nested super()" ); @@ -47,31 +49,25 @@ InspectorTest.runAsyncTestSuite([ params: { callFrames } } = await Protocol.Debugger.oncePaused(); // inside B constructor let frame = callFrames[0]; - let { result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - }); - InspectorTest.log('properties after super() is called in IIFE'); - InspectorTest.logMessage(result.privateProperties); + InspectorTest.log('private members after super() is called in IIFE'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); + Protocol.Debugger.resume(); ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // inside C constructor frame = callFrames[0]; - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.log('privateProperties after super() is called in arrow function'); - InspectorTest.logMessage(result.privateProperties); + InspectorTest.log('private members after super() is called in arrow function'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); + Protocol.Debugger.resume(); ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // inside D constructor frame = callFrames[0]; - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.log('privateProperties after super() is called in eval()'); - InspectorTest.logMessage(result.privateProperties); + + InspectorTest.log('private members after super() is called in eval()'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); Protocol.Debugger.resume(); Protocol.Debugger.disable(); diff --git a/deps/v8/test/inspector/debugger/class-private-methods-preview-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-preview-expected.txt index 01f8a7b363..b6029a133a 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-preview-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-preview-expected.txt @@ -7,11 +7,6 @@ expression: new class extends class { constructor() { return new Proxy({}, {}); expression: new class { #method() { return 1; } get #accessor() { } set #accessor(val) { } } [ [0] : { - name : #method - type : function - value : - } - [1] : { name : #accessor type : accessor } @@ -19,11 +14,6 @@ expression: new class { #method() { return 1; } get #accessor() { } set #accesso expression: new class extends class { #method() { return 1; } } { get #accessor() { } set #accessor(val) { } } [ [0] : { - name : #method - type : function - value : - } - [1] : { name : #accessor type : accessor } diff --git a/deps/v8/test/inspector/debugger/class-private-methods-static-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-static-expected.txt index 1da6f6d264..43b5b5e948 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-static-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-static-expected.txt @@ -1,7 +1,8 @@ Test static private class methods Running test: testScopesPaused -privateProperties on the base class +private members on the base class +privateProperties from Runtime.getProperties() [ [0] : { name : #writeOnly @@ -37,15 +38,6 @@ privateProperties on the base class } } [3] : { - name : #inc - value : { - className : Function - description : #inc() { return ++A.#accessor; } - objectId : <objectId> - type : function - } - } - [4] : { name : #field value : { description : 2 @@ -54,6 +46,35 @@ privateProperties on the base class } } ] +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object + } +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #inc() { return ++A.#accessor; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} Evaluating A.#inc(); { result : { @@ -94,7 +115,8 @@ Evaluating this.#writeOnly = 0; this.#field; value : 0 } } -privateProperties on the subclass +private members on the subclass +privateProperties from Runtime.getProperties() [ [0] : { get : { @@ -105,16 +127,36 @@ privateProperties on the subclass } name : #accessor } - [1] : { - name : #subclassMethod - value : { - className : Function - description : #subclassMethod() { return B.#accessor; } - objectId : <objectId> - type : function - } - } ] +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object + } +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #subclassMethod() { return B.#accessor; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} Evaluating this.#inc(); from the base class { exceptionDetails : { diff --git a/deps/v8/test/inspector/debugger/class-private-methods-static-nested-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-static-nested-expected.txt index cb12a7446b..b47bf7e8e7 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-static-nested-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-static-nested-expected.txt @@ -1,17 +1,40 @@ Test static private class methods Running test: testScopesPaused -privateProperties on class A -[ - [0] : { - name : #method - value : { - className : Function - description : #method() { debugger; } - objectId : <objectId> - type : function - } +private members on class A +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object } -] -privateProperties on class B +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #method() { debugger; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} +private members on class B +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() undefined diff --git a/deps/v8/test/inspector/debugger/class-private-methods-static-nested.js b/deps/v8/test/inspector/debugger/class-private-methods-static-nested.js index db43d867f0..0d67f819d2 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-static-nested.js +++ b/deps/v8/test/inspector/debugger/class-private-methods-static-nested.js @@ -2,6 +2,8 @@ // 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'); + let { session, contextGroup, Protocol } = InspectorTest.start( "Test static private class methods" ); @@ -32,26 +34,20 @@ InspectorTest.runAsyncTestSuite([ // Do not await here, instead oncePaused should be awaited. Protocol.Runtime.evaluate({ expression: 'run()' }); - InspectorTest.log('privateProperties on class A'); + InspectorTest.log('private members on class A'); let { params: { callFrames } } = await Protocol.Debugger.oncePaused(); // inside A.#method() let frame = callFrames[0]; - let { result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - }); - InspectorTest.logMessage(result.privateProperties); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); Protocol.Debugger.resume(); ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // B.test(); frame = callFrames[0]; - InspectorTest.log('privateProperties on class B'); - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.logObject(result.privateProperties); + InspectorTest.log('private members on class B'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); Protocol.Debugger.resume(); Protocol.Debugger.disable(); diff --git a/deps/v8/test/inspector/debugger/class-private-methods-static.js b/deps/v8/test/inspector/debugger/class-private-methods-static.js index 57afd27456..8f1584a241 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-static.js +++ b/deps/v8/test/inspector/debugger/class-private-methods-static.js @@ -2,6 +2,8 @@ // 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'); + let { session, contextGroup, Protocol } = InspectorTest.start( "Test static private class methods" ); @@ -45,21 +47,19 @@ InspectorTest.runAsyncTestSuite([ // Do not await here, instead oncePaused should be awaited. Protocol.Runtime.evaluate({ expression: 'run()' }); - InspectorTest.log('privateProperties on the base class'); + InspectorTest.log('private members on the base class'); let { params: { callFrames } } = await Protocol.Debugger.oncePaused(); // inside A.test() let frame = callFrames[0]; - let { result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - }); - InspectorTest.logMessage(result.privateProperties); + + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); InspectorTest.log('Evaluating A.#inc();'); - ({ result } = await Protocol.Debugger.evaluateOnCallFrame({ + let { result } = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'A.#inc();', callFrameId: callFrames[0].callFrameId - })); + }); InspectorTest.logObject(result); InspectorTest.log('Evaluating this.#inc();'); @@ -94,11 +94,8 @@ InspectorTest.runAsyncTestSuite([ ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // B.test(); frame = callFrames[0]; - InspectorTest.log('privateProperties on the subclass'); - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.logMessage(result.privateProperties); + InspectorTest.log('private members on the subclass'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); InspectorTest.log('Evaluating this.#inc(); from the base class'); ({ result } = await Protocol.Debugger.evaluateOnCallFrame({ diff --git a/deps/v8/test/inspector/debugger/class-private-methods-unused-expected.txt b/deps/v8/test/inspector/debugger/class-private-methods-unused-expected.txt index 04a4f5aa0f..aef4e9a06b 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-unused-expected.txt +++ b/deps/v8/test/inspector/debugger/class-private-methods-unused-expected.txt @@ -1,18 +1,38 @@ Test accessing unused private methods at runtime Running test: testScopesPaused -Get privateProperties of A in testStatic() -[ - [0] : { - name : #staticMethod - value : { - className : Function - description : #staticMethod() { return 1; } - objectId : <objectId> - type : function - } +private members of A in testStatic() +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object } -] +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #staticMethod() { return 1; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} Access A.#staticMethod() in testStatic() { exceptionDetails : { @@ -61,18 +81,38 @@ Access this.#staticMethod() in testStatic() type : object } } -get privateProperties of a in testInstance() -[ - [0] : { - name : #instanceMethod - value : { - className : Function - description : #instanceMethod() { return 2; } - objectId : <objectId> - type : function - } +private members of a in testInstance() +privateProperties from Runtime.getProperties() +undefined +[[PrivateMethods]] in internalProperties from Runtime.getProperties() +{ + name : [[PrivateMethods]] + value : { + className : Array + description : PrivateMethods[1] + objectId : <objectId> + subtype : internal#privateMethodList + type : object } -] +} +{ + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : 0 + value : { + className : Object + description : #instanceMethod() { return 2; } + objectId : <objectId> + subtype : internal#privateMethod + type : object + } + writable : true + } + ] +} Evaluating this.#instanceMethod() in testInstance() { result : { diff --git a/deps/v8/test/inspector/debugger/class-private-methods-unused.js b/deps/v8/test/inspector/debugger/class-private-methods-unused.js index 5ab79f2843..270bec428f 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods-unused.js +++ b/deps/v8/test/inspector/debugger/class-private-methods-unused.js @@ -2,6 +2,8 @@ // 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'); + let { session, contextGroup, Protocol } = InspectorTest.start( "Test accessing unused private methods at runtime" ); @@ -28,15 +30,12 @@ InspectorTest.runAsyncTestSuite([ // Do not await here, instead oncePaused should be awaited. Protocol.Runtime.evaluate({ expression: 'run()' }); - InspectorTest.log('Get privateProperties of A in testStatic()'); + InspectorTest.log('private members of A in testStatic()'); let { params: { callFrames } } = await Protocol.Debugger.oncePaused(); // inside A.testStatic() let frame = callFrames[0]; - let { result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - }); - InspectorTest.logMessage(result.privateProperties); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); // Variables not referenced in the source code are currently // considered "optimized away". @@ -58,11 +57,8 @@ InspectorTest.runAsyncTestSuite([ ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // a.testInstatnce(); frame = callFrames[0]; - InspectorTest.log('get privateProperties of a in testInstance()'); - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.logMessage(result.privateProperties); + InspectorTest.log('private members of a in testInstance()'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); InspectorTest.log('Evaluating this.#instanceMethod() in testInstance()'); ({ result } = await Protocol.Debugger.evaluateOnCallFrame({ diff --git a/deps/v8/test/inspector/debugger/class-private-methods.js b/deps/v8/test/inspector/debugger/class-private-methods.js index 86839f87d6..584ecb9b8e 100644 --- a/deps/v8/test/inspector/debugger/class-private-methods.js +++ b/deps/v8/test/inspector/debugger/class-private-methods.js @@ -2,6 +2,8 @@ // 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'); + let { session, contextGroup, Protocol } = InspectorTest.start( "Test private class methods" ); @@ -52,25 +54,18 @@ InspectorTest.runAsyncTestSuite([ params: { callFrames } } = await Protocol.Debugger.oncePaused(); // inside a.fn() let frame = callFrames[0]; - let { result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - }); - - InspectorTest.log('private properties on the base class instance'); - InspectorTest.logMessage(result.privateProperties); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); - ({ result } = await Protocol.Runtime.getProperties({ + InspectorTest.log('private accessors properties on the base class instance'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId, accessorPropertiesOnly: true, - })); - - InspectorTest.log('private accessors properties on the base class instance'); - InspectorTest.logMessage(result.privateProperties); + }); - ({ result } = await Protocol.Debugger.evaluateOnCallFrame({ + let { result } = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'this.#inc();', callFrameId: callFrames[0].callFrameId - })); + }); InspectorTest.log('Evaluating private methods'); InspectorTest.logObject(result); @@ -111,11 +106,8 @@ InspectorTest.runAsyncTestSuite([ ({ params: { callFrames } } = await Protocol.Debugger.oncePaused()); // b.fn(); frame = callFrames[0]; - ({ result } = await Protocol.Runtime.getProperties({ - objectId: frame.this.objectId - })); - InspectorTest.log('privateProperties on the subclass instance'); - InspectorTest.logMessage(result.privateProperties); + InspectorTest.log('private members on the subclass instance'); + await printPrivateMembers(Protocol, InspectorTest, { objectId: frame.this.objectId }); ({ result } = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'this.#subclassMethod();', diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-conflict-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-conflict-expected.txt new file mode 100644 index 0000000000..5b406d0a4d --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-conflict-expected.txt @@ -0,0 +1,55 @@ +Evaluate conflicting private class member out of class scope in Debugger.evaluateOnCallFrame() + +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"; +} +debugger; + +Running test: evaluatePrivateMembers +Debugger.evaluateOnCallFrame: `(new ClassWithField).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at eval (eval at <anonymous> (:18:1), <anonymous>:1:2) at <anonymous>:18:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `(new ClassWithMethod).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at eval (eval at <anonymous> (:18:1), <anonymous>:1:2) at <anonymous>:18:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `(new ClassWithAccessor).#name` +{ + className : Error + description : Error: Operation is ambiguous because there are more than one private name'#name' on the object at eval (eval at <anonymous> (:18:1), <anonymous>:1:2) at <anonymous>:18:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `StaticClass.#name` +{ + type : string + value : child +} +Debugger.evaluateOnCallFrame: `(new StaticClass).#name` +{ + type : string + value : string +} diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-conflict.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-conflict.js new file mode 100644 index 0000000000..8dae59021c --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-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: false, + message: `Evaluate conflicting private class member out of class scope in Debugger.evaluateOnCallFrame()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-expected.txt new file mode 100644 index 0000000000..651306c9cd --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-expected.txt @@ -0,0 +1,231 @@ +Evaluate private class member out of class scope in Debugger.evaluateOnCallFrame() + +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(); +debugger; + +Running test: evaluatePrivateMembers +Checking private fields +Debugger.evaluateOnCallFrame: `obj.#field` +{ + type : string + value : string +} +Debugger.evaluateOnCallFrame: `obj.#field = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#field++` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 2 + type : number + value : 2 +} +Debugger.evaluateOnCallFrame: `++obj.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `obj.#field -= 3` +{ + description : 0 + type : number + value : 0 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private getter-only accessors +Debugger.evaluateOnCallFrame: `obj.#getterOnly` +{ + type : string + value : getterOnly +} +Debugger.evaluateOnCallFrame: `obj.#getterOnly = 1` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:17) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#getterOnly++` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:16) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#getterOnly -= 3` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:17) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#getterOnly` +{ + type : string + value : getterOnly +} +Checking private setter-only accessors +Debugger.evaluateOnCallFrame: `obj.#setterOnly` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#setterOnly = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#setterOnly++` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#setterOnly -= 3` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + type : string + value : setterOnlyCalled +} +Checking private accessors +Debugger.evaluateOnCallFrame: `obj.#accessor` +{ + type : string + value : setterOnlyCalled +} +Debugger.evaluateOnCallFrame: `obj.#accessor = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#accessor++` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 2 + type : number + value : 2 +} +Debugger.evaluateOnCallFrame: `++obj.#accessor` +{ + type : undefined +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `obj.#accessor -= 3` +{ + description : 0 + type : number + value : 0 +} +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private methods +Debugger.evaluateOnCallFrame: `obj.#method` +{ + className : Function + description : #method() { return "method"; } + objectId : <objectId> + type : function +} +Debugger.evaluateOnCallFrame: `obj.#method = 1` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:13) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#method++` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:12) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `++obj.#method` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:7) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `obj.#method -= 3` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:13) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module-expected.txt new file mode 100644 index 0000000000..dd0cad227a --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module-expected.txt @@ -0,0 +1,16 @@ +Evaluate private class member out of class scope in Debugger.evaluateOnCallFrame() in module + +class Klass { + #field = 1; +} +const obj = new Klass; +debugger; + + +Running test: evaluatePrivateMembers +Debugger.evaluateOnCallFrame: `obj.#field` +{ + description : 1 + type : number + value : 1 +} diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module.js new file mode 100644 index 0000000000..98b86f12bf --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-in-module.js @@ -0,0 +1,32 @@ +// 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. + +const { contextGroup, Protocol } = InspectorTest.start( + 'Evaluate private class member out of class scope in Debugger.evaluateOnCallFrame() in module' +); + +Protocol.Debugger.enable(); +const source = ` +class Klass { + #field = 1; +} +const obj = new Klass; +debugger; +`; + +InspectorTest.log(source); +contextGroup.addModule(source, 'module'); + +InspectorTest.runAsyncTestSuite([async function evaluatePrivateMembers() { + const { params: { callFrames } } = await Protocol.Debugger.oncePaused(); + const frame = callFrames[0]; + const expression = 'obj.#field'; + InspectorTest.log(`Debugger.evaluateOnCallFrame: \`${expression}\``); + const { result: { result } } = + await Protocol.Debugger.evaluateOnCallFrame({ + callFrameId: frame.callFrameId, + expression + }); + InspectorTest.logMessage(result); +}]); diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-static-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-static-expected.txt new file mode 100644 index 0000000000..28122d3999 --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-static-expected.txt @@ -0,0 +1,231 @@ +Evaluate static private class member out of class scope in Debugger.evaluateOnCallFrame() + +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(); +debugger; + +Running test: evaluatePrivateMembers +Checking private fields +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + type : string + value : string +} +Debugger.evaluateOnCallFrame: `Klass.#field = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#field++` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 2 + type : number + value : 2 +} +Debugger.evaluateOnCallFrame: `++Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `Klass.#field -= 3` +{ + description : 0 + type : number + value : 0 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private getter-only accessors +Debugger.evaluateOnCallFrame: `Klass.#getterOnly` +{ + type : string + value : getterOnly +} +Debugger.evaluateOnCallFrame: `Klass.#getterOnly = 1` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:19) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#getterOnly++` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:18) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#getterOnly -= 3` +{ + className : Error + description : Error: '#getterOnly' was defined without a setter at eval (eval at <anonymous> (:11:1), <anonymous>:1:19) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#getterOnly` +{ + type : string + value : getterOnly +} +Checking private setter-only accessors +Debugger.evaluateOnCallFrame: `Klass.#setterOnly` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#setterOnly = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#setterOnly++` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#setterOnly -= 3` +{ + className : Error + description : Error: '#setterOnly' was defined without a getter at eval (eval at <anonymous> (:11:1), <anonymous>:1:1) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + type : string + value : setterOnlyCalled +} +Checking private accessors +Debugger.evaluateOnCallFrame: `Klass.#accessor` +{ + type : string + value : setterOnlyCalled +} +Debugger.evaluateOnCallFrame: `Klass.#accessor = 1` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#accessor++` +{ + description : 1 + type : number + value : 1 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 2 + type : number + value : 2 +} +Debugger.evaluateOnCallFrame: `++Klass.#accessor` +{ + type : undefined +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 3 + type : number + value : 3 +} +Debugger.evaluateOnCallFrame: `Klass.#accessor -= 3` +{ + description : 0 + type : number + value : 0 +} +Debugger.evaluateOnCallFrame: `Klass.#field` +{ + description : 0 + type : number + value : 0 +} +Checking private methods +Debugger.evaluateOnCallFrame: `Klass.#method` +{ + className : Function + description : #method() { return "method"; } + objectId : <objectId> + type : function +} +Debugger.evaluateOnCallFrame: `Klass.#method = 1` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:15) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#method++` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:14) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `++Klass.#method` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:9) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} +Debugger.evaluateOnCallFrame: `Klass.#method -= 3` +{ + className : Error + description : Error: Private method '#method' is not writable at eval (eval at <anonymous> (:11:1), <anonymous>:1:15) at <anonymous>:11:1 + objectId : <objectId> + subtype : error + type : object +} diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-static.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-static.js new file mode 100644 index 0000000000..d01e88de5b --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-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: false, + message: `Evaluate static private class member out of class scope in Debugger.evaluateOnCallFrame()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-super-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-super-expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member-super-expected.txt diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-private-class-member.js new file mode 100644 index 0000000000..667877920e --- /dev/null +++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-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: false, + message: `Evaluate private class member out of class scope in Debugger.evaluateOnCallFrame()` +}; +PrivateClassMemberInspectorTest.runTest(InspectorTest, options); diff --git a/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions-expected.txt b/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions-expected.txt new file mode 100644 index 0000000000..1b8131848f --- /dev/null +++ b/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions-expected.txt @@ -0,0 +1,64 @@ +Checks instrumentation pause with multiple sessions + +Running test: testTwoInstrumentationBreaksResume +Created two sessions. +Paused 1: instrumentation +Paused 2: instrumentation +Resumed session 1 +Resumed session 2 +Evaluation result: 42 +Evaluation finished + +Running test: testInstrumentedSessionNotification +Created two sessions. +Session 1 paused (instrumentation) +Session 2 paused (other) +Resumed session 1 +Resumed session 2 +Evaluation result: 42 +Evaluation finished + +Running test: testNonInstrumentedSessionCannotsResumeInstrumentationPause +Created two sessions. +Session 1 paused (instrumentation) +Session 2 paused (other) +Called "resume" on session 2 +Called "resume" on session 1 +Resumed session 1 +Resumed session 2 +Evaluation result: 42 +Evaluation finished + +Running test: testEvaluationFromNonInstrumentedSession +Created two sessions. +Session 1 paused (instrumentation) +Session 2 paused (other) +Called "resume" on session 1 +Resumed session 1 +Resumed session 2 +Evaluation result: 42 +Evaluation finished + +Running test: testTransparentEvaluationFromNonInstrumentedSessionDuringPause +Created two sessions. +Session 1 paused (instrumentation) +Session 2 paused (other) +Resumed session 1 +Session 2 evaluation result: 42 + +Running test: testInstrumentationStopResumesWithOtherSessions +Created two sessions. +Session 1 paused (instrumentation) +Stopped session 1 +Resumed session 2 +Session 2 evaluation result: 42 + +Running test: testInstrumentationPauseAndNormalPause +Created two sessions. +Session 1 paused (instrumentation) +Session 2 paused (other) +Session 2 pause requested +Session 1 instrumentation resume requested +Session 2 paused (other) +Session 2 resumed +Session 1 evaluation result: 42 diff --git a/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions.js b/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions.js new file mode 100644 index 0000000000..79022dda49 --- /dev/null +++ b/deps/v8/test/inspector/debugger/instrumentation-multiple-sessions.js @@ -0,0 +1,292 @@ +// 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.log('Checks instrumentation pause with multiple sessions'); + +InspectorTest.runAsyncTestSuite([ + async function testTwoInstrumentationBreaksResume() { + // Initialize two sessions with instrumentation breakpoints. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + await Protocol2.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + InspectorTest.log('Created two sessions.'); + + // Expect both sessions pausing on instrumentation breakpoint. + const paused1 = Protocol1.Debugger.oncePaused(); + const paused2 = Protocol2.Debugger.oncePaused(); + const evaluationFinished = + Protocol1.Runtime.evaluate({expression: '42'}) + .then( + r => InspectorTest.log( + `Evaluation result: ${r.result.result.value}`)); + + // Verify the instrumentation breakpoint puased the sessions. + InspectorTest.log(`Paused 1: ${(await paused1).params.reason}`); + InspectorTest.log(`Paused 2: ${(await paused2).params.reason}`); + + // Let us call resume in the first session and make sure that this + // does not resume the instrumentation pause (the instrumentation + // pause should only resume once all sessions ask for resumption). + // + // Unfortunately, we cannot check for absence of resumptions, so + // let's just give the evaluation chance to finish early by calling + // 'resume' on the first session multiple times. + for (let i = 0; i < 20; i++) { + await Protocol1.Debugger.resume(); + } + InspectorTest.log('Resumed session 1'); + + // Resuming the second session should allow the evaluation to + // finish. + await Protocol2.Debugger.resume(); + InspectorTest.log('Resumed session 2'); + + await evaluationFinished; + InspectorTest.log('Evaluation finished'); + }, + async function testInstrumentedSessionNotification() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + InspectorTest.log('Created two sessions.'); + + // Verify that the instrumented session sees the instrumentation pause. + const paused1 = Protocol1.Debugger.oncePaused(); + const paused2 = Protocol2.Debugger.oncePaused(); + const evaluationFinished = + Protocol1.Runtime.evaluate({expression: '42'}) + .then( + r => InspectorTest.log( + `Evaluation result: ${r.result.result.value}`)); + InspectorTest.log(`Session 1 paused (${(await paused1).params.reason})`); + InspectorTest.log(`Session 2 paused (${(await paused2).params.reason})`); + + const onResume1 = Protocol1.Debugger.onceResumed(); + const onResume2 = Protocol2.Debugger.onceResumed(); + await Protocol1.Debugger.resume(); + await onResume1; + InspectorTest.log('Resumed session 1'); + await onResume2; + InspectorTest.log('Resumed session 2'); + + await evaluationFinished; + InspectorTest.log('Evaluation finished'); + }, + async function testNonInstrumentedSessionCannotsResumeInstrumentationPause() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + InspectorTest.log('Created two sessions.'); + + // Make sure the non-instrumentation session does not pause or resume on + // instrumentation. + Protocol2.Debugger.onResumed( + m => InspectorTest.log('[Unexpected] Session 2 resumed')); + + // Induce instrumentation pause. + const paused1 = Protocol1.Debugger.oncePaused(); + const paused2 = Protocol2.Debugger.oncePaused(); + const evaluationFinished = + Protocol1.Runtime.evaluate({expression: '42'}) + .then( + r => InspectorTest.log( + `Evaluation result: ${r.result.result.value}`)); + InspectorTest.log(`Session 1 paused (${(await paused1).params.reason})`); + InspectorTest.log(`Session 2 paused (${(await paused2).params.reason})`); + + // Calling 'resume' on the non-instrumented session should not have any + // effect on the session in the instrumentation pause. + for (let i = 0; i < 10; i++) { + await Protocol2.Debugger.resume(); + } + InspectorTest.log('Called "resume" on session 2'); + + const onResume1 = Protocol1.Debugger.onceResumed(); + const onResume2 = Protocol2.Debugger.onceResumed(); + await Protocol1.Debugger.resume(); + InspectorTest.log('Called "resume" on session 1'); + await onResume1; + InspectorTest.log('Resumed session 1'); + await onResume2; + InspectorTest.log('Resumed session 2'); + + await evaluationFinished; + InspectorTest.log('Evaluation finished'); + }, + async function testEvaluationFromNonInstrumentedSession() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + InspectorTest.log('Created two sessions.'); + + // Start evaluation in the non-instrumentation session and expect that + // the instrumentation session is paused. + const paused1 = Protocol1.Debugger.oncePaused(); + const paused2 = Protocol2.Debugger.oncePaused(); + const evaluationFinished = + Protocol2.Runtime.evaluate({expression: '42'}) + .then( + r => InspectorTest.log( + `Evaluation result: ${r.result.result.value}`)); + InspectorTest.log(`Session 1 paused (${(await paused1).params.reason})`); + InspectorTest.log(`Session 2 paused (${(await paused2).params.reason})`); + + const onResume1 = Protocol1.Debugger.onceResumed(); + const onResume2 = Protocol2.Debugger.onceResumed(); + await Protocol1.Debugger.resume(); + InspectorTest.log('Called "resume" on session 1'); + await onResume1; + InspectorTest.log('Resumed session 1'); + await onResume2; + InspectorTest.log('Resumed session 2'); + + await evaluationFinished; + InspectorTest.log('Evaluation finished'); + }, + async function + testTransparentEvaluationFromNonInstrumentedSessionDuringPause() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + InspectorTest.log('Created two sessions.'); + + // Enter instrumentation pause. + const paused1 = Protocol1.Debugger.oncePaused(); + const paused2 = Protocol2.Debugger.oncePaused(); + Protocol1.Runtime.evaluate({expression: 'null'}) + InspectorTest.log( + `Session 1 paused (${(await paused1).params.reason})`); + InspectorTest.log( + `Session 2 paused (${(await paused2).params.reason})`); + + // Start evaluation in session 2. + const evaluation = Protocol2.Runtime.evaluate({expression: '42'}); + + await Protocol1.Debugger.resume(); + InspectorTest.log('Resumed session 1'); + + // Make sure the evaluation finished. + InspectorTest.log(`Session 2 evaluation result: ${ + (await evaluation).result.result.value}`); + }, + async function testInstrumentationStopResumesWithOtherSessions() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + + InspectorTest.log('Created two sessions.'); + + // Enter instrumentation pause. + const paused1 = Protocol1.Debugger.oncePaused(); + Protocol1.Runtime.evaluate({expression: 'null'}) + InspectorTest.log(`Session 1 paused (${(await paused1).params.reason})`); + + // Start evaluation in session 2. + const evaluation = Protocol2.Runtime.evaluate({expression: '42'}); + + // Stop the first session. + const onResume2 = Protocol2.Debugger.onceResumed(); + session1.stop(); + InspectorTest.log('Stopped session 1'); + + await onResume2; + InspectorTest.log('Resumed session 2'); + + // Make sure the second session gets the evaluation result. + InspectorTest.log(`Session 2 evaluation result: ${ + (await evaluation).result.result.value}`); + }, + async function testInstrumentationPauseAndNormalPause() { + // Initialize two debugger sessions - one with instrumentation + // breakpoints, one without. + let contextGroup = new InspectorTest.ContextGroup(); + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + Protocol1.Debugger.enable(); + await Protocol1.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + + const session2 = contextGroup.connect(); + const Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + + InspectorTest.log('Created two sessions.'); + + // Enter instrumentation pause. + const paused1 = Protocol1.Debugger.oncePaused(); + const instrumentationPaused2 = Protocol2.Debugger.oncePaused(); + const evaluation = Protocol1.Runtime.evaluate({expression: '42'}) + InspectorTest.log(`Session 1 paused (${(await paused1).params.reason})`); + InspectorTest.log( + `Session 2 paused (${(await instrumentationPaused2).params.reason})`); + + await Protocol2.Debugger.pause(); + InspectorTest.log('Session 2 pause requested'); + await Protocol1.Debugger.resume(); + InspectorTest.log('Session 1 instrumentation resume requested'); + + // Check that the second session pauses and resumes correctly. + const userPaused2 = Protocol1.Debugger.oncePaused(); + InspectorTest.log( + `Session 2 paused (${(await userPaused2).params.reason})`); + + const resumed2 = Protocol2.Debugger.onceResumed(); + Protocol2.Debugger.resume(); + await resumed2; + InspectorTest.log('Session 2 resumed'); + + InspectorTest.log(`Session 1 evaluation result: ${ + (await evaluation).result.result.value}`); + } +]); diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt index 1bdef8231b..60fa264522 100644 --- a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt +++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt @@ -384,6 +384,11 @@ expression: /123/ type : boolean value : false } +{ + name : unicodeSets + type : boolean + value : false +} expression: ({}) diff --git a/deps/v8/test/inspector/debugger/pause-on-instrumentation-expected.txt b/deps/v8/test/inspector/debugger/pause-on-instrumentation-expected.txt index 0a24b69c8f..67dda7889d 100644 --- a/deps/v8/test/inspector/debugger/pause-on-instrumentation-expected.txt +++ b/deps/v8/test/inspector/debugger/pause-on-instrumentation-expected.txt @@ -8,3 +8,9 @@ Resumed. Paused at foo.js with reason "other". Resumed. Done. + +Running test: testInstrumentationRemoveDuringInstrumentationPause +Paused at with reason "instrumentation". +Removed instrumentation breakpoint +Resumed +Evaluation result: 42 diff --git a/deps/v8/test/inspector/debugger/pause-on-instrumentation.js b/deps/v8/test/inspector/debugger/pause-on-instrumentation.js index d3b22eaaf8..cde65195fc 100644 --- a/deps/v8/test/inspector/debugger/pause-on-instrumentation.js +++ b/deps/v8/test/inspector/debugger/pause-on-instrumentation.js @@ -53,4 +53,27 @@ async function testPauseDuringInstrumentationPause() { await Protocol.Debugger.disable(); } -InspectorTest.runAsyncTestSuite([testPauseDuringInstrumentationPause]); +async function testInstrumentationRemoveDuringInstrumentationPause() { + await Protocol.Runtime.enable(); + await Protocol.Debugger.enable(); + + const {result: {breakpointId}} = + await Protocol.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const pause = Protocol.Debugger.oncePaused(); + Protocol.Runtime.evaluate({expression: 'console.log(\'Hi\')'}); + logPause(await pause); + await Protocol.Debugger.removeBreakpoint({breakpointId}); + InspectorTest.log('Removed instrumentation breakpoint'); + await Protocol.Debugger.resume(); + InspectorTest.log('Resumed'); + + const {result: {result: {value}}} = + await Protocol.Runtime.evaluate({expression: '42'}); + InspectorTest.log(`Evaluation result: ${value}`); +} + +InspectorTest.runAsyncTestSuite([ + testPauseDuringInstrumentationPause, + testInstrumentationRemoveDuringInstrumentationPause +]); diff --git a/deps/v8/test/inspector/debugger/restore-breakpoint-expected.txt b/deps/v8/test/inspector/debugger/restore-breakpoint-expected.txt index ac23487bf8..3de4c54f79 100644 --- a/deps/v8/test/inspector/debugger/restore-breakpoint-expected.txt +++ b/deps/v8/test/inspector/debugger/restore-breakpoint-expected.txt @@ -8,6 +8,79 @@ function foo() { #boo(); } +Running test: testSameSourceDuplicateLines +function foo() { +boo(); +// something +#boo(); +} +function foo() { +boo(); +// something +#boo(); +} + +Running test: testSameSourceDuplicateLinesLongLineBetween +function foo() { +boo(); +/////////////////////////////////////////////////////////////////////////////... +#boo(); +} +function foo() { +boo(); +/////////////////////////////////////////////////////////////////////////////... +#boo(); +} + +Running test: testSameSourceLongCommentBefore +/////////////////////////////////////////////////////////////////////////////... +function foo() { +bad(); +#boo(); +} +/////////////////////////////////////////////////////////////////////////////... +function foo() { +bad(); +#boo(); +} + +Running test: testInsertNewLineWithLongCommentBefore +/////////////////////////////////////////////////////////////////////////////... +function foo() { +boo(); +#boo(); +} +/////////////////////////////////////////////////////////////////////////////... +function foo() { +boo(); + +#boo(); +} + +Running test: testSameSourceBreakAfterReturnWithWhitespace +function baz() { +} + +function foo() { +return 1;# } +function baz() { +} + +function foo() { +return 1;# } + +Running test: testSameSourceDuplicateLinesDifferentPrefix +function foo() { +boo(); +// something +#boo(); +} +function foo() { +#boo(); +// somethinX +boo(); +} + Running test: testOneLineOffset function foo() { #boo(); diff --git a/deps/v8/test/inspector/debugger/restore-breakpoint.js b/deps/v8/test/inspector/debugger/restore-breakpoint.js index 020143f6d1..809f609150 100644 --- a/deps/v8/test/inspector/debugger/restore-breakpoint.js +++ b/deps/v8/test/inspector/debugger/restore-breakpoint.js @@ -9,31 +9,68 @@ var finishedTests = 0; InspectorTest.runTestSuite([ function testSameSource(next) { var source = 'function foo() {\nboo();\n}'; - test(source, source, { lineNumber: 1, columnNumber: 0 }, next); + test(source, source, {lineNumber: 1, columnNumber: 0}, next); + }, + + function testSameSourceDuplicateLines(next) { + var source = 'function foo() {\nboo();\n// something\nboo();\n}'; + test(source, source, {lineNumber: 2, columnNumber: 0}, next); + }, + + function testSameSourceDuplicateLinesLongLineBetween(next) { + var longComment = '/'.repeat(1e4); + var source = `function foo() {\nboo();\n${longComment}\nboo();\n}`; + test(source, source, {lineNumber: 2, columnNumber: 0}, next); + }, + + function testSameSourceLongCommentBefore(next) { + var longComment = '/'.repeat(1e3); + var source = `${longComment}\nfunction foo() {\nbad();\nboo();\n}`; + test(source, source, {lineNumber: 3, columnNumber: 0}, next); + }, + + function testInsertNewLineWithLongCommentBefore(next) { + var longComment = '/'.repeat(1e3); + var source = `${longComment}\nfunction foo() {\nboo();\nboo();\n}`; + var newSource = `${longComment}\nfunction foo() {\nboo();\n\nboo();\n}`; + test(source, newSource, {lineNumber: 3, columnNumber: 0}, next); + }, + + function testSameSourceBreakAfterReturnWithWhitespace(next) { + var whitespace = ' '.repeat(30); + var source = + `function baz() {\n}\n\nfunction foo() {\nreturn 1;${whitespace}}`; + test(source, source, {lineNumber: 4, columnNumber: 9}, next); + }, + + function testSameSourceDuplicateLinesDifferentPrefix(next) { + var source = 'function foo() {\nboo();\n// something\nboo();\n}'; + var newSource = 'function foo() {\nboo();\n// somethinX\nboo();\n}'; + test(source, newSource, {lineNumber: 2, columnNumber: 0}, next); }, function testOneLineOffset(next) { var source = 'function foo() {\nboo();\n}'; var newSource = 'function foo() {\nboo();\nboo();\n}'; - test(source, newSource, { lineNumber: 1, columnNumber: 0 }, next); + test(source, newSource, {lineNumber: 1, columnNumber: 0}, next); }, function testTwoSimilarLinesCloseToOriginalLocation1(next) { var source = 'function foo() {\n\n\nboo();\n}'; var newSource = 'function foo() {\nboo();\n\nnewCode();\nboo();\n\n\n\nboo();\n}'; - test(source, newSource, { lineNumber: 3, columnNumber: 0 }, next); + test(source, newSource, {lineNumber: 3, columnNumber: 0}, next); }, function testTwoSimilarLinesCloseToOriginalLocation2(next) { var source = 'function foo() {\n\n\nboo();\n}'; var newSource = 'function foo() {\nboo();\nnewLongCode();\nnewCode();\nboo();\n\n\n\nboo();\n}'; - test(source, newSource, { lineNumber: 3, columnNumber: 0 }, next); + test(source, newSource, {lineNumber: 3, columnNumber: 0}, next); }, function testHintIgnoreWhiteSpaces(next) { var source = 'function foo() {\n\n\n\nboo();\n}'; var newSource = 'function foo() {\nfoo();\n\n\nboo();\n}'; - test(source, newSource, { lineNumber: 1, columnNumber: 0 }, next); + test(source, newSource, {lineNumber: 1, columnNumber: 0}, next); }, function testCheckOnlyLimitedOffsets(next) { diff --git a/deps/v8/test/inspector/debugger/session-stop-expected.txt b/deps/v8/test/inspector/debugger/session-stop-expected.txt new file mode 100644 index 0000000000..9896c36f38 --- /dev/null +++ b/deps/v8/test/inspector/debugger/session-stop-expected.txt @@ -0,0 +1,20 @@ +Checks V8InspectorSession::stop + +Running test: testSessionStopResumesPause +Evaluation returned: 42 + +Running test: testSessionStopResumesInstrumentationPause +Paused: instrumentation +Evaluation returned: 42 + +Running test: testSessionStopDisablesDebugger +Pause error(?): Debugger agent is not enabled + +Running test: testSessionStopDisallowsReenabling +Pause error(?) after stop: Debugger agent is not enabled +Pause error(?) after re-enable: Debugger agent is not enabled + +Running test: testSessionStopDoesNotDisableOtherSessions +Session 1 pause error after stop: Debugger agent is not enabled +Session 2 paused: other +Session 2 evaluation: 42
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/session-stop.js b/deps/v8/test/inspector/debugger/session-stop.js new file mode 100644 index 0000000000..5c667ee93d --- /dev/null +++ b/deps/v8/test/inspector/debugger/session-stop.js @@ -0,0 +1,86 @@ +// 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.log('Checks V8InspectorSession::stop'); + +InspectorTest.runAsyncTestSuite([ + async function testSessionStopResumesPause() { + let contextGroup = new InspectorTest.ContextGroup(); + let session = contextGroup.connect(); + let Protocol = session.Protocol; + + Protocol.Debugger.enable(); + await Protocol.Debugger.pause(); + const result = Protocol.Runtime.evaluate({expression: '42'}); + session.stop(); + InspectorTest.log( + `Evaluation returned: ${(await result).result.result.value}`); + }, + async function testSessionStopResumesInstrumentationPause() { + let contextGroup = new InspectorTest.ContextGroup(); + let session = contextGroup.connect(); + let Protocol = session.Protocol; + + Protocol.Debugger.enable(); + await Protocol.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'}); + const paused = Protocol.Debugger.oncePaused(); + const result = Protocol.Runtime.evaluate({expression: '42'}); + InspectorTest.log(`Paused: ${(await paused).params.reason}`); + session.stop(); + InspectorTest.log( + `Evaluation returned: ${(await result).result.result.value}`); + }, + async function testSessionStopDisablesDebugger() { + let contextGroup = new InspectorTest.ContextGroup(); + let session = contextGroup.connect(); + let Protocol = session.Protocol; + + await Protocol.Debugger.enable(); + session.stop(); + const pauseResult = await Protocol.Debugger.pause(); + InspectorTest.log(`Pause error(?): ${pauseResult?.error?.message}`); + }, + async function testSessionStopDisallowsReenabling() { + let contextGroup = new InspectorTest.ContextGroup(); + let session = contextGroup.connect(); + let Protocol = session.Protocol; + + await Protocol.Debugger.enable(); + session.stop(); + const pauseResultAfterStop = await Protocol.Debugger.pause(); + InspectorTest.log( + `Pause error(?) after stop: ${pauseResultAfterStop?.error?.message}`); + await Protocol.Debugger.enable(); + const pauseResult = await Protocol.Debugger.pause(); + InspectorTest.log( + `Pause error(?) after re-enable: ${pauseResult?.error?.message}`); + }, + async function testSessionStopDoesNotDisableOtherSessions() { + let contextGroup = new InspectorTest.ContextGroup(); + + let session1 = contextGroup.connect(); + let Protocol1 = session1.Protocol; + await Protocol1.Debugger.enable(); + + let session2 = contextGroup.connect(); + let Protocol2 = session2.Protocol; + await Protocol2.Debugger.enable(); + + session1.stop(); + const pauseResult1 = await Protocol1.Debugger.pause(); + InspectorTest.log( + `Session 1 pause error after stop: ${pauseResult1?.error?.message}`); + + await Protocol2.Debugger.pause(); + + const paused = Protocol2.Debugger.oncePaused(); + const result = Protocol2.Runtime.evaluate({expression: '42'}); + InspectorTest.log(`Session 2 paused: ${(await paused).params.reason}`); + await Protocol2.Debugger.resume(); + + InspectorTest.log( + `Session 2 evaluation: ${(await result).result.result.value}`); + }, +]); diff --git a/deps/v8/test/inspector/debugger/set-breakpoints-active-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoints-active-expected.txt new file mode 100644 index 0000000000..1e9009350e --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoints-active-expected.txt @@ -0,0 +1,36 @@ +Tests for set-breakpoints-active + +Running test: testDeactivatedBreakpointsAfterReconnect +Breakpoints activated. +Paused. (reason: other) +Debugger break executed. +Breakpoints deactivated. +Reconnected. +Debugger break executed. + +Running test: testDeactivatedBreakpointsAfterDisableEnable +Breakpoints activated. +Paused. (reason: other) +Debugger break executed. +Breakpoints deactivated. +Disabled. +Enabled. +Debugger break executed. + +Running test: testDeactivateBreakpointsWhileDisabled +Breakpoints activated. +Paused. (reason: other) +Debugger break executed. +Disabled. +Breakpoints deactivated. +Enabled. +Debugger break executed. + +Running test: testActivateBreakpointsWhileDisabled +Breakpoints deactivated. +Debugger break executed. +Disabled. +Breakpoints activated. +Enabled. +Paused. (reason: other) +Debugger break executed. diff --git a/deps/v8/test/inspector/debugger/set-breakpoints-active.js b/deps/v8/test/inspector/debugger/set-breakpoints-active.js new file mode 100644 index 0000000000..40dc4beb11 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoints-active.js @@ -0,0 +1,69 @@ +// 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. + +let {session, Protocol} = + InspectorTest.start('Tests for set-breakpoints-active'); + +Protocol.Debugger.enable(); +Protocol.Debugger.onPaused(({params}) => { + InspectorTest.log(`Paused. (reason: ${params.reason})`); + Protocol.Debugger.resume(); +}); + +InspectorTest.runAsyncTestSuite([ + async function testDeactivatedBreakpointsAfterReconnect() { + await Protocol.Debugger.setBreakpointsActive({active: true}); + InspectorTest.log('Breakpoints activated.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + await Protocol.Debugger.setBreakpointsActive({active: false}); + InspectorTest.log('Breakpoints deactivated.'); + session.reconnect(); + InspectorTest.log('Reconnected.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + }, + async function testDeactivatedBreakpointsAfterDisableEnable() { + await Protocol.Debugger.setBreakpointsActive({active: true}); + InspectorTest.log('Breakpoints activated.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + await Protocol.Debugger.setBreakpointsActive({active: false}); + InspectorTest.log('Breakpoints deactivated.'); + await Protocol.Debugger.disable(); + InspectorTest.log('Disabled.'); + await Protocol.Debugger.enable(); + InspectorTest.log('Enabled.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + }, + async function testDeactivateBreakpointsWhileDisabled() { + await Protocol.Debugger.setBreakpointsActive({active: true}); + InspectorTest.log('Breakpoints activated.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + await Protocol.Debugger.disable(); + InspectorTest.log('Disabled.'); + await Protocol.Debugger.setBreakpointsActive({active: false}); + InspectorTest.log('Breakpoints deactivated.'); + await Protocol.Debugger.enable(); + InspectorTest.log('Enabled.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + }, + async function testActivateBreakpointsWhileDisabled() { + await Protocol.Debugger.setBreakpointsActive({active: false}); + InspectorTest.log('Breakpoints deactivated.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + await Protocol.Debugger.disable(); + InspectorTest.log('Disabled.'); + await Protocol.Debugger.setBreakpointsActive({active: true}); + InspectorTest.log('Breakpoints activated.'); + await Protocol.Debugger.enable(); + InspectorTest.log('Enabled.'); + await Protocol.Runtime.evaluate({expression: 'debugger'}); + InspectorTest.log('Debugger break executed.'); + }, +]); diff --git a/deps/v8/test/inspector/debugger/set-script-source-es-module-expected.txt b/deps/v8/test/inspector/debugger/set-script-source-es-module-expected.txt new file mode 100644 index 0000000000..152643a9c5 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source-es-module-expected.txt @@ -0,0 +1,9 @@ +Test that live editing the top-level function of an ES module does not work [crbug.com/1413447] +Uncommenting the import line should fail: +{ + status : BlockedByTopLevelEsModuleChange +} +Uncommenting the console.log line should work: +{ + status : Ok +} diff --git a/deps/v8/test/inspector/debugger/set-script-source-es-module.js b/deps/v8/test/inspector/debugger/set-script-source-es-module.js new file mode 100644 index 0000000000..a307c78658 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source-es-module.js @@ -0,0 +1,37 @@ +// 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( + 'Test that live editing the top-level function of an ES module does not work [crbug.com/1413447]'); + +const inputSnippet = ` +//$1 import {b} from "./b.js"; + +export function foo() { + console.log('foo'); +} + +export function bar() { + //$2 console.log('bar'); +} +`; + +(async () => { + await Protocol.Debugger.enable(); + + contextGroup.addModule(inputSnippet, 'a.js', 3, 8); + const { params: { scriptId } } = await Protocol.Debugger.onceScriptParsed(); + + InspectorTest.log('Uncommenting the import line should fail:'); + const changedTopLevelModule = inputSnippet.replace('//$1 ', ''); + const response1 = await Protocol.Debugger.setScriptSource({ scriptId, scriptSource: changedTopLevelModule }); + InspectorTest.logMessage(response1.result); + + InspectorTest.log('Uncommenting the console.log line should work:'); + const changedFunction = inputSnippet.replace('//$2 ', ''); + const response2 = await Protocol.Debugger.setScriptSource({ scriptId, scriptSource: changedFunction }); + InspectorTest.logMessage(response2.result); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/set-script-source-top-frame-expected.txt b/deps/v8/test/inspector/debugger/set-script-source-top-frame-expected.txt index 8f39a070fd..88a6cde245 100644 --- a/deps/v8/test/inspector/debugger/set-script-source-top-frame-expected.txt +++ b/deps/v8/test/inspector/debugger/set-script-source-top-frame-expected.txt @@ -6,7 +6,7 @@ function testExpression(a, b) { Paused at (after live edit): function testExpression(a, b) { - return a * b;# + #return a * b; } Result: diff --git a/deps/v8/test/inspector/debugger/suspended-generator-scopes.js b/deps/v8/test/inspector/debugger/suspended-generator-scopes.js index 4ed4796583..55a1fd57ca 100644 --- a/deps/v8/test/inspector/debugger/suspended-generator-scopes.js +++ b/deps/v8/test/inspector/debugger/suspended-generator-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('Tests that suspended generators produce scopes'); contextGroup.addScript(` diff --git a/deps/v8/test/inspector/debugger/wasm-gc-anyref-expected.txt b/deps/v8/test/inspector/debugger/wasm-gc-anyref-expected.txt index 4b627d5372..37585580b9 100644 --- a/deps/v8/test/inspector/debugger/wasm-gc-anyref-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-gc-anyref-expected.txt @@ -8,31 +8,32 @@ Module instantiated. Tables populated. Setting breakpoint { - columnNumber : 246 + columnNumber : 316 lineNumber : 0 scriptId : <scriptId> } Paused: -Script wasm://wasm/739f5f0a byte offset 246: Wasm opcode 0x01 (kExprNop) +Script wasm://wasm/2633f626 byte offset 316: Wasm opcode 0x01 (kExprNop) Scope: -at $main (0:246): +at $main (0:316): - scope (wasm-expression-stack): stack: - scope (local): $anyref_local: Struct ((ref $type0)) $anyref_local2: Array ((ref $type1)) - $anyref_local_i31: null (anyref) + $anyref_local_i31: 30 (anyref) $anyref_local_null: null (anyref) - scope (module): - instance: exports: "exported_ref_table" (Table), "exported_func_table" (Table), "fill_tables" (Function), "main" (Function) + instance: exports: "exported_ref_table" (Table), "exported_func_table" (Table), "exported_i31_table" (Table), "fill_tables" (Function), "main" (Function) module: Module functions: "$my_func": (Function), "$fill_tables": (Function), "$main": (Function) globals: "$global0": function $my_func() { [native code] } (funcref) tables: - $import.any_table: 0: Array(2) (anyref), 1: Struct ((ref $type0)), 2: undefined (anyref) - $import.func_table: 0: function () { [native code] } (funcref), 1: function $my_func() { [native code] } (funcref), 2: undefined (funcref) - $exported_ref_table: 0: Struct ((ref $type0)), 1: Array ((ref $type1)), 2: undefined (anyref), 3: undefined (anyref) - $exported_func_table: 0: function external_fct() { [native code] } (funcref), 1: function $my_func() { [native code] } (funcref), 2: undefined (funcref) + $import.any_table: 0: Array(2) (anyref), 1: 321 (anyref), 2: null (anyref), 3: null (anyref) + $import.func_table: 0: function () { [native code] } (funcref), 1: function $my_func() { [native code] } (funcref), 2: null (funcref) + $exported_ref_table: 0: Struct ((ref $type0)), 1: Array ((ref $type1)), 2: 30 (anyref), 3: null (anyref) + $exported_func_table: 0: function external_fct() { [native code] } (funcref), 1: function $my_func() { [native code] } (funcref), 2: null (funcref) + $exported_i31_table: 0: 123456 (i31ref), 1: -123 (i31ref), 2: null (i31ref) at (anonymous) (0:17): - scope (global): -- skipped globals diff --git a/deps/v8/test/inspector/debugger/wasm-gc-anyref.js b/deps/v8/test/inspector/debugger/wasm-gc-anyref.js index 04750908cf..aa835e82e4 100644 --- a/deps/v8/test/inspector/debugger/wasm-gc-anyref.js +++ b/deps/v8/test/inspector/debugger/wasm-gc-anyref.js @@ -66,16 +66,19 @@ async function printPauseLocationsAndContinue(msg) { async function instantiateWasm() { var builder = new WasmModuleBuilder(); + builder.startRecGroup(); let struct_type = builder.addStruct([makeField(kWasmI32, false)]); let array_type = builder.addArray(kWasmI32); let imported_ref_table = - builder.addImportedTable('import', 'any_table', 3, 3, kWasmAnyRef); + builder.addImportedTable('import', 'any_table', 4, 4, kWasmAnyRef); let imported_func_table = builder.addImportedTable('import', 'func_table', 3, 3, kWasmFuncRef); let ref_table = builder.addTable(kWasmAnyRef, 4) .exportAs('exported_ref_table'); let func_table = builder.addTable(kWasmFuncRef, 3) .exportAs('exported_func_table'); + let i31ref_table = builder.addTable(kWasmI31Ref, 3) + .exportAs('exported_i31_table'); let func = builder.addFunction('my_func', kSig_v_v).addBody([kExprNop]); // Make the function "declared". @@ -88,19 +91,18 @@ async function instantiateWasm() { ...wasmI32Const(1), ...wasmI32Const(20), ...wasmI32Const(21), kGCPrefix, kExprArrayNewFixed, array_type, 2, kExprTableSet, ref_table.index, - // TODO(7748): Reactivate this test when JS interop between i31refs and - // JS SMIs is fixed. The problem right now is the 33-bit shift for i31ref - // values on non-pointer-compressed platforms, which means i31refs and - // Smis have different encodings there but it's impossible to tell them - // apart. - // ...wasmI32Const(2), ...wasmI32Const(30), - // kGCPrefix, kExprI31New, kExprTableSet, ref_table.index, + ...wasmI32Const(2), ...wasmI32Const(30), + kGCPrefix, kExprI31New, kExprTableSet, ref_table.index, // Fill imported any table. ...wasmI32Const(1), ...wasmI32Const(123), kGCPrefix, kExprStructNew, struct_type, kExprTableSet, imported_ref_table, + ...wasmI32Const(1), + ...wasmI32Const(321), kGCPrefix, kExprI31New, + kExprTableSet, imported_ref_table, + // Fill imported func table. ...wasmI32Const(1), kExprRefFunc, func.index, @@ -110,6 +112,15 @@ async function instantiateWasm() { ...wasmI32Const(1), kExprRefFunc, func.index, kExprTableSet, func_table.index, + + // Fill i31 table. + ...wasmI32Const(0), + ...wasmI32Const(123456), kGCPrefix, kExprI31New, + kExprTableSet, i31ref_table.index, + + ...wasmI32Const(1), + ...wasmI32Const(-123), kGCPrefix, kExprI31New, + kExprTableSet, i31ref_table.index, ]).exportFunc(); let body = [ @@ -121,12 +132,9 @@ async function instantiateWasm() { ...wasmI32Const(21), kGCPrefix, kExprArrayNewFixed, array_type, 1, kExprLocalSet, 1, - // Set local anyref_local_i31. - // TODO(7748): Reactivate this test when JS interop between i31refs and JS - // SMIs is fixed (same issue as above). - // ...wasmI32Const(30), - // kGCPrefix, kExprI31New, - // kExprLocalSet, 2, + ...wasmI32Const(30), + kGCPrefix, kExprI31New, + kExprLocalSet, 2, kExprNop, ]; let main = builder.addFunction('main', kSig_v_v) @@ -136,7 +144,7 @@ async function instantiateWasm() { .addLocals(kWasmAnyRef, 1, ['anyref_local_null']) .addBody(body) .exportFunc(); - + builder.endRecGroup(); var module_bytes = builder.toArray(); breakpointLocation = main.body_offset + body.length - 1; @@ -144,7 +152,7 @@ async function instantiateWasm() { let imports = `{'import' : { 'any_table': (() => { let js_table = - new WebAssembly.Table({element: 'anyref', initial: 3, maximum: 3}); + new WebAssembly.Table({element: 'anyref', initial: 4, maximum: 4}); js_table.set(0, ['JavaScript', 'value']); return js_table; })(), diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt index 3db7ebda51..f7e758bf41 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt @@ -15,7 +15,7 @@ Script wasm://wasm/e33badc2 byte offset 169: Wasm opcode 0x20 (kExprLocalGet) Scope: at $C (interpreted) (0:169): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $i32_arg: 42 (i32) $i32_local: 0 (i32) @@ -26,8 +26,8 @@ at $C (interpreted) (0:169): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $B (liftoff) (0:158): - scope (wasm-expression-stack): stack: "0": 42 (i32), "1": 3 (i32) @@ -44,11 +44,11 @@ at $B (liftoff) (0:158): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -57,8 +57,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -79,8 +79,8 @@ at $C (interpreted) (0:171): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $B (liftoff) (0:158): - scope (wasm-expression-stack): stack: "0": 42 (i32), "1": 3 (i32) @@ -97,11 +97,11 @@ at $B (liftoff) (0:158): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -110,8 +110,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 0 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -121,7 +121,7 @@ Script wasm://wasm/e33badc2 byte offset 173: Wasm opcode 0x41 (kExprI32Const) Scope: at $C (interpreted) (0:173): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $i32_arg: 42 (i32) $i32_local: 0 (i32) @@ -132,8 +132,8 @@ at $C (interpreted) (0:173): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $B (liftoff) (0:158): - scope (wasm-expression-stack): stack: "0": 42 (i32), "1": 3 (i32) @@ -150,11 +150,11 @@ at $B (liftoff) (0:158): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -163,8 +163,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -185,8 +185,8 @@ at $C (interpreted) (0:175): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $B (liftoff) (0:158): - scope (wasm-expression-stack): stack: "0": 42 (i32), "1": 3 (i32) @@ -203,11 +203,11 @@ at $B (liftoff) (0:158): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -216,8 +216,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -227,7 +227,7 @@ Script wasm://wasm/e33badc2 byte offset 177: Wasm opcode 0x0b (kExprEnd) Scope: at $C (interpreted) (0:177): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $i32_arg: 42 (i32) $i32_local: 47 (i32) @@ -238,8 +238,8 @@ at $C (interpreted) (0:177): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $B (liftoff) (0:158): - scope (wasm-expression-stack): stack: "0": 42 (i32), "1": 3 (i32) @@ -256,11 +256,11 @@ at $B (liftoff) (0:158): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -269,8 +269,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -294,11 +294,11 @@ at $B (liftoff) (0:160): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -307,8 +307,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -332,11 +332,11 @@ at $B (liftoff) (0:161): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -345,8 +345,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -356,7 +356,7 @@ Script wasm://wasm/e33badc2 byte offset 162: Wasm opcode 0x0b (kExprEnd) Scope: at $B (liftoff) (0:162): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $i32_arg: 42 (i32) $i32_local: 0 (i32) @@ -370,11 +370,11 @@ at $B (liftoff) (0:162): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at $A (liftoff) (0:128): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -383,8 +383,8 @@ at $A (liftoff) (0:128): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -394,7 +394,7 @@ Script wasm://wasm/e33badc2 byte offset 130: Wasm opcode 0x0b (kExprEnd) Scope: at $A (liftoff) (0:130): - scope (wasm-expression-stack): - stack: + stack: - scope (local): $var0: 42 (i32) - scope (module): @@ -403,8 +403,8 @@ at $A (liftoff) (0:130): functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) globals: "$exported_global": 42 (i32) memories: "$exported_memory": (Memory) - tables: - $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: undefined (funcref), 3: function $A (liftoff)() { [native code] } (funcref) + tables: + $exported_table: 0: function js_func() { [native code] } (funcref), 1: function () { [native code] } (funcref), 2: null (funcref), 3: function $A (liftoff)() { [native code] } (funcref) at (anonymous) (0:17): - scope (global): -- skipped globals diff --git a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt index dd9a73bd45..7fe4f19bc6 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt @@ -3,8 +3,8 @@ Running testFunction with generated wasm bytes... Paused on 'debugger;' Number of frames: 5 - [0] {"functionName":"call_debugger","function_lineNumber":1,"function_columnNumber":24,"lineNumber":2,"columnNumber":4} - - [1] {"functionName":"$call_func","lineNumber":0,"columnNumber":55} - - [2] {"functionName":"$main","lineNumber":0,"columnNumber":62} + - [1] {"functionName":"$call_func","function_lineNumber":0,"function_columnNumber":54,"lineNumber":0,"columnNumber":55} + - [2] {"functionName":"$main","function_lineNumber":0,"function_columnNumber":59,"lineNumber":0,"columnNumber":62} - [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":14,"columnNumber":19} - [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0} Getting v8-generated stack trace... diff --git a/deps/v8/test/inspector/debugger/wasm-step-a-lot.js b/deps/v8/test/inspector/debugger/wasm-step-a-lot.js index e6e57830e0..4eee55bcdc 100644 --- a/deps/v8/test/inspector/debugger/wasm-step-a-lot.js +++ b/deps/v8/test/inspector/debugger/wasm-step-a-lot.js @@ -4,7 +4,7 @@ // Lower the maximum code space size to detect missed garbage collection // earlier. -// Flags: --wasm-max-code-space=2 +// Flags: --wasm-max-committed-code-mb=2 utils.load('test/inspector/wasm-inspector-test.js'); |