[Webkit-unassigned] [Bug 154656] New: Improve support for nullable DOMString attributes / parameters

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 24 14:35:35 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=154656

            Bug ID: 154656
           Summary: Improve support for nullable DOMString attributes /
                    parameters
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
               URL: http://heycam.github.io/webidl/#idl-nullable-type
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Bindings
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: cdumez at apple.com
                CC: darin at apple.com, sam at webkit.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160224/816b77ae/attachment-0001.html>


More information about the webkit-unassigned mailing list