[PATCH 2/5] jscript: Pass null jsval to builtin functions instead of the global host.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Fri Mar 18 10:17:56 CDT 2022
On 17/03/2022 19:06, Jinoh Kang wrote:
> On 3/18/22 01:25, Gabriel Ivăncescu wrote:
>> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
>> ---
>> dlls/jscript/function.c | 2 +-
>> dlls/jscript/tests/api.js | 36 ++++++++++++++++++++++++++
>> dlls/mshtml/tests/es5.js | 53 +++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 90 insertions(+), 1 deletion(-)
>>
>> diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
>> index d5d8e7d..7e656b1 100644
>> --- a/dlls/jscript/tests/api.js
>> +++ b/dlls/jscript/tests/api.js
>> @@ -3061,6 +3061,42 @@ ok(unescape.length == 1, "unescape.length = " + unescape.length);
>> String.length = 3;
>> ok(String.length == 1, "String.length = " + String.length);
>>
>> +(function() {
>
> (snip)
>
>> +
>> + for(var i = 0; i < tests.length; i++) {
>> + try {
>> + tests[i][2](null);
>> + ok(false, "expected exception calling " + tests[i][0] + " with null context");
>> + }catch(ex) {
>> + var n = ex.number + 0x100000000; /* make it unsigned like HRESULT */
>
> I find `ex.number >>> 0` more intuitive. It's a common idiom to convert a number to unsigned 32-bit integer.
>
>> + ok(n === tests[i][1], tests[i][0] + " with null context exception code = " + n);
>> + }
>> + try {
>> + tests[i][2](undefined);
>> + ok(false, "expected exception calling " + tests[i][0] + " with undefined context");
>> + }catch(ex) {
>> + var n = ex.number + 0x100000000;
>
> Ditto.
>
> (Two more instances omitted)
>
Oh, I agree it's much nicer, didn't know about it, thanks. :-)
More information about the wine-devel
mailing list