mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
5af5a73d3d
find /files/mozilla/build/d/_tests/testing/mochitest/tests/ | egrep "\.(xhtml|html|xml|js)$" | grep -v SimpleTest | grep -vi mochikit | grep -v simpleThread | grep -v test_ipc_messagemanager_blob.html | grep -v "indexedDB/test" | xargs grep -l Components | xargs grep -L enablePrivilege | perl -pe 's#.*mochitest/tests/##' | xargs perl -p -i.bakkk -e 's/Components\.interfaces(\s|;|\.|\[)/SpecialPowers\.Ci$1/g, s/SpecialPowers\.wrap\(Components\)\.(.)(lasses|tils|nterfaces|esults)/SpecialPowers.C$1/g, s/(?<![\.a-zA-Z])Components/SpecialPowers\.Components/g, s/window\.Components/window\.SpecialPowers\.Components/g'
82 lines
3.8 KiB
HTML
82 lines
3.8 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>cookie per-session only test</title>
|
|
|
|
<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()
|
|
{
|
|
var io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
|
|
.getService(SpecialPowers.Ci.nsIIOService);
|
|
var uri = io.newURI(window.location, "", null);
|
|
var cp = SpecialPowers.Cc["@mozilla.org/cookie/permission;1"]
|
|
.getService(SpecialPowers.Ci.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, SpecialPowers.Ci.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, SpecialPowers.Ci.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, SpecialPowers.Ci.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, SpecialPowers.Ci.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, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="startTest();">
|
|
|
|
</body>
|
|
</html>
|