[webkit-changes] [WebKit/WebKit] cf847e: [WebIDL] document.body.onerror setter should setup...

Commit Queue noreply at github.com
Wed May 17 21:28:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cf847edd8255f9707e64f91b93ab91b4a5f4eeb8
      https://github.com/WebKit/WebKit/commit/cf847edd8255f9707e64f91b93ab91b4a5f4eeb8
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-05-17 (Wed, 17 May 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent-expected.txt
    M Source/WebCore/bindings/scripts/CodeGenerator.pm
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/dom/GlobalEventHandlers.idl
    M Source/WebCore/html/HTMLBodyElement.idl
    M Source/WebCore/html/HTMLFrameSetElement.idl
    M Source/WebCore/page/WindowEventHandlers.idl
    M Source/WebCore/workers/WorkerGlobalScope.idl

  Log Message:
  -----------
  [WebIDL] document.body.onerror setter should setup a five-parameter listener
https://bugs.webkit.org/show_bug.cgi?id=234568
<rdar://problem/86959987>

Reviewed by Darin Adler.

According to the spec [1], "onerror" IDL attributes on <body> / <frameset> elements reflect event
handlers to Window (implemented by [WindowEventHandler] IDL attribute), which fall under
"special error handling" case [2] and are invoked with 5 arguments while cancelling the event if
`true` is returned (implemented in JSErrorHandler).

This patch:

  1. Fixes "onerror" IDL attribute on <body> / <frameset> elements to set up JSErrorHandler handler
     directly on Window.

  2. Resolves FIXME on hardcoding "onerror" by introducing IsEventHandlerType helper and aligning
     "onerror" / "onbeforeunload" IDL types with the specs, resolving a few more FIXMEs.
     This change is safe and forward-compatible given OnErrorEventHandler type is considered legacy
     and won't be introduced for new global objects.

[1] https://html.spec.whatwg.org/multipage/webappapis.html#window-reflecting-body-element-event-handler-set
[2] https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm (step 4)

Tests: imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent.html
       imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent.html

* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent-expected.txt:
* Source/WebCore/bindings/scripts/CodeGenerator.pm:
(IsEventHandlerType):
(IsJSONType):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateForEachEventHandlerContentAttribute):
(GenerateAttributeGetterBodyDefinition):
(GenerateAttributeSetterBodyDefinition):
* Source/WebCore/dom/GlobalEventHandlers.idl:
* Source/WebCore/html/HTMLBodyElement.idl:
* Source/WebCore/html/HTMLFrameSetElement.idl:
* Source/WebCore/page/WindowEventHandlers.idl:
* Source/WebCore/workers/WorkerGlobalScope.idl:

Canonical link: https://commits.webkit.org/264190@main




More information about the webkit-changes mailing list