Implement Storage::SupportedPropertyNames

This commit is contained in:
Mathieu Rheaume 2015-09-20 22:24:00 -04:00
parent f30f40b12d
commit e7a3220bc1
5 changed files with 50 additions and 3 deletions

View file

@ -13139,6 +13139,10 @@
"path": "dom/collections/HTMLCollection-supported-property-names.html",
"url": "/dom/collections/HTMLCollection-supported-property-names.html"
},
{
"path": "dom/collections/storage-supported-property-names.html",
"url": "/dom/collections/storage-supported-property-names.html"
},
{
"path": "dom/events/Event-constants.html",
"url": "/dom/events/Event-constants.html"
@ -34616,4 +34620,4 @@
"rev": "0159b3ec9ba5355a3340621226e02ae026effd7f",
"url_base": "/",
"version": 2
}
}

View file

@ -0,0 +1,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>