summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webstorage/storage_supported_property_names.html
blob: d2911d867fef7752b1be963ce12d3602cd946cf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Storage Test: Supported property names</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
    ["localStorage", "sessionStorage"].forEach(function(name) {
        test(function() {
            var storage = window[name];
            storage.clear();

            storage["name"] = "user1";
            assert_array_equals(Object.getOwnPropertyNames(storage), ['name']);
        }, "Object.getOwnPropertyNames on " + name + " Storage");

        test(function() {
            var storage = window[name];
            storage.clear();
            assert_array_equals(Object.getOwnPropertyNames(storage), []);
        }, "Object.getOwnPropertyNames on " + name + " storage with empty collection");
    });
</script>