| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
gTestfile = 'regress-354998.js'; |
| 8 |
|
| 9 |
var BUGNUMBER = 354998; |
| 10 |
var summary = 'prototype should not be enumerated for XML objects.'; |
| 11 |
var actual = ''; |
| 12 |
var expect = ''; |
| 13 |
|
| 14 |
printBugNumber(BUGNUMBER); |
| 15 |
START(summary); |
| 16 |
|
| 17 |
function test() |
| 18 |
{ |
| 19 |
var list = <><a/><b/></>; |
| 20 |
var count = 0; |
| 21 |
var now = Date.now; |
| 22 |
var time = now(); |
| 23 |
for (var i in list) { |
| 24 |
++count; |
| 25 |
} |
| 26 |
time = now() - time; |
| 27 |
if (count != 2) { |
| 28 |
if (count < 2) |
| 29 |
throw "Enumerator has not looped over all properties, count="+count; |
| 30 |
throw "Enumerator has looped over prototype chain of xml, count="+count; |
| 31 |
} |
| 32 |
return time; |
| 33 |
} |
| 34 |
|
| 35 |
try |
| 36 |
{ |
| 37 |
var time1 = test(); |
| 38 |
|
| 39 |
for (var i = 0; i != 1000*1000; ++i) |
| 40 |
Object.prototype[i] = i; |
| 41 |
|
| 42 |
var time2 = test(); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
for (var i = 0; i != 1000*1000; ++i) |
| 48 |
delete Object.prototype[i]; |
| 49 |
|
| 50 |
if (time1 * 10 + 1 < time2) { |
| 51 |
throw "Assigns to Object.prototype increased time of XML enumeration from "+ |
| 52 |
time1+"ms to "+time2+"ms"; |
| 53 |
} |
| 54 |
} |
| 55 |
catch(ex) |
| 56 |
{ |
| 57 |
actual = ex = ''; |
| 58 |
} |
| 59 |
|
| 60 |
TEST(1, expect, actual); |
| 61 |
|
| 62 |
END(); |