项目文件夹

文件
Simon Zünd a3a00210a3 feat: include stack trace in 'get_console_message' tool (#740)
This is the stack trace of the console message itself. If the argument
is an Error object or an "Error.stack" like string we don't do anything
special (yet).

The stack trace is source mapped if source maps are available.

The function matches the target ID of the console message to the
`SDK.Target` of DevTools. The only oddity is that DevTools works in a
lazy manor: It creates stack traces upfront and as source maps come in,
stack traces get updated. This does not work for the MCP server.
Instead, we wait for script parsed events and source maps to attach
before creating the stack trace. Since this could take potentially a
while, we guard it with a time out.
2026-01-20 09:58:29 +00:00

43 行
2.2 KiB
Plaintext

exports[`console > get_console_message > applies source maps to stack traces of console messages 1`] = `
# test response
ID: 1
Message: warn> hello world
### Arguments
Arg #0: hello world
### Stack trace
at bar (main.js:2:10)
at foo (main.js:6:2)
at Iife (main.js:10:2)
at <anonymous> (main.js:9:0)
`;
exports[`console > get_console_message > issues type > gets issue details with node id parsing 1`] = `
# test response
ID: 1
Message: issue> An element doesn't have an autocomplete attribute
A form field has an \`id\` or \`name\` attribute that the browser's autofill recognizes. However, it doesn't have an \`autocomplete\` attribute assigned. This might prevent the browser from correctly autofilling the form.
To fix this issue, provide an \`autocomplete\` attribute.
Learn more:
[HTML attribute: autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values)
### Affected resources
uid=1_1 data={"violatingNodeAttribute":"name"}
`;
exports[`console > get_console_message > issues type > gets issue details with request id parsing 1`] = `
# test response
ID: <ID>
Message: issue> Ensure CORS response header values are valid
A cross-origin resource sharing (CORS) request was blocked because of invalid or missing response headers of the request or the associated [preflight request](issueCorsPreflightRequest).
To fix this issue, ensure the response to the CORS request and/or the associated [preflight request](issueCorsPreflightRequest) are not missing headers and use valid header values.
Note that if an opaque response is sufficient, the request's mode can be set to \`no-cors\` to fetch the resource with CORS disabled; that way CORS headers are not required but the response content is inaccessible (opaque).
Learn more:
[Cross-Origin Resource Sharing (\`CORS\`)](https://web.dev/cross-origin-resource-sharing)
### Affected resources
reqid=<reqid> data={"corsErrorStatus":{"corsError":"PreflightMissingAllowOriginHeader","failedParameter":""},"isWarning":false,"request":{"url":"http://hostname:port/data.json"},"initiatorOrigin":"","clientSecurityState":{"initiatorIsSecureContext":false,"initiatorIPAddressSpace":"Loopback","privateNetworkRequestPolicy":"BlockFromInsecureToMorePrivate"}}
`;