blob: 6b97e82ea723498c20d2f472ea2851d2c98667d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
function raisesException(exception) {
return function (code) {
eval(code);
};
};
function obj() {
var o = { assertEq: true, y: 1 };
Object.defineProperty(o, 'x', { writable: false });
return o;
}
function in_strict_with(expr) {
return "with(obj()) { (function () { 'use strict'; " + expr + " })(); }";
}
try { assertEq(raisesException(TypeError)(in_strict_with('x++;')), true); } catch (e) {}
|