Bug 223542 - Use the PropertyName parameter passed to custom getters/setters rather than a redundant const char* in DOM attribute prologues
Summary: Use the PropertyName parameter passed to custom getters/setters rather than a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks: 222518
  Show dependency treegraph
 
Reported: 2021-03-19 16:49 PDT by Sam Weinig
Modified: 2021-03-22 17:05 PDT (History)
15 users (show)

See Also:


Attachments
Patch (580.52 KB, patch)
2021-03-19 17:09 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (565.38 KB, patch)
2021-03-20 12:03 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2021-03-19 16:49:25 PDT
Use the PropertyName parameter passed to custom getters/setters rather than a const char* in DOM attribute prologues
Comment 1 Sam Weinig 2021-03-19 17:09:58 PDT
Created attachment 423792 [details]
Patch
Comment 2 Alexey Shvayka 2021-03-20 09:12:19 PDT
Comment on attachment 423792 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423792&action=review

Nicely done, r=me with minor nits.
I especially like the `if constexpr` bits.

> Source/JavaScriptCore/ChangeLog:8
> +        Add throwVMDOMAttributeSetterTypeError to match existing throwVMDOMAttributeSetterTypeError, and move

typo: to match existing *throwVMDOMAttributeGetterTypeError*

> Source/JavaScriptCore/ChangeLog:9
> +        additional helpers used by WebCore here to avoid redudent work.

typo: *redundant*

> Source/WebCore/ChangeLog:19
> +        - Remove AttributeSetter::call as it was redudent with invokeFunctorPropagatingExceptionIfNecessary.

typo: *redundant*

> Source/WebCore/ChangeLog:286
> +        * bindings/scripts/test/JS/JSWorkletGlobalScope.cpp:

unrelated: it would nice if ChangeLog tooling collapsed all this into
           * bindings/scripts/test/JS/*: Updated.

> Source/WebCore/bindings/js/JSDOMAttribute.h:78
> +                    RELEASE_AND_RETURN(throwScope, rejectPromiseWithGetterTypeError(lexicalGlobalObject, JSClass::info()->className, attributeName));

nit: throwDOMAttributeGetterTypeError() / throwDOMAttributeSetterTypeError() use `classInfo` only to get `className`.
Passing it directly would IMO make helpers look simpler from the call site, and align prototypes of rejectPromiseWithGetterTypeError() / throwVMDOMAttributeGetterTypeError().

> Source/WebCore/bindings/js/JSDOMAttribute.h:80
> +                    return JSC::JSValue::encode(JSC::jsUndefined());

nit: WebKit code style guide seems to forbid `else` after `return` (https://webkit.org/code-style-guidelines/#linebreaking-else-if).
Comment 3 Sam Weinig 2021-03-20 12:01:34 PDT
(In reply to Alexey Shvayka from comment #2)
> Comment on attachment 423792 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=423792&action=review
> 
> Nicely done, r=me with minor nits.
> I especially like the `if constexpr` bits.
> 
> > Source/JavaScriptCore/ChangeLog:8
> > +        Add throwVMDOMAttributeSetterTypeError to match existing throwVMDOMAttributeSetterTypeError, and move
> 
> typo: to match existing *throwVMDOMAttributeGetterTypeError*

Fixed.

> 
> > Source/JavaScriptCore/ChangeLog:9
> > +        additional helpers used by WebCore here to avoid redudent work.
> 
> typo: *redundant*

Fixed.

> 
> > Source/WebCore/ChangeLog:19
> > +        - Remove AttributeSetter::call as it was redudent with invokeFunctorPropagatingExceptionIfNecessary.
> 
> typo: *redundant*

Fixed.

> 
> > Source/WebCore/ChangeLog:286
> > +        * bindings/scripts/test/JS/JSWorkletGlobalScope.cpp:
> 
> unrelated: it would nice if ChangeLog tooling collapsed all this into
>            * bindings/scripts/test/JS/*: Updated.

Fixed.

> 
> > Source/WebCore/bindings/js/JSDOMAttribute.h:78
> > +                    RELEASE_AND_RETURN(throwScope, rejectPromiseWithGetterTypeError(lexicalGlobalObject, JSClass::info()->className, attributeName));
> 
> nit: throwDOMAttributeGetterTypeError() / throwDOMAttributeSetterTypeError()
> use `classInfo` only to get `className`.
> Passing it directly would IMO make helpers look simpler from the call site,
> and align prototypes of rejectPromiseWithGetterTypeError() /
> throwVMDOMAttributeGetterTypeError().
> 

Fixed.


> > Source/WebCore/bindings/js/JSDOMAttribute.h:80
> > +                    return JSC::JSValue::encode(JSC::jsUndefined());
> 
> nit: WebKit code style guide seems to forbid `else` after `return`
> (https://webkit.org/code-style-guidelines/#linebreaking-else-if).

For if constexpr, I tend to ignore this rule, as the semantics are actually a little different.
Comment 4 Sam Weinig 2021-03-20 12:03:02 PDT
Created attachment 423819 [details]
Patch
Comment 5 EWS 2021-03-22 12:02:00 PDT
Committed r274770: <https://commits.webkit.org/r274770>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423819 [details].
Comment 6 Radar WebKit Bug Importer 2021-03-22 12:03:15 PDT
<rdar://problem/75702190>