mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
1027f32e5c
--HG-- rename : dom/src/storage/nsDOMStorageDB.cpp => dom/src/storage/nsDOMStoragePersistentDB.cpp rename : dom/src/storage/nsDOMStorageDB.h => dom/src/storage/nsDOMStoragePersistentDB.h
85 lines
4.0 KiB
HTML
85 lines
4.0 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>cookie per-session only test</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<script type="text/javascript">
|
|
|
|
function startTest()
|
|
{
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var io = Components.classes["@mozilla.org/network/io-service;1"]
|
|
.getService(Components.interfaces.nsIIOService);
|
|
var uri = io.newURI(window.location, "", null);
|
|
var cp = Components.classes["@mozilla.org/cookie/permission;1"]
|
|
.getService(Components.interfaces.nsICookiePermission);
|
|
|
|
is(localStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
|
|
is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
|
|
is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
|
|
|
|
localStorage.setItem("persistent1", "changed persistent value 1");
|
|
localStorage.removeItem("persistent2");
|
|
|
|
is(localStorage.getItem("session only"), "session value", "Value present when cookies in session-only mode");
|
|
is(localStorage.getItem("persistent1"), "changed persistent value 1", "Persistent value present");
|
|
is(localStorage.getItem("persistent2"), null, "Persistent value removed");
|
|
|
|
// This clear has to delete only changes made in session only mode
|
|
localStorage.clear();
|
|
|
|
is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
|
|
is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
|
|
is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
|
|
|
|
localStorage.setItem("session only 2", "must be deleted on drop of session-only cookies permissions");
|
|
|
|
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
|
|
|
|
is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
|
|
is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
|
|
is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present");
|
|
is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present");
|
|
|
|
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
|
|
|
|
is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
|
|
is(localStorage.getItem("session only 2"), null, "Value not present when cookies in session-only mode after delete");
|
|
is(localStorage.getItem("persistent1"), "persistent value 1", "Persistent value present again");
|
|
is(localStorage.getItem("persistent2"), "persistent value 2", "Persistent value present again");
|
|
|
|
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
|
|
|
|
localStorage.clear();
|
|
|
|
is(localStorage.getItem("session only"), null, "No value when cookies are in default mode");
|
|
is(localStorage.getItem("persistent1"), null, "Persistent value not present after delete");
|
|
is(localStorage.getItem("persistent2"), null, "Persistent value not present after delete");
|
|
|
|
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
|
|
|
|
is(localStorage.getItem("session only"), null, "Value not present when cookies in session-only mode after delete");
|
|
is(localStorage.getItem("session only 2"), null, "No value when cookies are in default mode");
|
|
is(localStorage.getItem("persistent1"), null, "Persistent value not present in session only after delete");
|
|
is(localStorage.getItem("persistent2"), null, "Persistent value not present in session only after delete");
|
|
|
|
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="startTest();">
|
|
|
|
</body>
|
|
</html>
|