File: main.js

package info (click to toggle)
node-rollup 3.29.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 53,520 kB
  • sloc: javascript: 115,081; sh: 26; makefile: 18
file content (27 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const wrapper = {
	foo() {
		assert.notEqual(this, wrapper);
	}
};

// Indirectly called member expressions set the callee's context to global "this"
(true && wrapper.foo)();
(true ? wrapper.foo : null)();
(1, 2, wrapper.foo)();
(true && (true && wrapper.foo))();
(true && (true ? wrapper.foo : null))();
(true && (1, 2, wrapper.foo))();

function evoke(callee, arg) {
	return callee(arg);
}

// Indirectly invoked eval is executed in the global scope
function testEval() {
	assert.notEqual((true && eval)('this'), 'test');
	assert.notEqual((true ? eval : null)('this'), 'test');
	assert.notEqual((1, 2, eval)('this'), 'test');
	assert.equal(evoke(true && eval, '42'), '42');
}

testEval.call('test');