Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify error event filename/lineno/colno #10517

Open
domenic opened this issue Jul 25, 2024 · 0 comments
Open

Specify error event filename/lineno/colno #10517

domenic opened this issue Jul 25, 2024 · 0 comments
Labels
interop Implementations are not interoperable with each other topic: error reporting

Comments

@domenic
Copy link
Member

domenic commented Jul 25, 2024

What is the issue with the HTML Standard?

It has never been clear how to derive the filename, lineno, and colno for error events fired with the ErrorEvent class. #10404 makes this explicit, introducing "extract error information" which says

Set attributes[message], attributes[filename], attributes[lineno], and attributes[colno] to implementation-defined values derived from exception.

NOTE: Browsers implement behavior not specified here or in the JavaScript specification to gather values which are helpful, including in unusual cases (e.g., eval). In the future, this might be specified in greater detail.

Ideally, we would have a clear specification for these cases. Tricky cases include:

  • The impact of eval and friends
  • Strange URLs like blob: and especially javascript: (see e.g. javascript: URLs, window.onerror, and filenames #1960)
  • Exceptions created by the browser, instead of the web developer
  • Filename when redirects are involved: apparently some browsers use the pre-redirect filename, for security reasons? Some discussion in Clarify "report an exception" #958 (comment) and the following comments.
  • Exceptions that are created in one location and thrown in a different location
  • Cases of "extract error information" that aren't related to the global error event. (Currently only in the navigation API.)

The first step is to create a large amount of web platform tests covering these cases, and seeing where things stand today.

#958 (comment) has a plan for how to specify the result rigorously, by adding hooks to the JavaScript specification.

@domenic domenic added interop Implementations are not interoperable with each other topic: error reporting labels Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: error reporting
Development

No branches or pull requests

1 participant