WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
213041
[JSC] JSCallbackObject::deleteProperty should redirect to Parent::deletePropertyByIndex if propertyName is index
https://bugs.webkit.org/show_bug.cgi?id=213041
Summary
[JSC] JSCallbackObject::deleteProperty should redirect to Parent::deletePrope...
Yusuke Suzuki
Reported
2020-06-10 12:17:34 PDT
[JSC] JSCallbackObject::deleteProperty should redirect to Parent::deletePropertyByIndex if propertyName is index
Attachments
Patch
(4.08 KB, patch)
2020-06-10 12:19 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2020-06-10 12:19:37 PDT
Created
attachment 401567
[details]
Patch
Yusuke Suzuki
Comment 2
2020-06-10 12:19:39 PDT
<
rdar://problem/64204300
>
Darin Adler
Comment 3
2020-06-10 12:28:04 PDT
Comment on
attachment 401567
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=401567&action=review
> Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:424 > + static_assert(std::is_final_v<JSCallbackObject<Parent>>, "Ensure no derived classes have custom deletePropertyByIndex implementation"); > + if (Optional<uint32_t> index = parseIndex(propertyName)) > + return Parent::deletePropertyByIndex(thisObject, globalObject, index.value()); > return Parent::deleteProperty(thisObject, globalObject, propertyName, slot);
Seems like we have a small design problem here. Here we call parseIndex and determine something is not an index, but then call through to the parent without transmitting that information. Then, it also has to call parseIndex. Seems like there should be one function that doesn’t know if the property name is an index or not, another one that knows it’s an index, and a third that knows it’s not an index. Wouldn’t we like to make a design so that parsing to see if a property name is an index happens exactly once?
Yusuke Suzuki
Comment 4
2020-06-10 13:45:17 PDT
Comment on
attachment 401567
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=401567&action=review
>> Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:424 >> return Parent::deleteProperty(thisObject, globalObject, propertyName, slot); > > Seems like we have a small design problem here. > > Here we call parseIndex and determine something is not an index, but then call through to the parent without transmitting that information. Then, it also has to call parseIndex. > > Seems like there should be one function that doesn’t know if the property name is an index or not, another one that knows it’s an index, and a third that knows it’s not an index. > > Wouldn’t we like to make a design so that parsing to see if a property name is an index happens exactly once?
Yeah, agree. I think we eventually need to refactor these functions. Currently, deleteProperty accepts index and non-index. We should consider separating this into two functions. However, we need to be extra careful when doing that, otherwise, we accidentally introduce additional indirect calls which do not exist before.
Darin Adler
Comment 5
2020-06-10 14:36:17 PDT
Comment on
attachment 401567
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=401567&action=review
>>> Source/JavaScriptCore/API/JSCallbackObjectFunctions.h:424 >>> return Parent::deleteProperty(thisObject, globalObject, propertyName, slot); >> >> Seems like we have a small design problem here. >> >> Here we call parseIndex and determine something is not an index, but then call through to the parent without transmitting that information. Then, it also has to call parseIndex. >> >> Seems like there should be one function that doesn’t know if the property name is an index or not, another one that knows it’s an index, and a third that knows it’s not an index. >> >> Wouldn’t we like to make a design so that parsing to see if a property name is an index happens exactly once? > > Yeah, agree. I think we eventually need to refactor these functions. Currently, deleteProperty accepts index and non-index. We should consider separating this into two functions. > However, we need to be extra careful when doing that, otherwise, we accidentally introduce additional indirect calls which do not exist before.
I agree with you, too. There’s danger of too many levels of function calls, other types of repeated work, and poor performance if this isn’t done right. It also offends my sensibilities to parse the same string twice.
Yusuke Suzuki
Comment 6
2020-06-10 15:35:20 PDT
In EWS, only imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html is failing, but we know that this is failing without this patch. Landing.
EWS
Comment 7
2020-06-10 16:15:47 PDT
Committed
r262872
: <
https://trac.webkit.org/changeset/262872
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 401567
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug