[webkit-changes] [WebKit/WebKit] b370d4: [WebIDL] reportException() should be called on glo...

EWS noreply at github.com
Mon Nov 28 14:08:39 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b370d4916a70bc781cc2e1cab1276f85d83862ab
      https://github.com/WebKit/WebKit/commit/b370d4916a70bc781cc2e1cab1276f85d83862ab
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2022-11-28 (Mon, 28 Nov 2022)

  Changed paths:
    M LayoutTests/fast/events/detached-svg-parent-window-events-expected.txt
    M LayoutTests/fast/events/detached-svg-parent-window-events.html
    A LayoutTests/imported/w3c/web-platform-tests/custom-elements/cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/custom-elements/cross-realm-callback-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-cross-realm-callback-report-exception.html
    R LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.html
    A LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.tentative-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob-cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob-cross-realm-callback-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/animation-frames/callback-cross-realm-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/animation-frames/callback-cross-realm-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-cross-realm-callback-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/setinterval-cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/setinterval-cross-realm-callback-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/settimeout-cross-realm-callback-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/settimeout-cross-realm-callback-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/intersection-observer/callback-cross-realm-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/intersection-observer/callback-cross-realm-report-exception.html
    A LayoutTests/imported/w3c/web-platform-tests/resize-observer/callback-cross-realm-report-exception-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/resize-observer/callback-cross-realm-report-exception.html
    M Source/WebCore/bindings/js/JSCustomElementInterface.cpp
    M Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h
    M Source/WebCore/bindings/js/JSErrorHandler.cpp
    M Source/WebCore/bindings/js/JSEventListener.cpp
    M Source/WebCore/bindings/js/ScheduledAction.cpp
    M Source/WebCore/bindings/js/ScheduledAction.h
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp

  Log Message:
  -----------
  [WebIDL] reportException() should be called on global object of the callback
https://bugs.webkit.org/show_bug.cgi?id=248161

Reviewed by Darin Adler.

This change aligns WebKit with Blink and Gecko regarding the global object that is used
to report the exception [1] raised from a userland code of a callback function / interface [2].
While the spec mentions only "relevant script", other runtimes simply use callback's global object.

Before this change, only EventListener matched other browsers, so this patch also harmonizes
callbacks within WebKit.

The side effect of this change is that not only userland exceptions are now reported to callback's
global object, but also TypeErrors for malformed XPathNSResolver callback interface.
Unlike r288307, this is completely safe since those errors are created in lexical realm (matches Firefox),
which is proved to be same-origin.

[1] https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception
[2] https://webidl.spec.whatwg.org/#call-a-user-objects-operation

* LayoutTests/fast/events/detached-svg-parent-window-events-expected.txt:
* LayoutTests/fast/events/detached-svg-parent-window-events.html:
Aligns WebKit with other runtimes.

* LayoutTests/imported/w3c/web-platform-tests/custom-elements/cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.tentative-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/domxpath/resolver-callback-interface-cross-realm.tentative.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob-cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob-cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/animation-frames/callback-cross-realm-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/animation-frames/callback-cross-realm-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/microtask-queuing/queue-microtask-cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/setinterval-cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/setinterval-cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/settimeout-cross-realm-callback-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/timers/settimeout-cross-realm-callback-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/intersection-observer/callback-cross-realm-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/intersection-observer/callback-cross-realm-report-exception.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/resize-observer/callback-cross-realm-report-exception-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/resize-observer/callback-cross-realm-report-exception.html: Added.
* Source/WebCore/bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::tryToConstructCustomElement):
(WebCore::JSCustomElementInterface::invokeCallback):
* Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h:
(WebCore::Converter<IDLScheduledAction>::convert):
* Source/WebCore/bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* Source/WebCore/bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent): Non-observable naming changes.
* Source/WebCore/bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
(WebCore::ScheduledAction::ScheduledAction):
(WebCore::ScheduledAction::executeFunctionInContext):
* Source/WebCore/bindings/js/ScheduledAction.h: Refine type of m_function to simplify retrieval of global object.
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallbackImplementationContent):
* Source/WebCore/bindings/scripts/test/*: Updated.

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




More information about the webkit-changes mailing list