[PATCH 5/9] jscript: Pass a jsval "this" to builtin functions.
Jacek Caban
jacek at codeweavers.com
Fri Dec 3 13:39:11 CST 2021
On 12/3/21 7:24 PM, Gabriel Ivăncescu wrote:
> On 03/12/2021 17:01, Jacek Caban wrote:
>> Hi Gabriel,
>>
>> On 12/3/21 2:57 PM, Gabriel Ivăncescu wrote:
>>> -static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t
>>> *jsthis, WORD flags, unsigned argc, jsval_t *argv,
>>> +static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, jsval_t
>>> vthis, WORD flags, unsigned argc, jsval_t *argv,
>>> jsval_t *r)
>>> {
>>> - jsdisp_t *jsdisp;
>>> + jsdisp_t *jsthis, *jsdisp;
>>> BOOL ret = FALSE;
>>> + if(!is_object_instance(vthis))
>>> + return JS_E_OBJECT_EXPECTED;
>>
>>
>> This is not what spec says. I caught this one, but it shows a wider
>> problem: a ton of builtin functions are supposed to call to_object on
>> this argument. With later patches, they will start failing instead.
>> In fact, to_object on this argument is so common that maybe we could
>> continue doing that before calling the function based on some flag in
>> the description, opt-in or opt-out. Did you review the spec in that
>> context?
>>
>>
>
> So basically all functions should have to_object called except for
> toString, right?
I don't think it's the only one. At very least some functions don't care
about 'this' argument.
> Or at least, first (no-op) patch will have them all call to_object so
> it is like now, and then we can selectively enable to pass raw value
> instead?
That's likely, but a closer look at spec is needed to analyse what
exactly we will need.
Jacek
More information about the wine-devel
mailing list