This is another point where there is no consensus among the various JS
engines, so it is not really a bug. To be more precise:
- ES2019 tells that the engine should throw an exception as does QuickJS.
- SpiderMonkey returns null.
- V8 returns undefined.
The same problem is present for (function(){}).caller, but it is even
worse as the TC39 test262 testsuite has contradictory tests.
QuickJS has a workaround for the "caller" field i.e. it returns
undefined in sloppy mode and throws in strict mode. In order to be more
consistent, I will add the same workaround for the "argument" field and
disable the corresponding test262 test
(built-ins/Function/prototype/restricted-property-arguments.js).
Best regards,
Fabrice.
On 12/20/19 3:21 AM, ???? wrote:
# Version: quickjs-2019-10-27
# Testcase:
var NISLFuzzingFunc = function(){
?0?2 ?0?2 var c = function(){};
?0?2 ?0?2 print(c.arguments);
};
NISLFuzzingFunc();
# Command:
quickjs-2019-10-27/qjs testcase.js
# Output:
TypeError: invalid property access
# Expected output:
undefined
# Description:
"arguments" is restricted in strict mode not non-strict mode, so it
should not throw any exceptions.
Best Regards,
Livy