js/src/jit-test/tests/basic/bug657227.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/bug657227.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +var obj;
     1.5 +var counter = 0;
     1.6 +var p = Proxy.create({
     1.7 +    has : function(id) {
     1.8 +	if (id == 'xyz') {
     1.9 +	    ++counter;
    1.10 +	    if (counter == 7) {
    1.11 +		obj.__proto__ = null;
    1.12 +	    }
    1.13 +	    return true;
    1.14 +	}
    1.15 +	return false;
    1.16 +    },
    1.17 +    get : function(id) {
    1.18 +	if (id == 'xyz')
    1.19 +	    return 10;
    1.20 +    }
    1.21 +});
    1.22 +
    1.23 +function test()
    1.24 +{
    1.25 +    Object.prototype.__proto__ = null;
    1.26 +    obj = { xyz: 1};
    1.27 +    var n = 0;
    1.28 +    for (var i = 0; i != 100; ++i) {
    1.29 +	var s = obj.xyz;
    1.30 +	if (s)
    1.31 +	    ++n;
    1.32 +	if (i == 10) {
    1.33 +	    delete obj.xyz;
    1.34 +	    Object.prototype.__proto__ = p;
    1.35 +	}
    1.36 +
    1.37 +    }
    1.38 +}
    1.39 +
    1.40 +try {
    1.41 +    test();
    1.42 +} catch (e) {}

mercurial