Merge pull request #360 from bocoup/negative-reform

Negative reform
This commit is contained in:
Brian Terlson 2015-07-16 15:31:22 -07:00
commit 13ebbebfd6
174 changed files with 644 additions and 458 deletions

View File

@ -5,7 +5,6 @@
info: Array.prototype.splice sets `length` on `this`
es5id: 15.4.4.12_A6.1_T2
description: Array.prototype.splice throws if `length` is read-only
negative: TypeError
---*/
var a = [0, 1, 2];
@ -14,4 +13,6 @@ Object.defineProperty(a, 'length', {
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: >
StrictMode - error is thrown when reading the 'caller' property of
a function object
negative: TypeError
flags: [onlyStrict]
---*/
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
non-strict function (New'ed Function constructor includes strict
directive prologue)
negative: TypeError
flags: [noStrict]
---*/
var f = new Function("\"use strict\";\nreturn gNonStrict();");
f();
assert.throws(TypeError, function() {
f();
});
function gNonStrict() {
return gNonStrict.caller || gNonStrict.caller.throwTypeError;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,8 @@
/*---
es5id: 15.3.4.3_A13
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
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
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)"
es5id: 15.3.4.5_A1
description: A bound function should fail to find its "caller"
negative: TypeError
---*/
function foo() { return bar.caller; }
var bar = foo.bind({});
function baz() { return bar(); }
baz();
assert.throws(TypeError, function() {
baz();
});

View File

@ -4,7 +4,8 @@
/*---
es5id: 15.3.4.5_A13
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
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
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)"
es5id: 15.3.4.5_A2
description: a bound function should fail to find the bound function "arguments"
negative: TypeError
---*/
function foo() { return bar.arguments; }
var bar = foo.bind({});
function baz() { return bar(); }
baz();
assert.throws(TypeError, function() {
baz();
});

View File

@ -4,7 +4,8 @@
/*---
es5id: 15.3.4.4_A13
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
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
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: >
The Function.prototype.toString function is not generic; it throws
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: >
The toString function is not generic; it throws a TypeError
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: >
The toString function is not generic; it throws a TypeError
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: >
Whether or not they are callable, RegExp objects are not Function
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
object's toString method as a method, i.e., with its this value
bound to that object.
negative: TypeError
---*/
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: >
Let O be the result of calling ToObject passing the this value as
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: >
Let O be the result of calling ToObject passing the this value as
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: >
Let O be the result of calling ToObject passing the this value as
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: >
Let O be the result of calling ToObject passing the this value as
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: >
Let O be the result of calling ToObject passing the this value as
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: >
Let O be the result of calling ToObject passing the this value as
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