mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
151 lines
4.8 KiB
HTML
151 lines
4.8 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>localStorage and DOM quota test</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="interOriginTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<script type="text/javascript">
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var currentTest = 1;
|
|
var currentStep = 1;
|
|
|
|
function addOfflineApp(url)
|
|
{
|
|
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
|
|
.getService(Components.interfaces.nsIPermissionManager);
|
|
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
|
.getService(Components.interfaces.nsIIOService)
|
|
.newURI(url, null, null);
|
|
permissionManager.add(uri, "offline-app",
|
|
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
|
|
}
|
|
|
|
function removeOfflineApp(url)
|
|
{
|
|
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
|
|
.getService(Components.interfaces.nsIPermissionManager);
|
|
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
|
.getService(Components.interfaces.nsIIOService)
|
|
.newURI(url, null, null);
|
|
permissionManager.remove(uri.host, "offline-app");
|
|
}
|
|
|
|
function doNextTest()
|
|
{
|
|
slave = frame;
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
currentStep = 1;
|
|
|
|
switch (currentTest)
|
|
{
|
|
// Add something to storage of example.com
|
|
case 1:
|
|
slaveOrigin = "http://example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
|
|
break;
|
|
|
|
// Add something to storage of test1.example.com, secure schema
|
|
case 2:
|
|
slaveOrigin = "https://test1.example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
|
|
break;
|
|
|
|
// Add something to storage of http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp, secure schema
|
|
case 3:
|
|
slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
|
|
break;
|
|
|
|
// Call RemoveOwners API through storage manager.
|
|
// Classify the sites above as offline-app using
|
|
// the permission manager to let the storage manager
|
|
// know about them.
|
|
case 4:
|
|
addOfflineApp("http://example.com");
|
|
addOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
|
|
var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
|
|
.getService(Components.interfaces.nsIDOMStorageManager);
|
|
try {
|
|
manager.clearOfflineApps();
|
|
}
|
|
catch (ex) {
|
|
ok(false, "Exception not thrown during clearOfflineApps()");
|
|
}
|
|
removeOfflineApp("http://example.com");
|
|
removeOfflineApp("http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp");
|
|
|
|
// Now check that those two sites' data disappeared
|
|
slaveOrigin = "http://example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&A&success";
|
|
break;
|
|
|
|
case 5:
|
|
slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&C&success";
|
|
break;
|
|
|
|
case 6:
|
|
// Also subdomains to example.com must be deleted
|
|
slaveOrigin = "https://test1.example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&B&success";
|
|
break;
|
|
|
|
case 7:
|
|
addOfflineApp("https://test1.example.com");
|
|
var manager = Components.classes["@mozilla.org/dom/storagemanager;1"]
|
|
.getService(Components.interfaces.nsIDOMStorageManager);
|
|
try {
|
|
manager.clearOfflineApps();
|
|
}
|
|
catch (ex) {
|
|
ok(false, "Exception not thrown during clearOfflineApps()");
|
|
}
|
|
removeOfflineApp("https://test1.example.com");
|
|
|
|
// Now check that those site's data disappeared
|
|
slaveOrigin = "https://test1.example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?checkclean&B&success";
|
|
break;
|
|
|
|
case 8:
|
|
slaveOrigin = "http://example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
|
|
break;
|
|
|
|
case 9:
|
|
slaveOrigin = "https://test1.example.com";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
|
|
break;
|
|
|
|
case 10:
|
|
slaveOrigin = "http://sub1.xn--hxajbheg2az3al.xn--jxalpdlp";
|
|
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
|
|
break;
|
|
|
|
case 11:
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
++currentTest;
|
|
}
|
|
|
|
function doStep()
|
|
{
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="doNextTest();">
|
|
<iframe src="" name="frame"></iframe>
|
|
</body>
|
|
</html>
|