blob: 5beb17ddf5c50558e3d3ea7bea4f6cd4af8f5172 [file] [log] [blame]
let expectedThis;
function applyHandler(target, thisValue) {
if (thisValue !== expectedThis)
throw new Error("got weird this value: " + thisValue);
}
let handler = {
apply: applyHandler
};
let f = new Proxy(function() {}, handler);
function withScope(o) {
with (o) {
f();
}
}
function lexicalScope() {
let x;
f();
}
// globalScope
f();
function strictEvalScope() {
"use strict";
eval("var x; f();");
}
let primitives = [undefined, null, true, 1.324, "test", Symbol("test"), BigInt(12), {}, []];
for (let primitive of primitives) {
expectedThis = primitive;
f.call(primitive);
}