Problems with strict-mode caller poisoning

Dave Fugate dave.fugate at
Wed Nov 28 15:16:57 PST 2012

Believe you're correct on the former, but perhaps not the latter=)

     6 /**
     7    * @path ch15/15.3/15.3.5/
     8    * @description Strict mode - checking access to strict function
caller from strict function (FunctionDeclaration defined within strict mode)
     9   * @onlyStrict
    10  * @negative TypeError
    11  */
    14 "use strict";
    15 function f() {
    16     return gNonStrict();
    17 }
    18 f();
    21 function gNonStrict() {
    22     return gNonStrict.caller;
    23 }

is globally scoped strict mode and passes only when a TypeError gets thrown
indicating strict mode is in effect.


+1. I just implemented this in V8, and we will see how it goes in the wild.

Interestingly, none of the 97 tests in test262 that are specifically

concerned with fail after this change 8-}. It seems that they
are broken in at least two ways: allowing a falsey value for .caller,
and assuming that a global function would be non-strict even if the
global scope is already strict.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list