Skip to content

Specify error event filename/lineno/colno #10517

@domenic

Description

@domenic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions