summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/misc/getter-setter-outerize-this.js
blob: 46c61b889a5b7be617790a755eab7106e9959d45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if (typeof window === "undefined") {
    // This test is meant to run in the browser, but it's easy to
    // run it in the shell as well, even though it has no inner/outer
    // windows.
    window = this;
}

var res = false;
Object.defineProperty(this, "foo", {configurable: true,
				    get: function() { return this === window; },
				    set: function(v) { res = this === window; }});

(function() {
    for (var i = 0; i < 3000; ++i) {
	window.foo = i;
	assertEq(res, true, "setter");
	assertEq(window.foo, true, "getter");
    }
})();

reportCompare(true, true);