Revision ad91075ffdead7446438c989400d86663fe79d20 authored by Anne van Kesteren on 12 April 2018, 11:25:13 UTC, committed by Anne van Kesteren on 12 April 2018, 11:25:13 UTC
Needed for https://github.com/whatwg/fetch/issues/664 and https://github.com/whatwg/fetch/pull/600.
1 parent 19a42b9
storage_functions_not_overwritten.html
<!DOCTYPE HTML>
<html>
<head>
<title>WebStorage Test: Storage - set key with the same name as storage function</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
["localStorage", "sessionStorage"].forEach(function(name) {
test(function() {
var storage = window[name];
storage.clear();
runTest();
function doWedgeThySelf() {
storage.setItem("clear", "almost");
storage.setItem("key", "too");
storage.setItem("getItem", "funny");
storage.setItem("removeItem", "to");
storage.setItem("length", "be");
storage.setItem("setItem", "true");
}
function runTest() {
doWedgeThySelf();
assert_equals(storage.getItem('clear'), "almost");
assert_equals(storage.getItem('key'), "too");
assert_equals(storage.getItem('getItem'), "funny");
assert_equals(storage.getItem('removeItem'), "to");
assert_equals(storage.getItem('length'), "be");
assert_equals(storage.getItem('setItem'), "true");
// Test to see if an exception is thrown for any of the built in
// functions.
storage.setItem("test", "123");
storage.key(0);
storage.getItem("test");
storage.removeItem("test");
storage.clear();
assert_equals(storage.length, 0);
}
}, name + " should be not rendered unusable by setting a key with the same name as a storage function such that the function is hidden");
});
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...