mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-14 19:27:30 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("name", "user2");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
localStorage.clear();
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage != null){
|
||||
try {
|
||||
localStorage.setItem("Security", "false");
|
||||
parent.localStorage.clear();
|
||||
} catch (e) {
|
||||
if(e.code == e['SECURITY_ERR'])
|
||||
localStorage.setItem("Security", "true");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
localStorage.clear();
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('localStorage' in window) && window.localStorage !== null){
|
||||
try {
|
||||
localStorage.setItem("name", "user1");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
} else {
|
||||
parent.fail("localStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("name", "user2");
|
||||
} catch (e) {
|
||||
parent.fail("setItem method is failed.");
|
||||
}
|
||||
sessionStorage.clear();
|
||||
} else {
|
||||
parent.fail("sessionStorage is not supported.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem('name', 'user1');
|
||||
} catch (e) {
|
||||
parent.fail('setItem method is failed.');
|
||||
}
|
||||
sessionStorage.clear();
|
||||
} else {
|
||||
parent.fail('sessionStorage is not supported.');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
if (('sessionStorage' in window) && window.sessionStorage !== null){
|
||||
try {
|
||||
sessionStorage.setItem('name', 'user1');
|
||||
} catch (e) {
|
||||
parent.fail('setItem method is failed.');
|
||||
}
|
||||
} else {
|
||||
parent.fail('sessionStorage is not supported.');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_Constructor</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.type, 'storage');
|
||||
assert_equals(event.key, null);
|
||||
assert_equals(event.oldValue, null);
|
||||
assert_equals(event.newValue, null);
|
||||
assert_equals(event.url, '');
|
||||
assert_equals(event.storageArea, null);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
var event = new StorageEvent('storage');
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("key property test of local event");
|
||||
var expected = ['name', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_clear_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_newValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("newValue property test of local event");
|
||||
var expected = ['user1', 'user2', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.newValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_oldValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("oldValue property test of local event");
|
||||
var expected = [null, 'user1', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.oldValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_storageArea</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("storageArea property test of local event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.storageArea.length, 1);
|
||||
var key = event.storageArea.key(0);
|
||||
var value = event.storageArea.getItem(key);
|
||||
assert_equals(key, "name");
|
||||
assert_equals(value, "user1");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_StorageEventInit</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, 'key');
|
||||
assert_equals(event.oldValue, 'oldValue');
|
||||
assert_equals(event.newValue, 'newValue');
|
||||
assert_equals(event.url, window.location.href);
|
||||
assert_equals(event.storageArea, window.localStorage);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var event = new StorageEvent('storage', {
|
||||
key: 'key',
|
||||
oldValue: 'oldValue',
|
||||
newValue: 'newValue',
|
||||
url: window.location.href,
|
||||
storageArea: window.localStorage
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_local_url</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
var t = async_test("url property test of local event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
var url = window.location.href;
|
||||
|
||||
var pos = url.lastIndexOf("/");
|
||||
if (pos != -1) {
|
||||
url = url.substr(0, pos + 1);
|
||||
url = url + "iframe/local_set_item_iframe.html";
|
||||
}
|
||||
|
||||
assert_equals(event.url, url);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/local_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("key property test of session event");
|
||||
var expected = ['name', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_clear_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_newValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("newvalue property test of session event");
|
||||
var expected = ['user1', 'user2', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.newValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_oldValue</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("oldvalue property test of session event");
|
||||
var expected = [null, 'user1', null]
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.oldValue, expected.shift());
|
||||
});
|
||||
if (!expected.length) {
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_change_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_storageArea</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageArea property test of session event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.storageArea.length, 1);
|
||||
var key = event.storageArea.key(0);
|
||||
var value = event.storageArea.getItem(key);
|
||||
assert_equals(key, "name");
|
||||
assert_equals(value, "user1");
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_StorageEventInit</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("storageeventinit test");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.key, 'key');
|
||||
assert_equals(event.oldValue, 'oldValue');
|
||||
assert_equals(event.newValue, 'newValue');
|
||||
assert_equals(event.url, window.location.href);
|
||||
assert_equals(event.storageArea, window.sessionStorage);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var event = new StorageEvent('storage', {
|
||||
key: 'key',
|
||||
oldValue: 'oldValue',
|
||||
newValue: 'newValue',
|
||||
url: window.location.href,
|
||||
storageArea: window.sessionStorage
|
||||
});
|
||||
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function fail(msg) {
|
||||
t.step(function() {
|
||||
assert_notreached(msg);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_session_url</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
var t = async_test("url property test of session event");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
var url = window.location.href;
|
||||
|
||||
var pos = url.lastIndexOf("/");
|
||||
if (pos != -1) {
|
||||
url = url.substr(0, pos + 1);
|
||||
url = url + "iframe/session_set_item_iframe.html";
|
||||
}
|
||||
|
||||
assert_equals(event.url, url);
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
|
||||
var el = document.createElement("iframe");
|
||||
el.setAttribute('id', 'ifrm');
|
||||
el.setAttribute('src', 'iframe/session_set_item_iframe.html');
|
||||
document.body.appendChild(el);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(localStorage.getItem("name"), null);
|
||||
assert_equals(localStorage.length, 1);
|
||||
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
test(function() {
|
||||
assert_equals(localStorage.getItem("name"), "user1", "localStorage.getItem('name')")
|
||||
assert_equals(localStorage.getItem("unknown"), null, "localStorage.getItem('unknown')")
|
||||
}, "getItem method test")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
localStorage.setItem("a", "1");
|
||||
localStorage.setItem("b", "2");
|
||||
|
||||
var keys = ["name", "age", "a", "b"];
|
||||
function doTest(index) {
|
||||
test(function() {
|
||||
var key = localStorage.key(index);
|
||||
assert_not_equals(key, null);
|
||||
assert_true(keys.indexOf(key) >= 0,
|
||||
"Unexpected key " + key + " found.");
|
||||
}, "key(" + index + ") should return the right thing.");
|
||||
}
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
doTest(i);
|
||||
doTest(i + 0x100000000);
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(localStorage.key(-1), null, "localStorage.key(-1)");
|
||||
assert_equals(localStorage.key(4), null, "localStorage.key(4)");
|
||||
}, "key() should return null for out-of-range arguments.");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
|
||||
localStorage.setItem("name", "user1");
|
||||
localStorage.setItem("age", "20");
|
||||
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
|
||||
localStorage.removeItem("name");
|
||||
localStorage.removeItem("unknown");
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_security</h1>
|
||||
<iframe id="frame" src="iframe/local_security_iframe.html" style="width: 0px; height: 0px;"></iframe>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t1 = async_test('storage local security test');
|
||||
|
||||
iframeWindow = document.getElementById('frame').contentWindow;
|
||||
|
||||
setTimeout(function(){
|
||||
try {
|
||||
var errFlag =iframeWindow.localStorage.getItem("Security");
|
||||
t1.step(function() {
|
||||
assert_equals(errFlag, "true", 'SECURITY_ERR error is not raised.')
|
||||
});
|
||||
} catch (e) {
|
||||
t1.step(function() {
|
||||
assert_unreached('Error is raised.');
|
||||
});
|
||||
}
|
||||
t1.done();
|
||||
}, 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.length, 1, "localStorage.setItem")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(sessionStorage.getItem("name"), null);
|
||||
assert_equals(sessionStorage.length, 1);
|
||||
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.getItem("name"), "user1", "sessionStorage.getItem('name')")
|
||||
assert_equals(sessionStorage.getItem("unknown"), null, "sessionStorage.getItem('unknown')")
|
||||
}, "getItem method test")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_key</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
sessionStorage.setItem("a", "1");
|
||||
sessionStorage.setItem("b", "2");
|
||||
|
||||
var keys = ["name", "age", "a", "b"];
|
||||
function doTest(index) {
|
||||
test(function() {
|
||||
var key = sessionStorage.key(index);
|
||||
assert_not_equals(key, null);
|
||||
assert_true(keys.indexOf(key) >= 0,
|
||||
"Unexpected key " + key + " found.");
|
||||
}, "key(" + index + ") should return the right thing.");
|
||||
}
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
doTest(i);
|
||||
doTest(i + 0x100000000);
|
||||
}
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.key(-1), null, "sessionStorage.key(-1)");
|
||||
assert_equals(sessionStorage.key(4), null, "sessionStorage.key(4)");
|
||||
}, "key() should return null for out-of-range arguments.");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
|
||||
sessionStorage.setItem("name", "user1");
|
||||
sessionStorage.setItem("age", "20");
|
||||
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
|
||||
sessionStorage.removeItem("name");
|
||||
sessionStorage.removeItem("unknown");
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.length, 1, "localStorage.setItem")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
function test_storage_builtins(aStorage) {
|
||||
test(function() {
|
||||
aStorage.clear();
|
||||
assert_equals(aStorage.length, 0, "aStorage.length");
|
||||
|
||||
var builtins = ["key", "getItem", "setItem", "removeItem", "clear"];
|
||||
var origBuiltins = builtins.map(function(b) { return Storage.prototype[b]; });
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage[b]; }), origBuiltins, "a");
|
||||
builtins.forEach(function(b) { aStorage[b] = b; });
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage[b]; }), origBuiltins, "b");
|
||||
assert_array_equals(builtins.map(function(b) { return aStorage.getItem(b); }), builtins, "c");
|
||||
|
||||
assert_equals(aStorage.length, builtins.length, "aStorage.length");
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>event_Constructor</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = async_test("StorageEvent constructor and nulls");
|
||||
function onStorageEvent(event) {
|
||||
t.step(function() {
|
||||
assert_equals(event.type, 'storage', 'type');
|
||||
assert_equals(event.key, null, 'key');
|
||||
assert_equals(event.oldValue, null, 'oldValue');
|
||||
assert_equals(event.newValue, null, 'newValue');
|
||||
assert_equals(event.url, 'null', 'url');
|
||||
assert_equals(event.storageArea, null, 'storageArea');
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
|
||||
window.addEventListener('storage', onStorageEvent, false);
|
||||
var event = new StorageEvent('storage', {
|
||||
key: null,
|
||||
oldValue: null,
|
||||
newValue: null,
|
||||
url: null
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>missing_arguments</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = [
|
||||
function() { localStorage.key(); },
|
||||
function() { localStorage.getItem(); },
|
||||
function() { localStorage.setItem(); },
|
||||
function() { localStorage.setItem("a"); },
|
||||
function() { localStorage.removeItem(); },
|
||||
function() { sessionStorage.key(); },
|
||||
function() { sessionStorage.getItem(); },
|
||||
function() { sessionStorage.setItem(); },
|
||||
function() { sessionStorage.setItem("a"); },
|
||||
function() { sessionStorage.removeItem(); },
|
||||
function() { new StorageEvent(); }
|
||||
];
|
||||
tests.forEach(function(fun) {
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), fun);
|
||||
}, "Should throw TypeError for " + format_value(fun) + ".");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="storage_builtins.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_builtins</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test_storage_builtins(localStorage);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(localStorage.name, undefined);
|
||||
assert_equals(localStorage.length, 1);
|
||||
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.name, undefined, "localStorage.name")
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("undefined", "foo");
|
||||
localStorage.setItem("null", "bar");
|
||||
localStorage.setItem("", "baz");
|
||||
test(function() {
|
||||
assert_equals(localStorage.length, 3);
|
||||
}, "All 3 items should be added.");
|
||||
test(function() {
|
||||
assert_equals(localStorage["unknown"], undefined, "localStorage['unknown']")
|
||||
assert_equals(localStorage["undefined"], "foo", "localStorage['undefined']")
|
||||
assert_equals(localStorage["null"], "bar", "localStorage['null']")
|
||||
assert_equals(localStorage[undefined], "foo", "localStorage[undefined]")
|
||||
assert_equals(localStorage[null], "bar", "localStorage[null]")
|
||||
assert_equals(localStorage[""], "baz", "localStorage['']")
|
||||
}, "array access should be correct");
|
||||
test(function() {
|
||||
assert_equals(localStorage.getItem("undefined"), "foo", "localStorage.getItem('undefined')")
|
||||
assert_equals(localStorage.getItem("null"), "bar", "localStorage.getItem('null')")
|
||||
assert_equals(localStorage.getItem(undefined), "foo", "localStorage.getItem(undefined)")
|
||||
assert_equals(localStorage.getItem(null), "bar", "localStorage.getItem(null)")
|
||||
assert_equals(localStorage.getItem(""), "baz", "localStorage.getItem('')")
|
||||
}, "getItem should be correct")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_in</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_false("name" in localStorage);
|
||||
localStorage["name"] = "user1";
|
||||
assert_true("name" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_false("name" in localStorage);
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.name, "user1");
|
||||
localStorage.removeItem("name");
|
||||
assert_false("name" in localStorage);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_index</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage["name"] = "user1";
|
||||
localStorage["age"] = "42";
|
||||
test(function() {
|
||||
assert_equals(localStorage[-1], undefined);
|
||||
assert_equals(localStorage[0], undefined);
|
||||
assert_equals(localStorage[1], undefined);
|
||||
assert_equals(localStorage[2], undefined);
|
||||
})
|
||||
test(function() {
|
||||
assert_equals(localStorage["-1"], undefined);
|
||||
assert_equals(localStorage["0"], undefined);
|
||||
assert_equals(localStorage["1"], undefined);
|
||||
assert_equals(localStorage["2"], undefined);
|
||||
})
|
||||
localStorage.setItem(1, "number");
|
||||
test(function() {
|
||||
assert_equals(localStorage[1], "number");
|
||||
assert_equals(localStorage["1"], "number");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
assert_equals(localStorage.length, 0, "localStorage.length")
|
||||
|
||||
localStorage["name"] = "user1";
|
||||
localStorage["age"] = "20";
|
||||
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("name", "user1");
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
|
||||
test(function() {
|
||||
delete localStorage["name"];
|
||||
delete localStorage["unknown"];
|
||||
assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("null", "test");
|
||||
assert_true("null" in localStorage);
|
||||
localStorage.removeItem(null, "test");
|
||||
assert_false("null" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("undefined", "test");
|
||||
assert_true("undefined" in localStorage);
|
||||
localStorage.removeItem(undefined, "test");
|
||||
assert_false("undefined" in localStorage);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_local_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test_error = { name: "test" };
|
||||
test(function() {
|
||||
localStorage.clear();
|
||||
test(function() {
|
||||
assert_false("name" in localStorage);
|
||||
assert_false("age" in localStorage);
|
||||
});
|
||||
test(function() {
|
||||
localStorage["name"] = "user1";
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user1");
|
||||
assert_equals(localStorage["name"], "user1");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["name"] = "user2";
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user2");
|
||||
assert_equals(localStorage["name"], "user2");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("name", "user3");
|
||||
assert_true("name" in localStorage);
|
||||
assert_equals(localStorage.length, 1, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("name"), "user3");
|
||||
assert_equals(localStorage["name"], "user3");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("age", null);
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "null");
|
||||
assert_equals(localStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["age"] = null;
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "null");
|
||||
assert_equals(localStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem("age", undefined);
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
localStorage["age"] = undefined;
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
localStorage.setItem("age",
|
||||
{ toString: function() { throw test_error; } });
|
||||
});
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
localStorage["age"] =
|
||||
{ toString: function() { throw test_error; } };
|
||||
});
|
||||
assert_true("age" in localStorage);
|
||||
assert_equals(localStorage.length, 2, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("age"), "undefined");
|
||||
assert_equals(localStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem(undefined, "test");
|
||||
assert_true("undefined" in localStorage);
|
||||
assert_equals(localStorage.length, 3, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("undefined"), "test");
|
||||
assert_equals(localStorage["undefined"], "test");
|
||||
});
|
||||
test(function() {
|
||||
localStorage[undefined] = "test2";
|
||||
assert_true("undefined" in localStorage);
|
||||
assert_equals(localStorage.length, 3, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("undefined"), "test2");
|
||||
assert_equals(localStorage["undefined"], "test2");
|
||||
});
|
||||
test(function() {
|
||||
localStorage.setItem(null, "test");
|
||||
assert_true("null" in localStorage);
|
||||
assert_equals(localStorage.length, 4, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("null"), "test");
|
||||
assert_equals(localStorage["null"], "test");
|
||||
});
|
||||
test(function() {
|
||||
localStorage[null] = "test2";
|
||||
assert_true("null" in localStorage);
|
||||
assert_equals(localStorage.length, 4, "localStorage.length")
|
||||
assert_equals(localStorage.getItem("null"), "test2");
|
||||
assert_equals(localStorage["null"], "test2");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="storage_builtins.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_builtins</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test_storage_builtins(sessionStorage);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_clear</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
|
||||
assert_not_equals(sessionStorage.name, undefined);
|
||||
assert_equals(sessionStorage.length, 1);
|
||||
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.name, undefined, "sessionStorage.name")
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_getItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("undefined", "foo");
|
||||
sessionStorage.setItem("null", "bar");
|
||||
sessionStorage.setItem("", "baz");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.length, 3);
|
||||
}, "All 3 items should be added.");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage["unknown"], undefined, "sessionStorage['unknown']")
|
||||
assert_equals(sessionStorage["undefined"], "foo", "sessionStorage['undefined']")
|
||||
assert_equals(sessionStorage["null"], "bar", "sessionStorage['null']")
|
||||
assert_equals(sessionStorage[undefined], "foo", "sessionStorage[undefined]")
|
||||
assert_equals(sessionStorage[null], "bar", "sessionStorage[null]")
|
||||
assert_equals(sessionStorage[""], "baz", "sessionStorage['']")
|
||||
}, "array access should be correct");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage.getItem("undefined"), "foo", "sessionStorage.getItem('undefined')")
|
||||
assert_equals(sessionStorage.getItem("null"), "bar", "sessionStorage.getItem('null')")
|
||||
assert_equals(sessionStorage.getItem(undefined), "foo", "sessionStorage.getItem(undefined)")
|
||||
assert_equals(sessionStorage.getItem(null), "bar", "sessionStorage.getItem(null)")
|
||||
assert_equals(sessionStorage.getItem(""), "baz", "sessionStorage.getItem('')")
|
||||
}, "getItem should be correct")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_in</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_false("name" in sessionStorage);
|
||||
sessionStorage["name"] = "user1";
|
||||
assert_true("name" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_false("name" in sessionStorage);
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.name, "user1");
|
||||
sessionStorage.removeItem("name");
|
||||
assert_false("name" in sessionStorage);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_index</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage["name"] = "user1";
|
||||
sessionStorage["age"] = "42";
|
||||
test(function() {
|
||||
assert_equals(sessionStorage[-1], undefined);
|
||||
assert_equals(sessionStorage[0], undefined);
|
||||
assert_equals(sessionStorage[1], undefined);
|
||||
assert_equals(sessionStorage[2], undefined);
|
||||
})
|
||||
test(function() {
|
||||
assert_equals(sessionStorage["-1"], undefined);
|
||||
assert_equals(sessionStorage["0"], undefined);
|
||||
assert_equals(sessionStorage["1"], undefined);
|
||||
assert_equals(sessionStorage["2"], undefined);
|
||||
})
|
||||
sessionStorage.setItem(1, "number");
|
||||
test(function() {
|
||||
assert_equals(sessionStorage[1], "number");
|
||||
assert_equals(sessionStorage["1"], "number");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_length</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
assert_equals(sessionStorage.length, 0, "sessionStorage.length")
|
||||
|
||||
sessionStorage["name"] = "user1";
|
||||
sessionStorage["age"] = "20";
|
||||
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_removeItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem("name", "user1");
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
|
||||
test(function() {
|
||||
delete sessionStorage["name"];
|
||||
delete sessionStorage["unknown"];
|
||||
assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("null", "test");
|
||||
assert_true("null" in sessionStorage);
|
||||
sessionStorage.removeItem(null, "test");
|
||||
assert_false("null" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("undefined", "test");
|
||||
assert_true("undefined" in sessionStorage);
|
||||
sessionStorage.removeItem(undefined, "test");
|
||||
assert_false("undefined" in sessionStorage);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Web Storage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>storage_session_setItem</h1>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test_error = { name: "test" };
|
||||
test(function() {
|
||||
sessionStorage.clear();
|
||||
test(function() {
|
||||
assert_false("name" in sessionStorage);
|
||||
assert_false("age" in sessionStorage);
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["name"] = "user1";
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user1");
|
||||
assert_equals(sessionStorage["name"], "user1");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["name"] = "user2";
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user2");
|
||||
assert_equals(sessionStorage["name"], "user2");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("name", "user3");
|
||||
assert_true("name" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 1, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("name"), "user3");
|
||||
assert_equals(sessionStorage["name"], "user3");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("age", null);
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "null");
|
||||
assert_equals(sessionStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["age"] = null;
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "null");
|
||||
assert_equals(sessionStorage["age"], "null");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem("age", undefined);
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage["age"] = undefined;
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
sessionStorage.setItem("age",
|
||||
{ toString: function() { throw test_error; } });
|
||||
});
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
sessionStorage["age"] =
|
||||
{ toString: function() { throw test_error; } };
|
||||
});
|
||||
assert_true("age" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 2, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("age"), "undefined");
|
||||
assert_equals(sessionStorage["age"], "undefined");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem(undefined, "test");
|
||||
assert_true("undefined" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 3, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("undefined"), "test");
|
||||
assert_equals(sessionStorage["undefined"], "test");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage[undefined] = "test2";
|
||||
assert_true("undefined" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 3, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("undefined"), "test2");
|
||||
assert_equals(sessionStorage["undefined"], "test2");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage.setItem(null, "test");
|
||||
assert_true("null" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 4, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("null"), "test");
|
||||
assert_equals(sessionStorage["null"], "test");
|
||||
});
|
||||
test(function() {
|
||||
sessionStorage[null] = "test2";
|
||||
assert_true("null" in sessionStorage);
|
||||
assert_equals(sessionStorage.length, 4, "sessionStorage.length")
|
||||
assert_equals(sessionStorage.getItem("null"), "test2");
|
||||
assert_equals(sessionStorage["null"], "test2");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue