[PATCH v5 2/5] jscript: Pass null jsval to builtin functions instead of the global host.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Dec 14 06:57:30 CST 2021


On 14/12/2021 12:24, Jinoh Kang wrote:
> On 12/14/21 06:12, Jacek Caban wrote:
>> Hi Gabriel,
>>
>> The series will obviously need to wait for the code freeze. I took a look and didn't catch problems with patch 1 (although I will have another look when the time comes).
>>
>> On 12/10/21 10:52 PM, Gabriel Ivăncescu wrote:
>>>        else
>>> -        vthis = jsval_disp(lookup_global_host(ctx));
>>> +        vthis = jsval_null();
>>
>>
>> This looks suspicious, doesn't it break the assumption that 'this' is an object in ES3?
> 
> Yes, and it does not conform to ES5 strict mode either, where `this` should be undefined.
> 
>>
>>
>> Thanks,
>>
>> Jacek
>>
>>
> 

I actually had to revert it, and keep the checks like originally. I 
don't know if the spec is wrong, or if Microsoft's implementation is not 
compliant here, but there are some tests added in this patch (for 
example, the Object.hasOwnProperty and Array.sort tests) that return 
JS_E_OBJECT_EXPECTED.

Which means they do receive a NULL (or undefined) value. Both are 
supposed to work even on dispatch objects, so that can't be the issue 
either, no matter what the global object is. Unless I'm missing 
something here...?

Also, we don't even implement ES5 strict mode yet, and this patch is 
only temporary for now, because we don't pass jsval yet. This is fixed 
later in the series where we pass the jsval directly in ES5 mode (so 
whether it's NULL or undefined, it gets passed that way).



More information about the wine-devel mailing list