RESOLVED FIXED 223542
Use the PropertyName parameter passed to custom getters/setters rather than a redundant const char* in DOM attribute prologues
https://bugs.webkit.org/show_bug.cgi?id=223542
Summary Use the PropertyName parameter passed to custom getters/setters rather than a...
Sam Weinig
Reported 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
Attachments
Patch (580.52 KB, patch)
2021-03-19 17:09 PDT, Sam Weinig
no flags
Patch (565.38 KB, patch)
2021-03-20 12:03 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2021-03-19 17:09:58 PDT
Alexey Shvayka
Comment 2 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).
Sam Weinig
Comment 3 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.
Sam Weinig
Comment 4 2021-03-20 12:03:02 PDT
EWS
Comment 5 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].
Radar WebKit Bug Importer
Comment 6 2021-03-22 12:03:15 PDT
Note You need to log in before you can comment on or make changes to this bug.