WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
78107
Replace [CustomPutFunction] with [CustomNamedSetter]
https://bugs.webkit.org/show_bug.cgi?id=78107
Summary
Replace [CustomPutFunction] with [CustomNamedSetter]
Kentaro Hara
Reported
2012-02-08 05:21:01 PST
[CustomPutFunction] means that a given class has a custom setter for named properties. [CustomPutFunction] is used by DOMWindow only. We can replace [CustomPutFunction] with [CustomNamedSetter].
Attachments
Patch
(10.86 KB, patch)
2012-02-08 05:32 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Kentaro Hara
Comment 1
2012-02-08 05:32:50 PST
Created
attachment 126064
[details]
Patch
Kentaro Hara
Comment 2
2012-02-10 03:43:07 PST
Darin: would you take a look?
Darin Adler
Comment 3
2012-02-13 15:37:59 PST
Comment on
attachment 126064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=126064&action=review
> Source/WebCore/ChangeLog:10 > + [CustomPutFunction] means that a given class has a custom setter for named properties. > + [CustomPutFunction] is used by DOMWindow only. This patch replaces [CustomPutFunction] > + with [CustomNamedSetter].
Generally speaking this does not seem like a good change. While it’s possible to use putDelegate to implement all of put, it’s really not a good use of that feature. A putDelegate that always returns true is not really a custom named setter; it’s an entire customization of the put function. While this does remove one of the attributes the script supports, I think it makes things more twisted rather than making things more clear.
> Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:360 > + if (allowsAccessFrom(exec)) > + Base::put(this, exec, propertyName, value, slot);
It seems awkward to call Base::put from “putDelegate”.
> Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:362 > + // Always returns true to have JSDOMWindow::put() return immediately after JSDOMWindow::putDelegate().
This seems like a mechanical comment. A better comment would explain why.
> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:569 > + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"};
Making this change seems strange. There’s no logical reason for this, so I can only assume that checking CheckDomainSecurity is just a sideways way of checking for DOMString. What in particular requires that this be false for DOMWindow? It’s not a step forward to have $hasCustomNamedSetter be false for an object that does indeed have a custom named setter!
> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:2171 > + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"};
Same question here.
Kentaro Hara
Comment 4
2012-02-13 15:57:28 PST
Comment on
attachment 126064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=126064&action=review
Darin: thanks for reviewing!
>> Source/WebCore/ChangeLog:10 >> + with [CustomNamedSetter]. > > Generally speaking this does not seem like a good change. > > While it’s possible to use putDelegate to implement all of put, it’s really not a good use of that feature. A putDelegate that always returns true is not really a custom named setter; it’s an entire customization of the put function. > > While this does remove one of the attributes the script supports, I think it makes things more twisted rather than making things more clear.
OK, then keep [CustomPutFunction] as-is, and let us just rename [CustomPutFunction] to [JSCustomPut].
>> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:569 >> + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"}; > > Making this change seems strange. There’s no logical reason for this, so I can only assume that checking CheckDomainSecurity is just a sideways way of checking for DOMString. What in particular requires that this be false for DOMWindow? > > It’s not a step forward to have $hasCustomNamedSetter be false for an object that does indeed have a custom named setter!
This change would make sense, because for named setters of CheckDomainSecurity objects, V8 needs to call namedSecurityCheck() instead of namedPropertySetter().
>> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:2171 >> + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"}; > > Same question here.
Ditto.
Darin Adler
Comment 5
2012-02-14 15:38:31 PST
Comment on
attachment 126064
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=126064&action=review
>>> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:569 >>> + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"}; >> >> Making this change seems strange. There’s no logical reason for this, so I can only assume that checking CheckDomainSecurity is just a sideways way of checking for DOMString. What in particular requires that this be false for DOMWindow? >> >> It’s not a step forward to have $hasCustomNamedSetter be false for an object that does indeed have a custom named setter! > > This change would make sense, because for named setters of CheckDomainSecurity objects, V8 needs to call namedSecurityCheck() instead of namedPropertySetter().
OK, but then the local variable name, hasCustomNamedSetter, is not good.
>>> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:2171 >>> + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"} && !$dataNode->extendedAttributes->{"CheckDomainSecurity"}; >> >> Same question here. > > Ditto.
Ditto.
Kentaro Hara
Comment 6
2012-02-14 15:50:07 PST
(In reply to
comment #4
)
> > While this does remove one of the attributes the script supports, I think it makes things more twisted rather than making things more clear. > > OK, then keep [CustomPutFunction] as-is, and let us just rename [CustomPutFunction] to [JSCustomPut].
Before renaming it, let me check how DOMWindow-only IDL attributes (e.g. [CustomPutFunction] etc) are used.
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