1 description("This test checks to ensure that window.localStorage and window.sessionStorage are not rendered unusable by setting a key with the same name as a storage function such that the function is hidden.");
4 testRunner.dumpAsText();
6 function doWedgeThySelf(storage) {
7 storage.setItem("clear", "almost");
8 storage.setItem("key", "too");
9 storage.setItem("getItem", "funny");
10 storage.setItem("removeItem", "to");
11 storage.setItem("length", "be");
12 storage.setItem("setItem", "true");
15 function testStorage(storageString) {
16 storage = eval(storageString);
18 doWedgeThySelf(storage);
19 shouldBeEqualToString("storage.getItem('clear')", "almost");
20 shouldBeEqualToString("storage.getItem('key')", "too");
21 shouldBeEqualToString("storage.getItem('getItem')", "funny");
22 shouldBeEqualToString("storage.getItem('removeItem')", "to");
23 shouldBeEqualToString("storage.getItem('length')", "be");
24 shouldBeEqualToString("storage.getItem('setItem')", "true");
26 // Test to see if an exception is thrown for any of the built in
28 storage.setItem("test", "123");
30 storage.getItem("test");
31 storage.removeItem("test");
33 if (storage.length != 0)
34 throw name + ": length wedged";
40 testStorage(window.sessionStorage);
41 testStorage(window.localStorage);
47 testFailed("Caught an exception!");