Bug 154656
| Summary: | Improve support for nullable DOMString attributes / parameters | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> |
| Component: | Bindings | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | darin, sam |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://heycam.github.io/webidl/#idl-nullable-type | ||
| Bug Depends on: | 154659 | ||
| Bug Blocks: | |||
Chris Dumez
Improve support for nullable DOMString attributes / parameters and use them when possible to match specifications:
http://heycam.github.io/webidl/#idl-nullable-type
Once we support and use properly nullable DOMString attributes / parameters, we should be able to get rid of [TreatUndefined=NullString] WebKit IDL attribute.
Also, [TreatNullAs=NullString] should then only be used in cases where the specification has [TreatNullAs=EmptyString] (see Bug 154654).
* Currently, to emulate nullable DOMString parameters, WebKit uses:
void method([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString parameter)
or worse:
void method([TreatNullAs=NullString] DOMString parameter) // Wrong behavior for undefined.
When it should simply be:
void method(DOMString? parameter)
* And to emulate nullable DOMString attributes, WebKit uses:
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString, TreatUndefinedAs=NullString] attribute DOMString myAttr;
or worse:
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString myAttr; // Wrong behavior for undefined.
when it should simply be:
attribute DOMString? myAttr;
--
Note that the change should not be that hard because our bindings generator is already able to generate the right code for these nullable attributes / parameters, although via the use of WebKit-specific IDL attributes. Also, I believe I already added support for nullable attributes recently:
attribute DOMString? myAttr;
should already work and be equivalent to
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString, TreatUndefinedAs=NullString] attribute DOMString myAttr;
I am not sure what's our support for nullable DOMString parameters at the moment but I seem to remember messing with that code as well a while back.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Chris Dumez
This was dealt with in other bugs recently. Nullable DOMString parameters, attributes and return values should not be supported.