mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
9f03f90fb7
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'
118 lines
6.0 KiB
HTML
118 lines
6.0 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>slave for sessionStorage test</title>
|
|
|
|
<script type="text/javascript" src="interOriginFrame.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
const DOM_QUOTA_REACHED = 2152924150;
|
|
const Cc = SpecialPowers.Cc;
|
|
|
|
function checkException(func, exc)
|
|
{
|
|
var exceptionThrew = false;
|
|
try {
|
|
func();
|
|
}
|
|
catch (ex) {
|
|
exceptionThrew = true;
|
|
is(ex.result, exc, "Expected "+exc+" exception");
|
|
}
|
|
ok(exceptionThrew, "Exception "+exc+" threw at "+location);
|
|
}
|
|
|
|
function doStep()
|
|
{
|
|
var io = Cc["@mozilla.org/network/io-service;1"]
|
|
.getService(SpecialPowers.Ci.nsIIOService);
|
|
var uri = io.newURI(window.location, "", null);
|
|
var cp = Cc["@mozilla.org/cookie/permission;1"]
|
|
.getService(SpecialPowers.Ci.nsICookiePermission);
|
|
|
|
cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION);
|
|
|
|
var query = location.search.substring(1);
|
|
var queries = query.split("&");
|
|
|
|
var operation = queries[0];
|
|
var keyName = queries[1];
|
|
var result = queries[2];
|
|
|
|
switch (result)
|
|
{
|
|
case "success":
|
|
switch (operation)
|
|
{
|
|
case "add":
|
|
// Store 500 bytes long string must succeed
|
|
localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
|
|
is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "500 bytes key "+keyName+" stored");
|
|
break;
|
|
|
|
case "remove":
|
|
localStorage.removeItem(keyName);
|
|
is(localStorage.getItem(keyName), null, "Key "+keyName+" removed");
|
|
break;
|
|
|
|
case "checkclean":
|
|
is(localStorage.getItem(keyName), null, "Key "+keyName+" not present");
|
|
break;
|
|
|
|
case "checknotclean":
|
|
is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" is present");
|
|
break;
|
|
}
|
|
|
|
break;
|
|
|
|
case "failure":
|
|
switch (operation)
|
|
{
|
|
case "add":
|
|
// Attempt to store 500 bytes long string that doens't
|
|
// fit the quota, have to throw DOM_QUOTA_REACHED exception
|
|
checkException(function() {
|
|
localStorage.setItem(keyName, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
|
|
}, DOM_QUOTA_REACHED);
|
|
is(localStorage.getItem(keyName), null, "500 bytes key "+keyName+" is NOT stored");
|
|
break;
|
|
|
|
case "add2":
|
|
// Attempt to change a key value to reach the DOM quota and
|
|
// check it fails and the old key value is still present.
|
|
checkException(function() {
|
|
localStorage.setItem(keyName, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
|
|
}, DOM_QUOTA_REACHED);
|
|
is(localStorage.getItem(keyName), "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Key "+keyName+" left unchanged");
|
|
break;
|
|
}
|
|
|
|
break;
|
|
|
|
case "":
|
|
default:
|
|
switch (operation)
|
|
{
|
|
case "clear":
|
|
localStorage.clear();
|
|
cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
|
|
|
|
break;
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
// Just inform the master we are finished now
|
|
postMsg("done");
|
|
return false;
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="postMsg('frame loaded');">
|
|
</body>
|
|
</html>
|