RESOLVED FIXED 102739
V8: EmptyScriptState passed to functions marked with CallWith=ScriptState
https://bugs.webkit.org/show_bug.cgi?id=102739
Summary V8: EmptyScriptState passed to functions marked with CallWith=ScriptState
Michael Pruett
Reported 2012-11-19 16:36:24 PST
Adding CallWith=ScriptState to a function causes the V8 binding generator to invoke the function with an EmptyScriptState rather than with ScriptState::current(). Since the EmptyScriptState has a null v8::Context, any clients which depend upon a valid v8::Context will fail.
Attachments
Patch (1.58 KB, patch)
2012-11-19 18:41 PST, Michael Pruett
no flags
Patch (4.49 KB, patch)
2012-11-19 19:17 PST, Michael Pruett
no flags
Patch (4.49 KB, patch)
2012-11-19 23:43 PST, Michael Pruett
haraken: review+
webkit.review.bot: commit-queue-
Patch (5.74 KB, patch)
2012-11-20 10:50 PST, Michael Pruett
no flags
Michael Pruett
Comment 1 2012-11-19 18:41:49 PST
Created attachment 175112 [details] Patch This change causes CodeGeneratorV8.pm to pass ScriptState::current() rather than an EmptyScriptState to functions marked with CallWith=ScriptState. With this patch I was able to update IndexedDB to use the ScriptState provided by the binding generator for serialization.
Adam Barth
Comment 2 2012-11-19 18:42:56 PST
Comment on attachment 175112 [details] Patch Great. Do you want to prepare a proper patch for review (e.g., with a ChangeLog)
Kentaro Hara
Comment 3 2012-11-19 18:49:36 PST
Comment on attachment 175112 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175112&action=review The change makes sense. > Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:3529 > - my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 1, $function); > + my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 0, $function); I think that now no one uses 1. Maybe you can kill the $emptyContext argument from GenerateCallWith().
Kentaro Hara
Comment 4 2012-11-19 18:50:05 PST
Comment on attachment 175112 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175112&action=review > Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:1633 > } else { Then you can remove this if-else branch.
Michael Pruett
Comment 5 2012-11-19 19:17:05 PST
Kentaro Hara
Comment 6 2012-11-19 19:18:53 PST
Comment on attachment 175115 [details] Patch LGTM. If you set r?, I can r+ it.
Michael Pruett
Comment 7 2012-11-19 19:22:20 PST
Do you know if there is a reason why EmptyScriptState was used in the past in preference to ScriptState::current()?
Kentaro Hara
Comment 8 2012-11-19 19:23:53 PST
(In reply to comment #7) > Do you know if there is a reason why EmptyScriptState was used in the past in preference to ScriptState::current()? Don't know. Would you git blame its history and cc folks?
Michael Pruett
Comment 9 2012-11-19 20:10:39 PST
Passing EmptyScriptState to functions marked with CallWith=ScriptState seems to have been introduced to CodeGeneratorV8.pm in revision 58298 on 2010-04-27 by Adam Barth. There was no previous use of either EmptyScriptState or ScriptState::current().
Adam Barth
Comment 10 2012-11-19 23:38:44 PST
I have no idea why I used EmptyScriptState.
Kentaro Hara
Comment 11 2012-11-19 23:39:17 PST
Either way I think this change looks reasonable.
Michael Pruett
Comment 12 2012-11-19 23:43:46 PST
Created attachment 175158 [details] Patch I have updated the ChangeLog to note that this patch has been reviewed by Kentaro Hara.
Kentaro Hara
Comment 13 2012-11-19 23:44:48 PST
Comment on attachment 175158 [details] Patch From next time, instead of writing my name to the ChangeLog, please set r?. Then a reviewer can set r+ or r-.
Kentaro Hara
Comment 14 2012-11-19 23:45:30 PST
Comment on attachment 175158 [details] Patch And if you want to commit it, please set cq?. (You can find these forms at the right bottom of https://bugs.webkit.org/attachment.cgi?id=175158&action=review)
WebKit Review Bot
Comment 15 2012-11-20 00:37:56 PST
Comment on attachment 175158 [details] Patch Attachment 175158 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14912534 New failing tests: traversal/exception-forwarding.html
Michael Pruett
Comment 16 2012-11-20 10:50:47 PST
Created attachment 175245 [details] Patch Previously any exception thrown while in EmptyScriptState was cleared when EmptyScriptState went out of scope. I've updated the patch to explicitly clear an exception before throwing it.
WebKit Review Bot
Comment 17 2012-11-20 12:13:44 PST
Comment on attachment 175245 [details] Patch Attachment 175245 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14894690 New failing tests: fast/dom/shadow/shadow-dom-event-dispatching.html
Kentaro Hara
Comment 18 2012-11-20 15:34:19 PST
Comment on attachment 175245 [details] Patch It looks like the failure is not related to the patch. Let's try again.
WebKit Review Bot
Comment 19 2012-11-20 15:51:39 PST
Comment on attachment 175245 [details] Patch Clearing flags on attachment: 175245 Committed r135325: <http://trac.webkit.org/changeset/135325>
WebKit Review Bot
Comment 20 2012-11-20 15:51:44 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.