servo: Dispatch error events when event handler attributes fail to compile.

I’m not currently doing that because of double borrows in html/webappapis/scripting/processing-model-2/runtime-error-in-body-onerror.html.

We should also make sure to pass tests/wpt/web-platform-tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.html; I believe that we’ll need to change the timing of compilation for that.

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Comments: 20 (17 by maintainers)

Commits related to this issue

Most upvoted comments

The first part of https://github.com/servo/servo/issues/13152#issuecomment-254849922 might describe a problem that no longer exists.

When I change https://github.com/servo/servo/blob/e10cf7adad91a4740a5ba859f4fc33ee59423908/components/script/dom/eventtarget.rs#L532 from false to true and go to a page with the following source:

<body onerror="f()" onclick="}">
  <div id="output">Script not started.</div>
  <script>
    function f() {
     document.getElementById("output").innerText="called f without crashing!";
    }
    document.body.dispatchEvent(new Event("click"));
  </script>

I see “called f without crashing”, with no double-borrow panic.

When I try the more complicated second example, f fires before g, so there are other matters to consider, but it may be that the double-borrow hazard for nested events has been eliminated by other code changes and it is safe to start throwing event handler attribute compile errors.