archives

« Bugzilla Issues Index

#102 — Coverage: 15.3.5.4: missing a check for 'P is "arguments"' under Strict Mode (after step 3)


Noticed that 15.3.5.4 disallows:
"use strict";
function f() {}
f.caller;

but allows:
"use strict";
function f() {}
f.arguments;

15.3.5 states:
Function instances that correspond to strict mode functions (13.2) and function instances created using the Function.prototype.bind method (15.3.4.5) have properties named caller and arguments that throw a TypeError exception.


From this, it seems like maybe it was also intended to ban accessing the arguments property in the manner described above from Strict Mode? If not, could the language in 15.3.5 be clarified to state that TypeError exceptions are not thrown for arguments property reads?


(In reply to comment #0)
> Noticed that 15.3.5.4 disallows:
> "use strict";
> function f() {}
> f.caller;

No, this isn't what 15.3.5.4 is about. It disallows this:

function f() {"use strict"; return g();}
function g() {/* not strict */ return g.caller;
//except for 15.3.5.4 would return f
>
> but allows:
> "use strict";
> function f() {}
> f.arguments;

will throw because of 13.2 step c

>
> 15.3.5 states:
> Function instances that correspond to strict mode functions (13.2) and
> function instances created using the Function.prototype.bind method (15.3.4.5)
> have properties named caller and arguments that throw a TypeError exception.

no this refers to 13.2 step 19, not 15.3.5.4
Note that g in my example above is not a strict function
>
>
> From this, it seems like maybe it was also intended to ban accessing the
> arguments property in the manner described above from Strict Mode? If not,
> could the language in 15.3.5 be clarified to state that TypeError exceptions
> are not thrown for arguments property reads?

spec. seems correct to me.


not a bug


not a bug


Reassigning to myself as I think we're missing coverage for the scenario Allen describes.


Indeed, we were completely missing coverage for this scenario. I'll try to add some tests for this by the time Microsoft releases it's next set of test contributions to test262.


Tests are now live on test262.ecmascript.org.