[PATCH 5/9] jscript: Pass a jsval "this" to builtin functions.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Dec 3 12:24:16 CST 2021


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? 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?



More information about the wine-devel mailing list