| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <title>WebStorage Test: Storage - enumerate and built-in properties</title> |
| 5 <script src="../../../resources/testharness.js"></script> |
| 6 <script src="../../../resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <div id="log"></div> |
| 10 <script> |
| 11 ["localStorage", "sessionStorage"].forEach(function(name) { |
| 12 test(function() { |
| 13 assert_true(name in window, name + " exist"); |
| 14 |
| 15 var storage = window[name]; |
| 16 storage.clear(); |
| 17 |
| 18 Storage.prototype.prototypeTestKey = "prototypeTestValue"; |
| 19 storage.foo = "bar"; |
| 20 storage.fu = "baz"; |
| 21 storage.batman = "bin suparman"; |
| 22 storage.bar = "foo"; |
| 23 storage.alpha = "beta"; |
| 24 storage.zeta = "gamma"; |
| 25 |
| 26 var enumeratedArray = new Array(); |
| 27 for (var n in storage) |
| 28 enumeratedArray.push(n); |
| 29 |
| 30 // Sort the array, since the storage order isn't guaranteed |
| 31 enumeratedArray.sort(); |
| 32 |
| 33 var expectArray = ["alpha", "bar", "batman", "foo", "fu", "prototypeTest
Key", "zeta"]; |
| 34 assert_array_equals(enumeratedArray, expectArray); |
| 35 |
| 36 }, name + ": enumerate a Storage object and get only the keys as a result an
d the built-in properties of the Storage object should be ignored"); |
| 37 }); |
| 38 </script> |
| 39 </body> |
| 40 </html> |
| 41 |
| OLD | NEW |