[Webkit-unassigned] [Bug 187639] [GLIB] Add API to evaluate code using a given object to store global symbols

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 15 22:29:55 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=187639

--- Comment #8 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to Michael Catanzaro from comment #5)
> Comment on attachment 345034 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=345034&action=review
> 
> > Source/JavaScriptCore/API/glib/JSCContext.cpp:775
> > + * in @uri; the value is one-based so the first line is 1. @uri and @line_number will be shown in exceptions,
> > + * they don't affect the behavior of the script.
> 
> This is a comma splice (in the last sentence). You know by now your options
> for how to fix it.

Sure!

> > Source/JavaScriptCore/API/glib/JSCContext.cpp:793
> > + * jsc_context_evaluate_in_object:
> 
> It's confusing that this function always creates the object that evaluates
> the JS. Would it not be useful to be able to pass an existing object?

Indeed, that would be ideal and we wouldn't need the JSCClass parameter, but it's not possible without making a lot more changes to JSC. With current JSC, we need to use a new context to get its global object, so we can't pass an existing object. To use an existing object we would need a special scope mode that also "redirects" the assignments. Yusuke can explain much better than me. The good thing about this approach is that we can change the impl if JSC ever had this new scope keeping the existing API, so it can be optimized internally. Note that even if the function received an existing object, it would be an empty object in most of (if not all) the cases.

> > Source/JavaScriptCore/ChangeLog:9
> > +        evaluated script are added as propertuies to the new object instead of to the context global object. This is
> 
> properties

Oops.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180716/c634dbba/attachment.html>


More information about the webkit-unassigned mailing list