Bug 121305 - StrictTypeChecking extended attribute fails for methods with sequence<T>
Summary: StrictTypeChecking extended attribute fails for methods with sequence<T>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antonio Gomes
URL:
Keywords:
Depends on:
Blocks: 121697 121698
  Show dependency treegraph
 
Reported: 2013-09-13 09:59 PDT by Antonio Gomes
Modified: 2013-09-20 11:08 PDT (History)
5 users (show)

See Also:


Attachments
patch (8.63 KB, patch)
2013-09-16 11:44 PDT, Antonio Gomes
no flags Details | Formatted Diff | Diff
actual patch (8.61 KB, patch)
2013-09-16 13:14 PDT, Antonio Gomes
darin: review+
Details | Formatted Diff | Diff
patch - addressing Chris' comments (10.58 KB, patch)
2013-09-18 12:49 PDT, Antonio Gomes
no flags Details | Formatted Diff | Diff
patch - make added tests JS-only (2.20 KB, patch)
2013-09-20 09:36 PDT, Antonio Gomes
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Gomes 2013-09-13 09:59:19 PDT
it tries to include JSSequence.h, which does not exist.
Comment 1 Antonio Gomes 2013-09-13 14:00:13 PDT
Hey Chris, I have a simple patch for this that basically just adds a further if check, and works find.

See https://gist.github.com/tonikitoo/ca92684ace9f226d8060

I am wondering if you have feedback and what is the way to test it (if any)? TestObj.idl?
Comment 2 Antonio Gomes 2013-09-16 11:44:24 PDT
Created attachment 211812 [details]
patch
Comment 3 WebKit Commit Bot 2013-09-16 11:47:07 PDT
Attachment 211812 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/bindings/scripts/CodeGeneratorJS.pm', u'Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp', u'Source/WebCore/bindings/scripts/test/JS/JSTestObj.h', u'Source/WebCore/bindings/scripts/test/TestObj.idl']" exit_code: 1
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp:3047:  Omit int when using unsigned  [runtime/unsigned] [1]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Antonio Gomes 2013-09-16 13:14:44 PDT
Created attachment 211825 [details]
actual patch
Comment 5 Chris Dumez 2013-09-16 23:39:41 PDT
Comment on attachment 211825 [details]
actual patch

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

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2925
> +                if (!IsNativeType($argType) && !$codeGenerator->GetSequenceType($argType)) {

Based on the comment above, the type needs to be an interface. I believe the check we really want is:
if ($codeGenerator->IsWrapperType($argType))

This is exclude native types, sequences, arrays, basically everything that is not a wrapper type.
Also note that there is another place in the script where the check needs to be updated.
Comment 6 Chris Dumez 2013-09-16 23:41:16 PDT
Comment on attachment 211825 [details]
actual patch

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

> Source/WebCore/bindings/scripts/test/TestObj.idl:227
> +    [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);

Please add a test with an array as well.
Comment 7 Antonio Gomes 2013-09-18 12:49:05 PDT
Created attachment 212014 [details]
patch - addressing Chris' comments

Here is an updated patch. Chris, if you have any additional suggestion, please advice.

Otherwise, it should be good to land.
Comment 8 Chris Dumez 2013-09-18 13:15:00 PDT
Comment on attachment 212014 [details]
patch - addressing Chris' comments

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

LGTM with a bit.

> Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp:-357
> -    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSlong[]::info()))

Ah, we fixed another bug :)

> Source/WebCore/bindings/scripts/test/TestObj.idl:227
> +    [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);

nit: It would be nice to add a method taking an array as well.
Comment 9 Chris Dumez 2013-09-18 13:15:41 PDT
Comment on attachment 212014 [details]
patch - addressing Chris' comments

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

LGTM with a nit.

> Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp:-357
> -    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSlong[]::info()))

Ah, we fixed another bug :)

> Source/WebCore/bindings/scripts/test/TestObj.idl:227
> +    [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);

nit: It would be nice to add a method taking an array as well.
Comment 10 Antonio Gomes 2013-09-20 06:32:38 PDT
 
> > Source/WebCore/bindings/scripts/test/TestObj.idl:227
> > +    [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);
> 
> nit: It would be nice to add a method taking an array as well.

Done: http://trac.webkit.org/changeset/156157
Comment 11 Alexey Proskuryakov 2013-09-20 08:43:48 PDT
This broke bindings tests, <http://build.webkit.org/builders/Apple%20MountainLion%20Release%20WK1%20%28Tests%29/builds/13106/steps/bindings-generation-tests/logs/stdio>. Antonio, are you around to fix these now?
Comment 12 Antonio Gomes 2013-09-20 09:10:21 PDT
(In reply to comment #11)
> This broke bindings tests, <http://build.webkit.org/builders/Apple%20MountainLion%20Release%20WK1%20%28Tests%29/builds/13106/steps/bindings-generation-tests/logs/stdio>. Antonio, are you around to fix these now?

Hi ap. After looking at the failures, they are non-JS especific results that need rebaseline. I on propose only updated the JS ones, because I fixed a bug in CodeGeneratorJS.pm only.

(GObject seems to generated odd results)

So, if the policy just rebaseline all binding generator results, even if it is still broken (see below), I can do that.

Please advice.


FAIL: (CPP) WebDOMTestObj.h
--- WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2013-07-11 08:13:02.000000000 -0700
+++ /var/folders/81/qcmw8mp11lvdf69qgyzyl2000000gn/T/tmpeC9T35/WebDOMTestObj.h	2013-09-20 08:38:22.000000000 -0700
@@ -41,6 +41,7 @@
 class WebDOMTestNode;
 class WebDOMTestObj;
 class WebDOMbool;
+class WebDOMlong[];

It looks wrong, but possibly because the code generator is buggy.
Comment 13 Antonio Gomes 2013-09-20 09:35:25 PDT
Reopening to commit a temporary band-aid patch.
Comment 14 Antonio Gomes 2013-09-20 09:36:16 PDT
Created attachment 212182 [details]
patch - make added tests JS-only
Comment 15 WebKit Commit Bot 2013-09-20 10:09:09 PDT
Comment on attachment 212182 [details]
patch - make added tests JS-only

Clearing flags on attachment: 212182

Committed r156175: <http://trac.webkit.org/changeset/156175>
Comment 16 WebKit Commit Bot 2013-09-20 10:09:13 PDT
All reviewed patches have been landed.  Closing bug.