Bug 89070 - [JSC/V8] Improve DOMString[] support
Summary: [JSC/V8] Improve DOMString[] support
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks: 88768 89151
  Show dependency treegraph
 
Reported: 2012-06-14 00:54 PDT by Kent Tamura
Modified: 2012-06-14 18:47 PDT (History)
7 users (show)

See Also:


Attachments
Patch (12.34 KB, patch)
2012-06-14 01:01 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 2 (12.30 KB, patch)
2012-06-14 01:04 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch for landing (12.30 KB, patch)
2012-06-14 01:46 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2012-06-14 00:54:06 PDT
If we use DOMString[] for
 - an argument of a non-overload function
 - an return value of a function,
our binding generators produce wrong code.
Comment 1 Kent Tamura 2012-06-14 01:01:22 PDT
Created attachment 147510 [details]
Patch
Comment 2 Kent Tamura 2012-06-14 01:04:42 PDT
Created attachment 147512 [details]
Patch 2

Remove useless comment
Comment 3 Adam Barth 2012-06-14 01:05:36 PDT
Looks reasonable, but I'd like haraken to take a look.
Comment 4 Kentaro Hara 2012-06-14 01:09:47 PDT
Comment on attachment 147512 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review

Looks reasonable to me too.

> Source/WebCore/bindings/js/JSDOMBinding.cpp:153
> +    if (!stringList)
> +        return jsUndefined();

Just a confirmation: You are intending to return (not [] but) undefined for a null stringList, right?
Comment 5 Vineet Chaudhary (vineetc) 2012-06-14 01:13:25 PDT
Comment on attachment 147512 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-3075
> -        if (!$codeGenerator->SkipIncludeHeader($arrayType)) {

tkent: can we add "DOMString[]" to SkipIncludeHeader() ..? because I think this will fail for numerictypes like float[]. I mean will include float.h  to cpp files.
Comment 6 Kent Tamura 2012-06-14 01:18:51 PDT
Comment on attachment 147512 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review

>> Source/WebCore/bindings/js/JSDOMBinding.cpp:153
>> +        return jsUndefined();
> 
> Just a confirmation: You are intending to return (not [] but) undefined for a null stringList, right?

Oh, this should be null to match V8 binding behavior.  I'll change it so.

Thanks.
Comment 7 Kent Tamura 2012-06-14 01:20:38 PDT
Comment on attachment 147512 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review

>> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-3075
>> -        if (!$codeGenerator->SkipIncludeHeader($arrayType)) {
> 
> tkent: can we add "DOMString[]" to SkipIncludeHeader() ..? because I think this will fail for numerictypes like float[]. I mean will include float.h  to cpp files.

ok, will do.
Comment 8 Vineet Chaudhary (vineetc) 2012-06-14 01:28:50 PDT
(In reply to comment #7)
> (From update of attachment 147512 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review
> 
> >> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-3075
> >> -        if (!$codeGenerator->SkipIncludeHeader($arrayType)) {
> > 
> > tkent: can we add "DOMString[]" to SkipIncludeHeader() ..? because I think this will fail for numerictypes like float[]. I mean will include float.h  to cpp files.
> 
> ok, will do.

Ahh sorry tkent previous comment you are handling that in elsif.
Comment 9 Kent Tamura 2012-06-14 01:35:38 PDT
Comment on attachment 147512 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review

>>>> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:-3075
>>>> -        if (!$codeGenerator->SkipIncludeHeader($arrayType)) {
>>> 
>>> tkent: can we add "DOMString[]" to SkipIncludeHeader() ..? because I think this will fail for numerictypes like float[]. I mean will include float.h  to cpp files.
>> 
>> ok, will do.
> 
> Ahh sorry tkent previous comment you are handling that in elsif.

ok, no problem.

Anyway, we might not need to include JSDOMStringList.h and DOMStringList.h.
Comment 10 Kent Tamura 2012-06-14 01:44:11 PDT
(In reply to comment #9)
> Anyway, we might not need to include JSDOMStringList.h and DOMStringList.h.

I'll investigate this later.
Comment 11 Kent Tamura 2012-06-14 01:46:06 PDT
Created attachment 147517 [details]
Patch for landing

undefined -> null
Comment 12 Kent Tamura 2012-06-14 02:59:35 PDT
Committed r120304: <http://trac.webkit.org/changeset/120304>
Comment 13 Kent Tamura 2012-06-14 17:50:41 PDT
(In reply to comment #6)
> (From update of attachment 147512 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=147512&action=review
> 
> >> Source/WebCore/bindings/js/JSDOMBinding.cpp:153
> >> +        return jsUndefined();
> > 
> > Just a confirmation: You are intending to return (not [] but) undefined for a null stringList, right?
> 
> Oh, this should be null to match V8 binding behavior.  I'll change it so.

I was incorrect.  We doesn't have V8 binding code to convert a DOMStringList to v8 array.  I looked a wrong code.
Probably we should have different behavior for "DOMString[]" and "DOMString[]?".
Comment 14 Kentaro Hara 2012-06-14 17:52:23 PDT
(In reply to comment #13)
> I was incorrect.  We doesn't have V8 binding code to convert a DOMStringList to v8 array.  I looked a wrong code.
> Probably we should have different behavior for "DOMString[]" and "DOMString[]?".

Yes. DOMString[] is not nullable, but DOMString[]? is nullable: http://www.w3.org/TR/WebIDL/#idl-nullable-type
Comment 15 Kent Tamura 2012-06-14 18:27:33 PDT
Ok, code generators should produce v8ArrayOrNull() / jsArrayOrNull() for "DOMString[]?".  So, jsArray() / v8Array() should not return null/undefined.
I'll make a patch.