RESOLVED FIXED 38687
Improve code generator scripts to pass additional ScriptExecutionContext argument to the constructor
https://bugs.webkit.org/show_bug.cgi?id=38687
Summary Improve code generator scripts to pass additional ScriptExecutionContext argu...
Jian Li
Reported 2010-05-06 13:45:10 PDT
Improve code generator scripts to support the following: 1) Pass additional ScriptExecutionContext argument to the constructor 2) Convert ScriptString This is needed in order to avoid custom bindings code for FileReader interface.
Attachments
Proposed Patch (6.91 KB, patch)
2010-05-06 13:51 PDT, Jian Li
abarth: review-
jianli: commit-queue-
Proposed Patch (6.10 KB, patch)
2010-05-06 15:36 PDT, Jian Li
abarth: review+
jianli: commit-queue-
Jian Li
Comment 1 2010-05-06 13:51:07 PDT
Created attachment 55293 [details] Proposed Patch
Adam Barth
Comment 2 2010-05-06 14:39:44 PDT
Comment on attachment 55293 [details] Proposed Patch This is really two patches. Can you split it in two? Also, please add test coverage in TestObj.idl. Other than that, these patches look good. WebCore/bindings/scripts/CodeGeneratorJS.pm:1120 + push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode->extendedAttributes->{"CanBeConstructed"}, $dataNode->extendedAttributes->{"CallWith"})); I wonder if would be better to pass $dataNode here. WebCore/bindings/v8/V8Proxy.h:412 + return throwError(V8Proxy::TypeError, "DOM object constructor cannot be called as a function."); Please remove these non-localized strings. The JSC bindings don't have them and we should aim to be identical. WebCore/bindings/v8/V8Proxy.h:416 + return throwError(V8Proxy::ReferenceError, "DOM object constructor's associated frame is not available"); Please remove these non-localized strings. The JSC bindings don't have them and we should aim to be identical. WebCore/bindings/v8/V8Proxy.h:422 + obj->ref(); Manual reference twiddling is sadness.
Jian Li
Comment 3 2010-05-06 15:36:55 PDT
Created attachment 55309 [details] Proposed Patch
Jian Li
Comment 4 2010-05-06 15:38:35 PDT
(In reply to comment #2) > (From update of attachment 55293 [details]) > This is really two patches. Can you split it in two? Also, please add test > coverage in TestObj.idl. Other than that, these patches look good. Split the patch into two. This bug is about the first change. > > WebCore/bindings/scripts/CodeGeneratorJS.pm:1120 > + push(@implContent, constructorFor($className, $protoClassName, > $interfaceName, $visibleClassName, > $dataNode->extendedAttributes->{"CanBeConstructed"}, > $dataNode->extendedAttributes->{"CallWith"})); > I wonder if would be better to pass $dataNode here. Done. > > WebCore/bindings/v8/V8Proxy.h:412 > + return throwError(V8Proxy::TypeError, "DOM object constructor > cannot be called as a function."); > Please remove these non-localized strings. The JSC bindings don't have them > and we should aim to be identical. Done. > > WebCore/bindings/v8/V8Proxy.h:416 > + return throwError(V8Proxy::ReferenceError, "DOM object > constructor's associated frame is not available"); > Please remove these non-localized strings. The JSC bindings don't have them > and we should aim to be identical. Done. > > WebCore/bindings/v8/V8Proxy.h:422 > + obj->ref(); > Manual reference twiddling is sadness. This is just mimicking constructDOMObject which unfortunately uses the manual refernce twiddling.
Jian Li
Comment 5 2010-05-06 15:40:50 PDT
I do not change TestObj.idl to add coverage because the change is for the interface. Unless we want to add additional test interface to TestObj.idl.
Adam Barth
Comment 6 2010-05-06 15:50:02 PDT
(In reply to comment #5) > I do not change TestObj.idl to add coverage because the change is for the > interface. Unless we want to add additional test interface to TestObj.idl. Yeah, you can just add another IDL file next to TestObj to test interface-level features.
Adam Barth
Comment 7 2010-05-06 15:52:20 PDT
Comment on attachment 55309 [details] Proposed Patch Thanks. Please add a test to run-bindings-tests before landing through. WebCore/bindings/v8/V8Proxy.h:412 + return throwError(V8Proxy::TypeError, ""); We should add version of throwError that doesn't need a string. We basically never want to provide a string.
Jian Li
Comment 8 2010-05-06 16:36:50 PDT
Committed as http://trac.webkit.org/changeset/58919. (In reply to comment #7) > (From update of attachment 55309 [details]) > Thanks. Please add a test to run-bindings-tests before landing through. Added. > > WebCore/bindings/v8/V8Proxy.h:412 > + return throwError(V8Proxy::TypeError, ""); > We should add version of throwError that doesn't need a string. We basically > never want to provide a string. I agree. Probably we need another patch to remove all local strings.
Adam Barth
Comment 9 2010-05-06 16:42:11 PDT
> > WebCore/bindings/v8/V8Proxy.h:412 > > + return throwError(V8Proxy::TypeError, ""); > > We should add version of throwError that doesn't need a string. We basically > > never want to provide a string. > I agree. Probably we need another patch to remove all local strings. Turns out I think this function exists. Just omit the string. :)
Note You need to log in before you can comment on or make changes to this bug.