haikuwebkit/LayoutTests/fast/css-custom-paint
Alexey Shvayka 6bb75cf119 [WebIDL] Remove [ImplicitThis] and [CustomProxyToJSObject] extended attributes
https://bugs.webkit.org/show_bug.cgi?id=223758

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.html: Added.
* web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.js: Added.
* web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.worker-expected.txt: Added.
* web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.worker.html: Added.
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-registerprocessor-called-on-globalthis.https-expected.txt: Added.
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-registerprocessor-called-on-globalthis.https.html: Added.
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processors/dummy-processor-globalthis.js: Added.

Source/WebCore:

This change introduces castThisValue<JSClass>, taking a step towards unification of |this|
value casting between IDLAttribute and IDLOperation. The helper uses compile-time inheritance
check to provide implicit |this| value for DOM global objects [1], replacing [ImplicitThis]
extended attribute, which was removed from the spec [2] a while ago.

IDLAttribute can't perform toThis() with ECMAMode::strict(), like IDLOperation now does,
because CustomValue getters are called with |this| value of JSGlobalObject type, which gets
tainted by JSScope::toThis(). #225397 will remove the need for toThis(), finally making |this|
value casting consistent between attributes and operations.

Also, this patch fixes `Object.create(window).location` to throw as per spec [1] by removing
prototype chain traversal from toJSDOMWindow(), which aligns WebKit with Blink and Gecko.

As DOM global objects are wrapped in proxies and require special casting, toJSDOMWindow() and
friends are merged into toJSDOMGlobalObject<JSClass>, which is aware of inheritance / JSProxy.
It replaces [CustomProxyToJSObject] extended attribute, which could be missed when adding new
DOM global objects, fixing worklets' global functions not to throw when called on `globalThis`.

This change reduces WebCore --release binary size by 0.2% (147 KB).

[1] https://heycam.github.io/webidl/#dfn-attribute-getter (step 1.1.2.3)
[2] https://github.com/heycam/webidl/pull/155

Tests: imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/global-object-implicit-this-value.any.js
       imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-registerprocessor-called-on-globalthis.https.html
       fast/css-custom-paint/registerPaintBindings.html
       http/tests/security/listener/*.html

* Headers.cmake:
* Modules/webaudio/AudioWorkletGlobalScope.idl:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMAttribute.h:
(WebCore::IDLAttribute::set):
(WebCore::IDLAttribute::setPassingPropertyName):
(WebCore::IDLAttribute::get):
(WebCore::IDLAttribute::getPassingPropertyName):
* bindings/js/JSDOMCastThisValue.h: Added.
(WebCore::castThisValue):
* bindings/js/JSDOMCastedThisErrorBehavior.h: Removed.
* bindings/js/JSDOMGlobalObject.h:
(WebCore::toJSDOMGlobalObject):
* bindings/js/JSDOMOperation.h:
(WebCore::IDLOperation::cast):
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/JSDOMWindowBase.h:
(WebCore::toJSDOMWindow):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::IDLOperation<JSDOMWindow>::cast): Deleted.
* bindings/js/JSDocumentCustom.cpp:
(WebCore::cachedDocumentWrapper):
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::jsEventTargetCast):
* bindings/js/JSEventTargetCustom.h:
(WebCore::IDLOperation<JSEventTarget>::call):
* bindings/js/JSRemoteDOMWindowBase.cpp:
(WebCore::toJSRemoteDOMWindow): Deleted.
* bindings/js/JSRemoteDOMWindowBase.h:
* bindings/js/JSWorkerGlobalScopeBase.cpp:
(WebCore::toJSDedicatedWorkerGlobalScope): Deleted.
(WebCore::toJSWorkerGlobalScope): Deleted.
(WebCore::toJSServiceWorkerGlobalScope): Deleted.
* bindings/js/JSWorkerGlobalScopeBase.h:
* bindings/js/JSWorkletGlobalScopeBase.cpp:
(WebCore::toJSWorkletGlobalScope): Deleted.
* bindings/js/JSWorkletGlobalScopeBase.h:
* bindings/scripts/CodeGeneratorJS.pm:
(ShouldGenerateToJSDeclaration):
(IsAcceleratedDOMAttribute):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/JS/*: Updated.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::canAccessInspectedScriptState const):
* page/DOMWindow.idl:
* page/RemoteDOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/WorkerGlobalScope.idl:
* workers/service/ServiceWorkerGlobalScope.idl:
* worklets/PaintWorkletGlobalScope.idl:
* worklets/WorkletGlobalScope.idl:

Source/WebKit:

Use inherits<T> instead of toJSDOMWindow() if the value is never a JSProxy.

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::reportException):

Source/WebKitLegacy/mac:

Use inherits<T> instead of toJSDOMWindow() if the value is never a JSProxy.

* WebView/WebView.mm:
(+[WebView _reportException:inContext:]):

Source/WebKitLegacy/win:

Use inherits<T> instead of toJSDOMWindow() if the value is never a JSProxy.

* WebView.cpp:
(WebView::reportException):

LayoutTests:

* fast/css-custom-paint/registerPaintBindings.html:
* http/tests/security/listener/*:
This is a progression: Blink and Gecko don't call event listeners belonging to destroyed frames.

* js/property-of-window-as-prototype-expected.txt: Removed.
* js/property-of-window-as-prototype.html: Removed.


Canonical link: https://commits.webkit.org/237976@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 22:25:01 +00:00
..
resources Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
script-tests REGRESSION (r267744): [ Debug WK2 ] fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html is a constant timeout 2020-10-14 21:19:02 +00:00
animate-expected.html
animate-repaint-expected.txt [Repaint] RenderElement::setStyle may issue redundant repaint 2020-09-10 12:19:41 +00:00
animate-repaint.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
animate.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
arguments-expected.html
arguments.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
basic-expected.txt Remove trailing spaces from expected.txt files (excluding WPT for now since that contains too many) 2020-09-27 02:15:19 +00:00
basic.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
constructor-expected.html
constructor.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
delay-expected.html
delay-repaint-expected.txt [Repaint] RenderElement::setStyle may issue redundant repaint 2020-09-10 12:19:41 +00:00
delay-repaint.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
delay.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
image-expected.html
image.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
leaks-expected.txt
leaks.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
multiple-worklets-expected.html
multiple-worklets-isolation-expected.html
multiple-worklets-isolation.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
multiple-worklets.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
out-of-memory-while-adding-worklet-module-expected.txt REGRESSION (r267744): [ Debug WK2 ] fast/css-custom-paint/out-of-memory-while-adding-worklet-module.html is a constant timeout 2020-10-14 21:19:02 +00:00
out-of-memory-while-adding-worklet-module.html Add handling of out of memory handling while adding a worklet module. 2020-07-15 19:20:21 +00:00
properties-expected.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
properties.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
registerPaintBindings-expected.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
registerPaintBindings.html [WebIDL] Remove [ImplicitThis] and [CustomProxyToJSObject] extended attributes 2021-05-20 22:25:01 +00:00
simple-hidpi-expected.html
simple-hidpi.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
worklet-expected.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00
worklet.html Remove experimental: and internal: prefixes from test header commands 2020-11-04 15:56:26 +00:00