[PATCH v4 01/12] jscript: Try to_primitive first when getting the default value.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Nov 19 08:02:07 CST 2021


On 19/11/2021 13:01, Jacek Caban wrote:
> Hi Gabriel,
> 
> On 11/18/21 7:43 PM, Gabriel Ivăncescu wrote:
>> -        hres = prop_get(This, prop, &r);
>> +        hres = E_FAIL;
>> +        if(id == DISPID_VALUE)
>> +            hres = to_primitive(This->ctx, jsval_obj(This), &r, 
>> NO_HINT);
>> +        if(FAILED(hres))
>> +            hres = prop_get(This, prop, &r);
> 
> 
> You can't try to call to_primitive and ignore its failure. The call may 
> have visible effects. The failure, for example, may be from a throw 
> inside toString JavaScript code.
> 
> 
> Why do you need that in the first place? The attached patch (on top of 
> your patch) passes all tests. Unless there are some obscure special 
> cases, it looks like we should be able to get rid of builtin 
> DISPID_VALUE getters.
> 
> 
> Thanks,
> 
> Jacek
> 

Yeah, I was trying to be cautious. I'll test this some more and see what 
happens when the object doesn't expose toString or valueOf, neither in 
prototypes or anywhere.



More information about the wine-devel mailing list