add_task(
threadFrontTest(async ({ threadActor, threadFront, debuggee }) => {
let lastMessage, lastExpression; const { targetActor } = threadActor; // Only Workers are evaluating through the WebConsoleActor. // Tabs will be evaluating directly via the frame object.
targetActor._consoleActor = {
evaluateJS(expression) {
lastExpression = expression;
},
};
// And then listen for resource RDP event. // Bug 1646677: But we should probably migrate this test to ResourceCommand so that // we don't have to hack the server side via Resource.watchResources call.
targetActor.on( "resources-available-array",
([[resourceType, resources]]) => { if (resourceType == Resources.TYPES.CONSOLE_MESSAGE) {
lastMessage = resources[0];
}
}
);
// But both tabs and processes will be going through the ConsoleMessages module // We force watching for console message first,
await Resources.watchResources(targetActor, [
Resources.TYPES.CONSOLE_MESSAGE,
]);
// Set a logpoint which should throw an error message.
await threadFront.setBreakpoint(
{
sourceUrl: source.url,
line: 3,
},
{ logValue: "c" }
);
// Execute the rest of the code.
await threadFront.resume();
// NOTE: logpoints evaluated in a worker have a lastExpression if (lastMessage) { Assert.equal(lastMessage.level, "logPointError"); Assert.equal(lastMessage.arguments[0], "c is not defined"); Assert.ok(/\d+\.\d+/.test(lastMessage.timeStamp));
} else { Assert.equal(lastExpression.text, "console.log(...[c])"); Assert.equal(lastExpression.lineNumber, 3);
}
})
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.