| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-340199.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 340199; |
| 9 |
var summary = 'User-defined __iterator__ can be called through XPCNativeWrappers'; |
| 10 |
var actual = 'Not called'; |
| 11 |
var expect = 'Not called'; |
| 12 |
|
| 13 |
printBugNumber(BUGNUMBER); |
| 14 |
printStatus (summary); |
| 15 |
|
| 16 |
if (typeof window == 'undefined' || |
| 17 |
typeof XPCNativeWrapper == 'undefined') |
| 18 |
{ |
| 19 |
reportCompare("window or XPCNativeWrapper not defined, Test skipped.", |
| 20 |
"window or XPCNativeWrapper not defined, Test skipped.", |
| 21 |
summary); |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
Object.prototype.__iterator__ = |
| 26 |
function () { actual = "User code called"; print(actual); }; |
| 27 |
|
| 28 |
try |
| 29 |
{ |
| 30 |
for (var i in XPCNativeWrapper(window)) |
| 31 |
{ |
| 32 |
try |
| 33 |
{ |
| 34 |
print(i); |
| 35 |
} |
| 36 |
catch(ex) |
| 37 |
{ |
| 38 |
print(ex); |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
catch(ex) |
| 43 |
{ |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
delete Object.prototype.__iterator__; |
| 48 |
} |
| 49 |
|
| 50 |
reportCompare(expect, actual, summary); |