Bug 45143

Summary: V8/JS bindings should not perform type checks if the parameter has Callback attribute
Product: WebKit Reporter: Kinuko Yasuda <kinuko>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, darin, dumi
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch darin: review+

Kinuko Yasuda
Reported 2010-09-02 15:49:14 PDT
It causes compile error if an overloaded function has callback parameters.
Attachments
Patch (5.39 KB, patch)
2010-09-02 18:25 PDT, Kinuko Yasuda
no flags
Patch (8.24 KB, patch)
2010-09-02 22:32 PDT, Kinuko Yasuda
darin: review+
Kinuko Yasuda
Comment 1 2010-09-02 18:25:31 PDT
Dumitru Daniliuc
Comment 2 2010-09-02 20:01:56 PDT
Comment on attachment 66450 [details] Patch > WebCore/bindings/scripts/CodeGeneratorJS.pm:1137 > + if ($codeGenerator->IsStringType($type)) { i think it might be cleaner to format this code as: if (IsStringType($type)) { ... } elsif ($parameter->extendedAttributes->{"Callback"}) { ... } elsif (!IsNativeType($type)) { ... } same comment for CodeGeneratorV8.pm. > WebCore/bindings/scripts/test/V8/V8TestObj.cpp:-981 > - if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject()))) i believe you need to change JS/JSTestObj.cpp too.
Kinuko Yasuda
Comment 3 2010-09-02 22:32:08 PDT
Kinuko Yasuda
Comment 4 2010-09-02 22:40:24 PDT
(In reply to comment #2) > (From update of attachment 66450 [details]) > > WebCore/bindings/scripts/CodeGeneratorJS.pm:1137 > > + if ($codeGenerator->IsStringType($type)) { > i think it might be cleaner to format this code as: > > if (IsStringType($type)) { > ... > } elsif ($parameter->extendedAttributes->{"Callback"}) { > ... > } elsif (!IsNativeType($type)) { > ... > } > > same comment for CodeGeneratorV8.pm. Fixed. Wasn't very sure if we want to check that for native types... but maybe it would contribute to readability. > > WebCore/bindings/scripts/test/V8/V8TestObj.cpp:-981 > > - if ((args.Length() == 2 && (args[0]->IsNull() || V8TestObj::HasInstance(args[0])) && (args[1]->IsNull() || args[1]->IsUndefined() || args[1]->IsString() || args[1]->IsObject()))) > i believe you need to change JS/JSTestObj.cpp too. Fixed. (The update in the previous patch was an error actually - this time I added a new overloaded method with callback arg and updated both {V8,JS}TestObj.cpp.)
Dumitru Daniliuc
Comment 5 2010-09-03 03:40:03 PDT
Comment on attachment 66469 [details] Patch r=me.
Darin Adler
Comment 6 2010-09-03 09:59:39 PDT
Comment on attachment 66469 [details] Patch Why did this test go in without any actual JavaScript regression tests? Presumably this was done to change real-world behavior, not just to change the bindings source code in a way that is not visible from web pages. We don’t want bug fixes going in without regression tests. I don’t see any reason for this to be an exception!
Darin Adler
Comment 7 2010-09-03 10:00:04 PDT
Comment on attachment 66469 [details] Patch I’m going to change this to a review- until I find out why there are no regression tests.
Darin Adler
Comment 8 2010-09-03 10:00:33 PDT
Comment on attachment 66469 [details] Patch Oops, I see now. A compilation error. My bad. Adding back Dumi’s review+.
Kinuko Yasuda
Comment 9 2010-09-03 11:56:09 PDT
(In reply to comment #8) > (From update of attachment 66469 [details]) > Oops, I see now. A compilation error. My bad. Adding back Dumi’s review+. Thanks for examining this... ok to go now? Currently there's no such IDL that has overloaded function with callbacks (I was going to add one and got a compilation error). I'll double check that this doesn't change anything for existing IDLs.
Darin Adler
Comment 10 2010-09-03 14:17:13 PDT
(In reply to comment #9) > Thanks for examining this... ok to go now? I have no objection. I didn’t review the patch, but I see no reason to reverse Dumi’s review+ now that I understand.
Kinuko Yasuda
Comment 11 2010-09-03 21:25:36 PDT
Note You need to log in before you can comment on or make changes to this bug.