| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-434837-01.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 434837; |
| 9 |
var summary = '|this| in accessors in prototype chain of array'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
test(); |
| 16 |
|
| 17 |
|
| 18 |
function test() |
| 19 |
{ |
| 20 |
enterFunc ('test'); |
| 21 |
printBugNumber(BUGNUMBER); |
| 22 |
printStatus (summary); |
| 23 |
|
| 24 |
try |
| 25 |
{ |
| 26 |
expect = true; |
| 27 |
actual = null; |
| 28 |
x = [ "one", "two" ]; |
| 29 |
Array.prototype.__defineGetter__('test1', function() { actual = (this === x); }); |
| 30 |
x.test1; |
| 31 |
} |
| 32 |
catch(ex) |
| 33 |
{ |
| 34 |
actual = ex + ''; |
| 35 |
} |
| 36 |
reportCompare(expect, actual, summary + ': x.test1'); |
| 37 |
|
| 38 |
try |
| 39 |
{ |
| 40 |
expect = false; |
| 41 |
actual = null; |
| 42 |
Array.prototype.__defineGetter__('test2', function() { actual = (this === Array.prototype) }); |
| 43 |
x.test2; |
| 44 |
} |
| 45 |
catch(ex) |
| 46 |
{ |
| 47 |
actual = ex + ''; |
| 48 |
} |
| 49 |
reportCompare(expect, actual, summary + ': x.test2'); |
| 50 |
|
| 51 |
Array.prototype.__defineGetter__('test3', function() { actual = (this === x) }); |
| 52 |
Array.prototype.__defineSetter__('test3', function() { actual = (this === x) }); |
| 53 |
|
| 54 |
try |
| 55 |
{ |
| 56 |
expect = true; |
| 57 |
actual = null; |
| 58 |
x.test3; |
| 59 |
} |
| 60 |
catch(ex) |
| 61 |
{ |
| 62 |
actual = ex + ''; |
| 63 |
} |
| 64 |
reportCompare(expect, actual, summary + ': x.test3 (1)'); |
| 65 |
|
| 66 |
try |
| 67 |
{ |
| 68 |
expect = true; |
| 69 |
actual = null; |
| 70 |
x.test3 = 5; |
| 71 |
} |
| 72 |
catch(ex) |
| 73 |
{ |
| 74 |
actual = ex + ''; |
| 75 |
} |
| 76 |
reportCompare(expect, actual, summary + ': x.test3 = 5'); |
| 77 |
|
| 78 |
try |
| 79 |
{ |
| 80 |
expect = true; |
| 81 |
actual = null; |
| 82 |
x.test3; |
| 83 |
} |
| 84 |
catch(ex) |
| 85 |
{ |
| 86 |
actual = ex + ''; |
| 87 |
} |
| 88 |
reportCompare(expect, actual, summary + ': x.test3 (2)'); |
| 89 |
|
| 90 |
exitFunc ('test'); |
| 91 |
} |