Prefer explicit error checking where possible

The `negative` frontmatter tag expresses an expectation for the behavior
of the test file as a whole. The `assert.throws` helper function offers
more fine-grained control over expectations because it may be applied to
specific statements and expressions. This makes it preferable in cases
where it may be used (i.e. when the test body does not describe a syntax
error or early error).

Re-implement assertions for errors to use the `assert.throws` helper
function wherever possible.
This commit is contained in:
Mike Pennisi 2015-06-26 14:56:43 -04:00
parent 0027a6b6bf
commit 10e0d977ec
174 changed files with 644 additions and 458 deletions

View File

@ -5,7 +5,6 @@
info: Array.prototype.splice sets `length` on `this` info: Array.prototype.splice sets `length` on `this`
es5id: 15.4.4.12_A6.1_T2 es5id: 15.4.4.12_A6.1_T2
description: Array.prototype.splice throws if `length` is read-only description: Array.prototype.splice throws if `length` is read-only
negative: TypeError
---*/ ---*/
var a = [0, 1, 2]; var a = [0, 1, 2];
@ -14,4 +13,6 @@ Object.defineProperty(a, 'length', {
writable: false writable: false
}); });
a.splice(1, 2, 4); assert.throws(TypeError, function() {
a.splice(1, 2, 4);
});

View File

@ -9,10 +9,11 @@ es5id: 15.3.5-2gs
description: > description: >
StrictMode - error is thrown when reading the 'caller' property of StrictMode - error is thrown when reading the 'caller' property of
a function object a function object
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
function _15_3_5_1_gs() {} function _15_3_5_1_gs() {}
_15_3_5_1_gs.caller;
throw NotEarlyError; assert.throws(TypeError, function() {
_15_3_5_1_gs.caller;
});

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (New'ed Function constructor includes strict non-strict function (New'ed Function constructor includes strict
directive prologue) directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var f = new Function("\"use strict\";\nreturn gNonStrict();"); var f = new Function("\"use strict\";\nreturn gNonStrict();");
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,11 +9,12 @@ es5id: 15.3.5.4_2-11gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (eval used within strict mode) strict function (eval used within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
eval("gNonStrict();"); assert.throws(TypeError, function() {
eval("gNonStrict();");
});
function gNonStrict() { function gNonStrict() {

View File

@ -9,13 +9,14 @@ es5id: 15.3.5.4_2-13gs
description: > description: >
Strict mode - checking access to non-strict function caller from Strict mode - checking access to non-strict function caller from
strict function (indirect eval used within strict mode) strict function (indirect eval used within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var my_eval = eval; var my_eval = eval;
my_eval("gNonStrict();");
assert.throws(TypeError, function() {
my_eval("gNonStrict();");
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,15 +10,16 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (New'ed object from FunctionDeclaration defined strict function (New'ed object from FunctionDeclaration defined
within strict mode) within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
function f() { function f() {
return gNonStrict(); return gNonStrict();
} }
new f();
assert.throws(TypeError, function() {
new f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (New'ed object from FunctionDeclaration non-strict function (New'ed object from FunctionDeclaration
includes strict directive prologue) includes strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -18,8 +17,10 @@ function f() {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
new f();
assert.throws(TypeError, function() {
new f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,15 +10,16 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (New'ed object from FunctionExpression defined strict function (New'ed object from FunctionExpression defined
within strict mode) within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var f = function () { var f = function () {
return gNonStrict(); return gNonStrict();
} }
new f();
assert.throws(TypeError, function() {
new f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (New'ed object from FunctionExpression non-strict function (New'ed object from FunctionExpression
includes strict directive prologue) includes strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -18,8 +17,10 @@ var f = function () {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
new f();
assert.throws(TypeError, function() {
new f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,15 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (New'ed object from Anonymous FunctionExpression strict function (New'ed object from Anonymous FunctionExpression
defined within strict mode) defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var obj = new (function () { assert.throws(TypeError, function() {
return gNonStrict(); var obj = new (function () {
return gNonStrict();
});
}); });
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;
} }

View File

@ -9,15 +9,16 @@ es5id: 15.3.5.4_2-1gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionDeclaration defined within strict mode) strict function (FunctionDeclaration defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
function f() { function f() {
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (New'ed object from Anonymous non-strict function (New'ed object from Anonymous
FunctionExpression includes strict directive prologue) FunctionExpression includes strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var obj = new (function () { assert.throws(TypeError, function() {
"use strict"; var obj = new (function () {
return gNonStrict(); "use strict";
return gNonStrict();
});
}); });

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionDeclaration defined within a strict function (FunctionDeclaration defined within a
FunctionDeclaration inside strict mode) FunctionDeclaration inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -20,8 +19,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionExpression defined within a strict function (FunctionExpression defined within a
FunctionDeclaration inside strict mode) FunctionDeclaration inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -20,8 +19,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Anonymous FunctionExpression defined within a strict function (Anonymous FunctionExpression defined within a
FunctionDeclaration inside strict mode) FunctionDeclaration inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -19,8 +18,10 @@ function f1() {
return gNonStrict(); return gNonStrict();
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionDeclaration defined within a strict function (FunctionDeclaration defined within a
FunctionExpression inside strict mode) FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -20,7 +19,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionExpression defined within a strict function (FunctionExpression defined within a
FunctionExpression inside strict mode) FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -20,8 +19,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Anonymous FunctionExpression defined within a strict function (Anonymous FunctionExpression defined within a
FunctionExpression inside strict mode) FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
@ -19,8 +18,10 @@ var f1 = function () {
return gNonStrict(); return gNonStrict();
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,17 +10,17 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionDeclaration defined within an Anonymous strict function (FunctionDeclaration defined within an Anonymous
FunctionExpression inside strict mode) FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
function f() { (function () {
return gNonStrict(); function f() {
} return gNonStrict();
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,16 +10,17 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionExpression defined within an Anonymous strict function (FunctionExpression defined within an Anonymous
FunctionExpression inside strict mode) FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
var f = function () { (function () {
return gNonStrict(); var f = function () {
} return gNonStrict();
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {

View File

@ -10,16 +10,16 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Anonymous FunctionExpression defined within an strict function (Anonymous FunctionExpression defined within an
Anonymous FunctionExpression inside strict mode) Anonymous FunctionExpression inside strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
return (function () { (function () {
return gNonStrict(); return (function () {
return gNonStrict();
})();
})(); })();
})(); });
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration includes strict directive non-strict function (FunctionDeclaration includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -18,8 +17,10 @@ function f() {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration defined within a non-strict function (FunctionDeclaration defined within a
FunctionDeclaration with a strict directive prologue) FunctionDeclaration with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression defined within a non-strict function (FunctionExpression defined within a
FunctionDeclaration with a strict directive prologue) FunctionDeclaration with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression defined within a non-strict function (Anonymous FunctionExpression defined within a
FunctionDeclaration with a strict directive prologue) FunctionDeclaration with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -20,8 +19,10 @@ function f1() {
return gNonStrict(); return gNonStrict();
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration defined within a non-strict function (FunctionDeclaration defined within a
FunctionExpression with a strict directive prologue) FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression defined within a non-strict function (FunctionExpression defined within a
FunctionExpression with a strict directive prologue) FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression defined within a non-strict function (Anonymous FunctionExpression defined within a
FunctionExpression with a strict directive prologue) FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -20,8 +19,10 @@ var f1 = function () {
return gNonStrict(); return gNonStrict();
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,18 +10,18 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration defined within an non-strict function (FunctionDeclaration defined within an
Anonymous FunctionExpression with a strict directive prologue) Anonymous FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
"use strict"; (function () {
function f() { "use strict";
return gNonStrict(); function f() {
} return gNonStrict();
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,18 +10,18 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression defined within an non-strict function (FunctionExpression defined within an
Anonymous FunctionExpression with a strict directive prologue) Anonymous FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
"use strict"; (function () {
var f = function () { "use strict";
return gNonStrict(); var f = function () {
} return gNonStrict();
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,17 +10,17 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression defined within non-strict function (Anonymous FunctionExpression defined within
an Anonymous FunctionExpression with a strict directive prologue) an Anonymous FunctionExpression with a strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
"use strict"; (function () {
return (function () { "use strict";
return gNonStrict(); return (function () {
return gNonStrict();
})();
})(); })();
})(); });
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration with a strict directive non-strict function (FunctionDeclaration with a strict directive
prologue defined within a FunctionDeclaration) prologue defined within a FunctionDeclaration)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -22,8 +21,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,15 +9,16 @@ es5id: 15.3.5.4_2-3gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (FunctionExpression defined within strict mode) strict function (FunctionExpression defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var f = function () { var f = function () {
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression with a strict directive non-strict function (FunctionExpression with a strict directive
prologue defined within a FunctionDeclaration) prologue defined within a FunctionDeclaration)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -22,8 +21,10 @@ function f1() {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression with a strict non-strict function (Anonymous FunctionExpression with a strict
directive prologue defined within a FunctionDeclaration) directive prologue defined within a FunctionDeclaration)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ function f1() {
return r; return r;
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration with a strict directive non-strict function (FunctionDeclaration with a strict directive
prologue defined within a FunctionExpression) prologue defined within a FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -22,8 +21,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression with a strict directive non-strict function (FunctionExpression with a strict directive
prologue defined within a FunctionExpression) prologue defined within a FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -22,8 +21,10 @@ var f1 = function () {
} }
return f(); return f();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression with a strict non-strict function (Anonymous FunctionExpression with a strict
directive prologue defined within a FunctionExpression) directive prologue defined within a FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -21,8 +20,10 @@ var f1 = function () {
return r; return r;
})(); })();
} }
f1();
assert.throws(TypeError, function() {
f1();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,19 +10,19 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionDeclaration with a strict directive non-strict function (FunctionDeclaration with a strict directive
prologue defined within an Anonymous FunctionExpression) prologue defined within an Anonymous FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
function f() { (function () {
"use strict"; function f() {
var r = gNonStrict(); "use strict";
return r; var r = gNonStrict();
} return r;
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,19 +10,19 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression with a strict directive non-strict function (FunctionExpression with a strict directive
prologue defined within an Anonymous FunctionExpression) prologue defined within an Anonymous FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
var f = function () { (function () {
"use strict"; var f = function () {
var r = gNonStrict(); "use strict";
return r; var r = gNonStrict();
} return r;
return f(); }
})(); return f();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,17 +10,18 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression with a strict non-strict function (Anonymous FunctionExpression with a strict
directive prologue defined within an Anonymous FunctionExpression) directive prologue defined within an Anonymous FunctionExpression)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
return (function () { (function () {
"use strict"; return (function () {
var r = gNonStrict(); "use strict";
return r; var r = gNonStrict();
return r;
})();
})(); })();
})(); });
function gNonStrict() { function gNonStrict() {

View File

@ -9,13 +9,14 @@ es5id: 15.3.5.4_2-48gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Literal getter defined within strict mode) strict function (Literal getter defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = { get foo() { return gNonStrict(); } } var o = { get foo() { return gNonStrict(); } }
o.foo;
assert.throws(TypeError, function() {
o.foo;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Literal getter includes strict directive non-strict function (Literal getter includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = { get foo() { "use strict"; return gNonStrict(); } } var o = { get foo() { "use strict"; return gNonStrict(); } }
o.foo;
assert.throws(TypeError, function() {
o.foo;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (FunctionExpression includes strict directive non-strict function (FunctionExpression includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -18,8 +17,10 @@ var f = function () {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,13 +9,14 @@ es5id: 15.3.5.4_2-50gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Literal setter defined within strict mode) strict function (Literal setter defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = { set foo(stuff) { return gNonStrict(); } } var o = { set foo(stuff) { return gNonStrict(); } }
o.foo = 7;
assert.throws(TypeError, function() {
o.foo = 7;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Literal setter includes strict directive non-strict function (Literal setter includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = { set foo(stuff) { "use strict"; return gNonStrict(); } } var o = { set foo(stuff) { "use strict"; return gNonStrict(); } }
o.foo = 8;
assert.throws(TypeError, function() {
o.foo = 8;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,14 +9,15 @@ es5id: 15.3.5.4_2-52gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Injected getter defined within strict mode) strict function (Injected getter defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = {}; var o = {};
Object.defineProperty(o, "foo", { get: function() { return gNonStrict(); } }); Object.defineProperty(o, "foo", { get: function() { return gNonStrict(); } });
o.foo;
assert.throws(TypeError, function() {
o.foo;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Injected getter includes strict directive non-strict function (Injected getter includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = {}; var o = {};
Object.defineProperty(o, "foo", { get: function() { "use strict"; return gNonStrict(); } }); Object.defineProperty(o, "foo", { get: function() { "use strict"; return gNonStrict(); } });
o.foo;
assert.throws(TypeError, function() {
o.foo;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,14 +9,15 @@ es5id: 15.3.5.4_2-54gs
description: > description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Injected setter defined within strict mode) strict function (Injected setter defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var o = {}; var o = {};
Object.defineProperty(o, "foo", { set: function(stuff) { return gNonStrict(); } }); Object.defineProperty(o, "foo", { set: function(stuff) { return gNonStrict(); } });
o.foo = 9;
assert.throws(TypeError, function() {
o.foo = 9;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Injected setter includes strict directive non-strict function (Injected setter includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var o = {}; var o = {};
Object.defineProperty(o, "foo", { set: function(stuff) { "use strict"; return gNonStrict(); } }); Object.defineProperty(o, "foo", { set: function(stuff) { "use strict"; return gNonStrict(); } });
o.foo = 10;
assert.throws(TypeError, function() {
o.foo = 10;
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
non-strict function declaration) non-strict function declaration)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; var r = gNonStrict(); return r;}; function f() { "use strict"; var r = gNonStrict(); return r;};
function foo() { return f();} function foo() { return f();}
foo();
assert.throws(TypeError, function() {
foo();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
non-strict eval) non-strict eval)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
eval("f();");
assert.throws(TypeError, function() {
eval("f();");
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
non-strict Function constructor) non-strict Function constructor)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; var r = gNonStrict(); return r;}; function f() { "use strict"; var r = gNonStrict(); return r;};
Function("return f();")();
assert.throws(TypeError, function() {
Function("return f();")();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
non-strict new'ed Function constructor) non-strict new'ed Function constructor)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; var r = gNonStrict(); return r;}; function f() { "use strict"; var r = gNonStrict(); return r;};
new Function("return f();")();
assert.throws(TypeError, function() {
new Function("return f();")();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
strict function (Anonymous FunctionExpression defined within strict function (Anonymous FunctionExpression defined within
strict mode) strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
return gNonStrict(); (function () {
})(); return gNonStrict();
})();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.apply()) Function.prototype.apply())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.apply();
assert.throws(TypeError, function() {
f.apply();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.apply(null)) Function.prototype.apply(null))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.apply(null);
assert.throws(TypeError, function() {
f.apply(null);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.apply(undefined)) Function.prototype.apply(undefined))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.apply(undefined);
assert.throws(TypeError, function() {
f.apply(undefined);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.apply(someObject)) Function.prototype.apply(someObject))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
var o = {}; var o = {};
f.apply(o);
assert.throws(TypeError, function() {
f.apply(o);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.apply(globalObject)) Function.prototype.apply(globalObject))
negative: TypeError
flags: [noStrict] flags: [noStrict]
includes: [fnGlobalObject.js] includes: [fnGlobalObject.js]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.apply(fnGlobalObject());
assert.throws(TypeError, function() {
f.apply(fnGlobalObject());
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.call()) Function.prototype.call())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.call();
assert.throws(TypeError, function() {
f.call();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.call(null)) Function.prototype.call(null))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.call(null);
assert.throws(TypeError, function() {
f.call(null);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.call(undefined)) Function.prototype.call(undefined))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.call(undefined);
assert.throws(TypeError, function() {
f.call(undefined);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.call(someObject)) Function.prototype.call(someObject))
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
var o = {}; var o = {};
f.call(o);
assert.throws(TypeError, function() {
f.call(o);
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.call(globalObject)) Function.prototype.call(globalObject))
negative: TypeError
flags: [noStrict] flags: [noStrict]
includes: [fnGlobalObject.js] includes: [fnGlobalObject.js]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.call(fnGlobalObject());
assert.throws(TypeError, function() {
f.call(fnGlobalObject());
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Anonymous FunctionExpression includes strict non-strict function (Anonymous FunctionExpression includes strict
directive prologue) directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
(function () { assert.throws(TypeError, function() {
"use strict"; (function () {
return gNonStrict(); "use strict";
})(); return gNonStrict();
})();
});
function gNonStrict() { function gNonStrict() {

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.bind()()) Function.prototype.bind()())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.bind()();
assert.throws(TypeError, function() {
f.bind()();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.bind(null)()) Function.prototype.bind(null)())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.bind(null)();
assert.throws(TypeError, function() {
f.bind(null)();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.bind(undefined)()) Function.prototype.bind(undefined)())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.bind(undefined)();
assert.throws(TypeError, function() {
f.bind(undefined)();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.bind(someObject)()) Function.prototype.bind(someObject)())
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
var o = {}; var o = {};
f.bind(o)();
assert.throws(TypeError, function() {
f.bind(o)();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,14 +10,15 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (strict function declaration called by non-strict function (strict function declaration called by
Function.prototype.bind(globalObject)()) Function.prototype.bind(globalObject)())
negative: TypeError
flags: [noStrict] flags: [noStrict]
includes: [fnGlobalObject.js] includes: [fnGlobalObject.js]
---*/ ---*/
function f() { "use strict"; return gNonStrict();}; function f() { "use strict"; return gNonStrict();};
f.bind(fnGlobalObject())();
assert.throws(TypeError, function() {
f.bind(fnGlobalObject())();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -9,13 +9,14 @@ es5id: 15.3.5.4_2-7gs
description: > description: >
Strict mode - checking access to non-strict function caller from Strict mode - checking access to non-strict function caller from
strict function (Function constructor defined within strict mode) strict function (Function constructor defined within strict mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var f = Function("return gNonStrict();"); var f = Function("return gNonStrict();");
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function (Function constructor includes strict non-strict function (Function constructor includes strict
directive prologue) directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var f = Function("\"use strict\";\nreturn gNonStrict();"); var f = Function("\"use strict\";\nreturn gNonStrict();");
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError; return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict function expression (FunctionDeclaration includes non-strict function expression (FunctionDeclaration includes
strict directive prologue) strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -22,4 +21,7 @@ function f() {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict, constructor-based function (FunctionDeclaration non-strict, constructor-based function (FunctionDeclaration
includes strict directive prologue) includes strict directive prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -20,4 +19,7 @@ function f() {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from Strict mode - checking access to strict function caller from
non-strict property (FunctionDeclaration includes strict directive non-strict property (FunctionDeclaration includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -26,4 +25,7 @@ function f() {
"use strict"; "use strict";
return o.gNonStrict; return o.gNonStrict;
} }
f();
assert.throws(TypeError, function() {
f();
});

View File

@ -10,7 +10,6 @@ description: >
Strict mode - checking access to strict function caller from bound Strict mode - checking access to strict function caller from bound
non-strict function (FunctionDeclaration includes strict directive non-strict function (FunctionDeclaration includes strict directive
prologue) prologue)
negative: TypeError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
@ -20,8 +19,10 @@ function f() {
"use strict"; "use strict";
return gNonStrict(); return gNonStrict();
} }
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrictBindee() { function gNonStrictBindee() {
return gNonStrictBindee.caller || gNonStrictBindee.caller.throwTypeError; return gNonStrictBindee.caller || gNonStrictBindee.caller.throwTypeError;

View File

@ -10,13 +10,14 @@ description: >
Strict mode - checking access to non-strict function caller from Strict mode - checking access to non-strict function caller from
strict function (New'ed Function constructor defined within strict strict function (New'ed Function constructor defined within strict
mode) mode)
negative: TypeError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var f = new Function("return gNonStrict();"); var f = new Function("return gNonStrict();");
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() { function gNonStrict() {
return gNonStrict.caller; return gNonStrict.caller;

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.3_A13 es5id: 15.3.4.3_A13
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.apply.call(undefined, {}, []); assert.throws(TypeError, function() {
Function.prototype.apply.call(undefined, {}, []);
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.3_A14 es5id: 15.3.4.3_A14
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.apply.call(null, {}, []); assert.throws(TypeError, function() {
Function.prototype.apply.call(null, {}, []);
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.3_A15 es5id: 15.3.4.3_A15
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.apply.call({}, {}, []); assert.throws(TypeError, function() {
Function.prototype.apply.call({}, {}, []);
});

View File

@ -5,10 +5,12 @@
info: "\"caller\" of bound function is poisoned (step 20)" info: "\"caller\" of bound function is poisoned (step 20)"
es5id: 15.3.4.5_A1 es5id: 15.3.4.5_A1
description: A bound function should fail to find its "caller" description: A bound function should fail to find its "caller"
negative: TypeError
---*/ ---*/
function foo() { return bar.caller; } function foo() { return bar.caller; }
var bar = foo.bind({}); var bar = foo.bind({});
function baz() { return bar(); } function baz() { return bar(); }
baz();
assert.throws(TypeError, function() {
baz();
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.5_A13 es5id: 15.3.4.5_A13
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.bind.call(undefined, {}); assert.throws(TypeError, function() {
Function.prototype.bind.call(undefined, {});
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.5_A14 es5id: 15.3.4.5_A14
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.bind.call(null, {}); assert.throws(TypeError, function() {
Function.prototype.bind.call(null, {});
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.5_A15 es5id: 15.3.4.5_A15
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.bind.call({}, {}); assert.throws(TypeError, function() {
Function.prototype.bind.call({}, {});
});

View File

@ -5,10 +5,12 @@
info: "\"arguments\" of bound function is poisoned (step 21)" info: "\"arguments\" of bound function is poisoned (step 21)"
es5id: 15.3.4.5_A2 es5id: 15.3.4.5_A2
description: a bound function should fail to find the bound function "arguments" description: a bound function should fail to find the bound function "arguments"
negative: TypeError
---*/ ---*/
function foo() { return bar.arguments; } function foo() { return bar.arguments; }
var bar = foo.bind({}); var bar = foo.bind({});
function baz() { return bar(); } function baz() { return bar(); }
baz();
assert.throws(TypeError, function() {
baz();
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.4_A13 es5id: 15.3.4.4_A13
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.call.call(undefined, {}); assert.throws(TypeError, function() {
Function.prototype.call.call(undefined, {});
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.4_A14 es5id: 15.3.4.4_A14
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.call.call(null, {}); assert.throws(TypeError, function() {
Function.prototype.call.call(null, {});
});

View File

@ -4,7 +4,8 @@
/*--- /*---
es5id: 15.3.4.4_A15 es5id: 15.3.4.4_A15
description: If IsCallable(func) is false, then throw a TypeError exception. description: If IsCallable(func) is false, then throw a TypeError exception.
negative: TypeError
---*/ ---*/
Function.prototype.call.call({}, {}); assert.throws(TypeError, function() {
Function.prototype.call.call({}, {});
});

View File

@ -6,7 +6,8 @@ es5id: 15.3.4.2_A12
description: > description: >
The Function.prototype.toString function is not generic; it throws The Function.prototype.toString function is not generic; it throws
a TypeError exception if its this value is not a Function object. a TypeError exception if its this value is not a Function object.
negative: TypeError
---*/ ---*/
Function.prototype.toString.call(undefined); assert.throws(TypeError, function() {
Function.prototype.toString.call(undefined);
});

View File

@ -6,7 +6,8 @@ es5id: 15.3.4.2_A13
description: > description: >
The toString function is not generic; it throws a TypeError The toString function is not generic; it throws a TypeError
exception if its this value is not a Function object. exception if its this value is not a Function object.
negative: TypeError
---*/ ---*/
Function.prototype.toString.call(null); assert.throws(TypeError, function() {
Function.prototype.toString.call(null);
});

View File

@ -6,7 +6,8 @@ es5id: 15.3.4.2_A14
description: > description: >
The toString function is not generic; it throws a TypeError The toString function is not generic; it throws a TypeError
exception if its this value is not a Function object. exception if its this value is not a Function object.
negative: TypeError
---*/ ---*/
Function.prototype.toString.call({}); assert.throws(TypeError, function() {
Function.prototype.toString.call({});
});

View File

@ -9,7 +9,8 @@ es5id: 15.3.4.2_A15
description: > description: >
Whether or not they are callable, RegExp objects are not Function Whether or not they are callable, RegExp objects are not Function
objects, so toString should throw a TypeError. objects, so toString should throw a TypeError.
negative: TypeError
---*/ ---*/
Function.prototype.toString.call(/x/); assert.throws(TypeError, function() {
Function.prototype.toString.call(/x/);
});

View File

@ -10,9 +10,10 @@ description: >
The String constructor, given an object, should invoke that The String constructor, given an object, should invoke that
object's toString method as a method, i.e., with its this value object's toString method as a method, i.e., with its this value
bound to that object. bound to that object.
negative: TypeError
---*/ ---*/
var obj = {toString: Function.prototype.toString}; var obj = {toString: Function.prototype.toString};
String(obj); assert.throws(TypeError, function() {
String(obj);
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.5_A12
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.hasOwnProperty.call(undefined, 'foo'); assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(undefined, 'foo');
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.5_A13
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.hasOwnProperty.call(null, 'foo'); assert.throws(TypeError, function() {
Object.prototype.hasOwnProperty.call(null, 'foo');
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.6_A12
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.isPrototypeOf.call(undefined, {}); assert.throws(TypeError, function() {
Object.prototype.isPrototypeOf.call(undefined, {});
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.6_A13
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.isPrototypeOf.call(null, {}); assert.throws(TypeError, function() {
Object.prototype.isPrototypeOf.call(null, {});
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.7_A12
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.propertyIsEnumerable.call(undefined, 'foo'); assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(undefined, 'foo');
});

View File

@ -6,7 +6,8 @@ es5id: 15.2.4.7_A13
description: > description: >
Let O be the result of calling ToObject passing the this value as Let O be the result of calling ToObject passing the this value as
the argument. the argument.
negative: TypeError
---*/ ---*/
Object.prototype.propertyIsEnumerable.call(null, 'foo'); assert.throws(TypeError, function() {
Object.prototype.propertyIsEnumerable.call(null, 'foo');
});

Some files were not shown because too many files have changed in this diff Show More