js/src/tests/ecma_5/extensions/strict-function-toSource.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_5/extensions/strict-function-toSource.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +/*
     1.5 + * Bug 800407 - Functions defined with Function construcor
     1.6 + * do have strict mode when JSOPTION_STRICT_MODE is on.
     1.7 + */
     1.8 +
     1.9 +options("strict_mode");
    1.10 +function testRunOptionStrictMode(str, arg, result) {
    1.11 +    var strict_inner = new Function('return typeof this == "undefined";');
    1.12 +    return strict_inner;
    1.13 +}
    1.14 +assertEq(eval(uneval(testRunOptionStrictMode()))(), true);
    1.15 +
    1.16 +if (typeof decompileBody !== "undefined") {
    1.17 +    assertEq(decompileBody(new Function('x', 'return x*2;')).contains('\n"use strict"'), true);
    1.18 +}
    1.19 +
    1.20 +reportCompare(true, true);

mercurial