WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
102763
[V8] Introduce constructorCallbackCustom()
https://bugs.webkit.org/show_bug.cgi?id=102763
Summary
[V8] Introduce constructorCallbackCustom()
Kentaro Hara
Reported
2012-11-19 20:52:54 PST
Currently custom constructors have the following code: v8::Handle<v8::Value> V8XXX::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.XXX.Constructor"); if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); /* body of the constructor */; } I would like to generate the common part in a code generator so that custom constructors can just write the body part. Specifically, I want to make the following change: // Generated automatically v8::Handle<v8::Value> V8XXX::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.XXX.Constructor"); if (!args.IsConstructCall()) return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); V8XXX::constructorCallbackCustom(args); } // Written manually v8::Handle<v8::Value> V8XXX::constructorCallback(const v8::Arguments& args) { /* body of the constructor */; } By doing this, not only can we avoid duplicating the same logic in custom bindings, but also it enables us to insert the logic for [V8MeasureAs] into custom constructors.
Attachments
Patch
(19.26 KB, patch)
2012-11-20 16:48 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
patch for landing
(16.77 KB, patch)
2012-11-20 16:54 PST
,
Kentaro Hara
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Adam Barth
Comment 1
2012-11-19 23:39:36 PST
Sounds good to me.
Kentaro Hara
Comment 2
2012-11-20 16:48:22 PST
Created
attachment 175301
[details]
Patch
Adam Barth
Comment 3
2012-11-20 16:52:06 PST
Comment on
attachment 175301
[details]
Patch Very nice.
Kentaro Hara
Comment 4
2012-11-20 16:54:07 PST
Created
attachment 175306
[details]
patch for landing
WebKit Review Bot
Comment 5
2012-11-20 20:03:50 PST
Comment on
attachment 175306
[details]
patch for landing Rejecting
attachment 175306
[details]
from commit-queue. New failing tests: fast/dom/call-a-constructor-as-a-function.html Full output:
http://queues.webkit.org/results/14933559
Kentaro Hara
Comment 6
2012-11-20 21:03:39 PST
Committed
r135346
: <
http://trac.webkit.org/changeset/135346
>
Kentaro Hara
Comment 7
2012-11-20 21:06:33 PST
(In reply to
comment #5
)
> New failing tests: > fast/dom/call-a-constructor-as-a-function.html > Full output:
http://queues.webkit.org/results/14933559
Updated the test result and landed the patch. It looks like that '.' was missing in an error message of DataView's custom constructors:) Now we have '.' for all custom constructors because the same error message is generated by the code generator.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug