[webkit-reviews] review granted: [Bug 223646] [GTK][WPE] JSC crashes if a function expects a parameter but doesn't receive any : [Attachment 424236] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 25 07:29:09 PDT 2021


Adrian Perez <aperez at igalia.com> has granted Carlos Garcia Campos
<cgarcia at igalia.com>'s request for review:
Bug 223646: [GTK][WPE] JSC crashes if a function expects a parameter but
doesn't receive any
https://bugs.webkit.org/show_bug.cgi?id=223646

Attachment 424236: Patch

https://bugs.webkit.org/attachment.cgi?id=424236&action=review




--- Comment #6 from Adrian Perez <aperez at igalia.com> ---
Comment on attachment 424236
  --> https://bugs.webkit.org/attachment.cgi?id=424236
Patch

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

> Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp:131
> +	       jscContextJSValueToGValue(context.get(), argumentIndex <
argumentCount ? arguments[argumentIndex] : JSValueMakeUndefined(jsContext),

This is calling JSValueMakeUndefined() for each missing parameter. I suppose
it's fast
anyway because “undefined” is a singleton.

We could use two loops, one for the parameters which were passed to the
function call,
and a second one for the missing parameters, and call JSMakeUndefined only
once. That
would also allow the conditional with the ternary operator in each iteration of
the
loop ��️

> Source/JavaScriptCore/API/glib/JSCContext.cpp:465
> +static gpointer jscContextJSValueToWrappedObject(JSCContext* context,
JSValueRef jsValue)

static inline?


More information about the webkit-reviews mailing list