Upload Kmake

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

View File

@ -0,0 +1,13 @@
Tests console.clear() does not clear timers
{
type : string
value : console.clear
}
{
type : string
value : a: <number> ms
}
{
type : string
value : End of test
}

View File

@ -0,0 +1,25 @@
// Copyright 2024 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('Tests console.clear() does not clear timers');
const expression = `
console.time("a");
console.clear();
console.timeEnd("a");
console.log("End of test");
`;
Protocol.Runtime.enable();
Protocol.Runtime.evaluate({ expression: expression });
Protocol.Runtime.onConsoleAPICalled(function(result) {
let message = result.params.args[0];
if (message.value == "End of test") {
InspectorTest.completeTest();
}
message.value = message.value.replaceAll(/[0-9]*\.[0-9]+|[0-9]+/g, '<number>');
InspectorTest.logObject(message);
});

View File

@ -0,0 +1,9 @@
Tests that destroying context from inside of console.log does not crash
{
type : string
value : First inspector activity after attaching inspector
}
{
type : string
value : End of test
}

View File

@ -0,0 +1,42 @@
// Copyright 2016 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('Tests that destroying context from inside of console.log does not crash');
const expression = `
Object.defineProperty(Object.prototype, 'RemoteObject', {
configurable: true,
set(v) {
console.log("Should never be called");
delete Object.prototype.RemoteObject;
this.RemoteObject = v;
inspector.fireContextDestroyed();
setTimeout(function() {
// Attach the inspector again for the sake of establishing a
// communication channel with the frontend test runner.
inspector.fireContextCreated();
console.log("End of test");
}, 0);
},
});
// Before the whole script runs, the inspector is already attached.
// Re-attach the inspector and trigger the console API to make sure that the
// injected inspector script runs again (and triggers the above setter).
inspector.fireContextDestroyed();
inspector.fireContextCreated();
console.log("First inspector activity after attaching inspector");
console.log("End of test");
`;
Protocol.Runtime.enable();
Protocol.Runtime.evaluate({ expression: expression });
Protocol.Runtime.onConsoleAPICalled(function(result) {
InspectorTest.logObject(result.params.args[0]);
if (result.params.args[0].value == "End of test") {
InspectorTest.completeTest();
}
});

View File

@ -0,0 +1,41 @@
Tests scoped variable in Runtime.evaluate
Evaluating 'let a = 42;'
{
type : undefined
}
Evaluating 'a'
{
description : 42
type : number
value : 42
}
Evaluating 'let a = 239;'
{
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Identifier 'a' has already been declared
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Identifier 'a' has already been declared
objectId : <objectId>
subtype : error
type : object
}
}
Evaluating 'a'
{
description : 42
type : number
value : 42
}

View File

@ -0,0 +1,26 @@
// Copyright 2016 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('Tests scoped variable in Runtime.evaluate');
(async function test() {
InspectorTest.log('Evaluating \'let a = 42;\'');
var {result:{result}} = await Protocol.Runtime.evaluate({
expression:'let a = 42;'});
InspectorTest.logMessage(result);
InspectorTest.log('Evaluating \'a\'');
var {result:{result}} = await Protocol.Runtime.evaluate({
expression:'a'});
InspectorTest.logMessage(result);
InspectorTest.log('Evaluating \'let a = 239;\'');
var {result} = await Protocol.Runtime.evaluate({
expression:'let a = 239;'});
InspectorTest.logMessage(result);
InspectorTest.log('Evaluating \'a\'');
var {result:{result}} = await Protocol.Runtime.evaluate({
expression:'a'});
InspectorTest.logMessage(result);
InspectorTest.completeTest();
})();

View File

@ -0,0 +1,145 @@
Stack tagging API works
Running test: simpleTaskLogsCorrectAsyncTrace
---------- console.trace: Inside run ----------
runner (simpleTaskLogsCorrectAsyncTrace.js:4:14)
simpleTaskLogsCorrectAsyncTrace (simpleTaskLogsCorrectAsyncTrace.js:3:9)
(anonymous) (simpleTaskLogsCorrectAsyncTrace.js:6:4)
-- Task --
foo (simpleTaskLogsCorrectAsyncTrace.js:1:36)
simpleTaskLogsCorrectAsyncTrace (simpleTaskLogsCorrectAsyncTrace.js:2:17)
(anonymous) (simpleTaskLogsCorrectAsyncTrace.js:6:4)
Running test: nestedTasksLogCorrectAsyncTrace
---------- console.trace: Inside runInner ----------
runInner (nestedTasksLogCorrectAsyncTrace.js:5:16)
runOuter (nestedTasksLogCorrectAsyncTrace.js:4:16)
nestedTasksLogCorrectAsyncTrace (nestedTasksLogCorrectAsyncTrace.js:2:14)
(anonymous) (nestedTasksLogCorrectAsyncTrace.js:8:4)
-- Inner Task --
runOuter (nestedTasksLogCorrectAsyncTrace.js:3:32)
nestedTasksLogCorrectAsyncTrace (nestedTasksLogCorrectAsyncTrace.js:2:14)
(anonymous) (nestedTasksLogCorrectAsyncTrace.js:8:4)
-- Outer Task --
nestedTasksLogCorrectAsyncTrace (nestedTasksLogCorrectAsyncTrace.js:1:30)
(anonymous) (nestedTasksLogCorrectAsyncTrace.js:8:4)
Running test: setTimeoutWorksCorrectly
---------- console.trace: Inside runInner ----------
runInner (setTimeoutWorksCorrectly.js:6:18)
(anonymous) (setTimeoutWorksCorrectly.js:5:18)
-- Inner Task --
(anonymous) (setTimeoutWorksCorrectly.js:4:34)
-- setTimeout --
(anonymous) (setTimeoutWorksCorrectly.js:3:30)
runOuter (setTimeoutWorksCorrectly.js:3:13)
setTimeoutWorksCorrectly (setTimeoutWorksCorrectly.js:2:20)
(anonymous) (setTimeoutWorksCorrectly.js:11:4)
-- Outer Task --
setTimeoutWorksCorrectly (setTimeoutWorksCorrectly.js:1:30)
(anonymous) (setTimeoutWorksCorrectly.js:11:4)
Running test: runForwardsTheReturnValue
---------- console.log: 42 ----------
runForwardsTheReturnValue (runForwardsTheReturnValue.js:3:12)
(anonymous) (runForwardsTheReturnValue.js:4:4)
Running test: runWorksWithAsyncPayloads
---------- console.log: 42 ----------
runWorksWithAsyncPayloads (runWorksWithAsyncPayloads.js:3:12)
Running test: runWorksWithGenerators
---------- console.log: 42 ----------
runWorksWithGenerators (runWorksWithGenerators.js:3:12)
(anonymous) (runWorksWithGenerators.js:4:4)
Running test: runCanBeCalledMultipleTimes
---------- console.log: First run ----------
(anonymous) (runCanBeCalledMultipleTimes.js:2:27)
runCanBeCalledMultipleTimes (runCanBeCalledMultipleTimes.js:2:9)
(anonymous) (runCanBeCalledMultipleTimes.js:4:4)
---------- console.log: Second run ----------
(anonymous) (runCanBeCalledMultipleTimes.js:3:27)
runCanBeCalledMultipleTimes (runCanBeCalledMultipleTimes.js:3:9)
(anonymous) (runCanBeCalledMultipleTimes.js:4:4)
Running test: runForwardsExceptions
Expected exception:
{
className : Error
description : Error: Thrown from task.run at runForwardsExceptions.js:4:13 at runForwardsExceptions (runForwardsExceptions.js:3:10) at runForwardsExceptions.js:6:5
objectId : <objectId>
subtype : error
type : object
}
Running test: recursivelyCalledRunDoesntCrash
---------- console.trace: Inside nestedRunOuter ----------
nestedRunOuter (recursivelyCalledRunDoesntCrash.js:6:18)
runInner (recursivelyCalledRunDoesntCrash.js:5:18)
runOuter (recursivelyCalledRunDoesntCrash.js:4:16)
recursivelyCalledRunDoesntCrash (recursivelyCalledRunDoesntCrash.js:2:14)
(anonymous) (recursivelyCalledRunDoesntCrash.js:10:4)
-- Outer Task --
recursivelyCalledRunDoesntCrash (recursivelyCalledRunDoesntCrash.js:1:30)
(anonymous) (recursivelyCalledRunDoesntCrash.js:10:4)
Running test: scheduleThrowsAnErrorWhenCalledWithoutAnArgument
Expected exception:
{
className : Error
description : Error: First argument must be a non-empty string. at scheduleThrowsAnErrorWhenCalledWithoutAnArgument (scheduleThrowsAnErrorWhenCalledWithoutAnArgument.js:2:13) at scheduleThrowsAnErrorWhenCalledWithoutAnArgument.js:3:5
objectId : <objectId>
subtype : error
type : object
}
Running test: scheduleThrowsAnErrorWhenCalledWithAnEmptyString
Expected exception:
{
className : Error
description : Error: First argument must be a non-empty string. at scheduleThrowsAnErrorWhenCalledWithAnEmptyString (scheduleThrowsAnErrorWhenCalledWithAnEmptyString.js:2:13) at scheduleThrowsAnErrorWhenCalledWithAnEmptyString.js:3:5
objectId : <objectId>
subtype : error
type : object
}
Running test: runThrowsAnErrorWhenCalledWithoutAnArgument
Expected exception:
{
className : Error
description : Error: First argument must be a function. at runThrowsAnErrorWhenCalledWithoutAnArgument (runThrowsAnErrorWhenCalledWithoutAnArgument.js:3:10) at runThrowsAnErrorWhenCalledWithoutAnArgument.js:4:5
objectId : <objectId>
subtype : error
type : object
}
Running test: runThrowsAnErrorWhenCalledWithNonFunction
Expected exception:
{
className : Error
description : Error: First argument must be a function. at runThrowsAnErrorWhenCalledWithNonFunction (runThrowsAnErrorWhenCalledWithNonFunction.js:3:10) at runThrowsAnErrorWhenCalledWithNonFunction.js:4:5
objectId : <objectId>
subtype : error
type : object
}
Running test: runThrowsAnErrorWhenCalledWithNullReceiver
Expected exception:
{
className : Error
description : Error: 'run' called with illegal receiver. at runThrowsAnErrorWhenCalledWithNullReceiver (runThrowsAnErrorWhenCalledWithNullReceiver.js:3:14) at runThrowsAnErrorWhenCalledWithNullReceiver.js:4:5
objectId : <objectId>
subtype : error
type : object
}
Running test: runThrowsAnErrorWhenCalledWithIllegalReceiver
Expected exception:
{
className : Error
description : Error: 'run' called with illegal receiver. at runThrowsAnErrorWhenCalledWithIllegalReceiver (runThrowsAnErrorWhenCalledWithIllegalReceiver.js:3:14) at runThrowsAnErrorWhenCalledWithIllegalReceiver.js:4:5
objectId : <objectId>
subtype : error
type : object
}

View File

@ -0,0 +1,134 @@
// 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.
// Flags: --experimental-async-stack-tagging-api
const { session, contextGroup, Protocol } = InspectorTest.start('Stack tagging API works');
session.setupScriptMap();
// We write the test cases as functions instead of string literals so the
// fuzzer can fuzz them as well.
const testCases = [
function simpleTaskLogsCorrectAsyncTrace() {
function foo() { return console.createTask('Task'); }
const task = foo();
task.run(function runner() {
console.trace('Inside run');
});
},
function nestedTasksLogCorrectAsyncTrace() {
const outerTask = console.createTask('Outer Task');
outerTask.run(function runOuter() {
const innerTask = console.createTask('Inner Task');
innerTask.run(function runInner() {
console.trace('Inside runInner');
});
});
},
async function setTimeoutWorksCorrectly() {
const outerTask = console.createTask('Outer Task');
await outerTask.run(async function runOuter() {
return new Promise(r => setTimeout(() => {
const innerTask = console.createTask('Inner Task');
innerTask.run(function runInner() {
console.trace('Inside runInner');
r();
});
}, 0));
});
},
function runForwardsTheReturnValue() {
const task = console.createTask('Task');
const result = task.run(() => 42);
console.log(result);
},
async function runWorksWithAsyncPayloads() {
const task = console.createTask('Task');
const result = await task.run(async () => 42);
console.log(result);
},
function runWorksWithGenerators() {
const task = console.createTask('Task');
const iter = task.run(function* () { yield 42; });
console.log(iter.next().value);
},
function runCanBeCalledMultipleTimes() {
const task = console.createTask('Task');
task.run(() => console.log('First run'));
task.run(() => console.log('Second run'));
},
function runForwardsExceptions() {
const task = console.createTask('Task');
task.run(() => {
throw new Error('Thrown from task.run');
});
},
function recursivelyCalledRunDoesntCrash() {
const outerTask = console.createTask('Outer Task');
outerTask.run(function runOuter() {
const innerTask = console.createTask('Inner Task');
innerTask.run(function runInner() {
outerTask.run(function nestedRunOuter() {
console.trace('Inside nestedRunOuter');
});
});
});
},
function scheduleThrowsAnErrorWhenCalledWithoutAnArgument() {
console.createTask();
},
function scheduleThrowsAnErrorWhenCalledWithAnEmptyString() {
console.createTask('');
},
function runThrowsAnErrorWhenCalledWithoutAnArgument() {
const task = console.createTask('Task');
task.run();
},
function runThrowsAnErrorWhenCalledWithNonFunction() {
const task = console.createTask('Task');
task.run(42);
},
function runThrowsAnErrorWhenCalledWithNullReceiver() {
const task = console.createTask('Task');
task.run.call(undefined, () => { });
},
function runThrowsAnErrorWhenCalledWithIllegalReceiver() {
const task = console.createTask('Task');
task.run.call({}, () => { }); // The private symbol is missing.
},
];
(async () => {
Protocol.Runtime.onConsoleAPICalled(({params}) => {
InspectorTest.log(`---------- console.${params.type}: ${params.args[0].value} ----------`);
session.logCallFrames(params.stackTrace.callFrames);
session.logAsyncStackTrace(params.stackTrace.parent);
});
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
await Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
for (const testCase of testCases) {
InspectorTest.log(`\nRunning test: ${testCase.name}`);
// Turn the function into an IIFE and compile + run it as a script.
const {result: {scriptId}} = await Protocol.Runtime.compileScript({
expression: `(${testCase.toString()})();`,
sourceURL: `${testCase.name}.js`,
persistScript: true,
});
const { result: { exceptionDetails } } = await Protocol.Runtime.runScript({
scriptId,
awaitPromise: true,
});
if (exceptionDetails) {
InspectorTest.log(`Expected exception: `);
InspectorTest.logMessage(exceptionDetails.exception);
}
}
InspectorTest.completeTest();
})();