mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 630405 - about pages DOMStorage should be case-insensitive. r=mayhemer a=blocking
This commit is contained in:
parent
7c588b1957
commit
d3ce42b39f
@ -359,6 +359,9 @@ nsDOMStorageDBWrapper::CreateDomainScopeDBKey(nsIURI* aUri, nsACString& aKey)
|
||||
(NS_SUCCEEDED(aUri->SchemeIs("moz-safe-about", &isAboutUrl)) && isAboutUrl)) {
|
||||
rv = aUri->GetPath(domainScope);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// While the host is always canonicalized to lowercase, the path is not,
|
||||
// thus need to force the casing.
|
||||
ToLowerCase(domainScope);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@ function testURI(aURI)
|
||||
testURIWithClearCookies(aURI);
|
||||
|
||||
testURIWithRejectCookies(aURI);
|
||||
|
||||
testURIWithCasing(aURI);
|
||||
}
|
||||
|
||||
function testURIWithPrivateBrowsing(aURI) {
|
||||
@ -109,6 +111,29 @@ function testURIWithRejectCookies(aURI) {
|
||||
test_storage();
|
||||
}
|
||||
|
||||
function testURIWithCasing(aURI) {
|
||||
print("Testing: " + aURI.spec);
|
||||
let storage = getStorageForURI(aURI);
|
||||
storage.setItem("test-item", "test-value");
|
||||
print("Check that our value has been correctly stored.");
|
||||
do_check_eq(storage.length, 1);
|
||||
do_check_eq(storage.key(0), "test-item");
|
||||
do_check_eq(storage.getItem("test-item"), "test-value");
|
||||
|
||||
let ucSpec = aURI.spec.toUpperCase();
|
||||
print("Testing: " + ucSpec);
|
||||
let ucStorage = getStorageForURI(Services.io.newURI(ucSpec, null, null));
|
||||
print("Check that our value is accessible in a case-insensitive way.");
|
||||
do_check_eq(ucStorage.length, 1);
|
||||
do_check_eq(ucStorage.key(0), "test-item");
|
||||
do_check_eq(ucStorage.getItem("test-item"), "test-value");
|
||||
|
||||
print("Check that our value is correctly removed.");
|
||||
storage.removeItem("test-item");
|
||||
do_check_eq(storage.length, 0);
|
||||
do_check_eq(storage.getItem("test-item"), null);
|
||||
}
|
||||
|
||||
function getStorageForURI(aURI)
|
||||
{
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
|
||||
|
Loading…
Reference in New Issue
Block a user