зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539666
- Add more warning message while a URL is not recognized by MozURL and mark these directries as obsolete to pass the upgrade; r=asuth
We found this issue by finding out a url with trailing "-" cannot parsed by MozURL (more specifically, rust-url). This patch tries to fix all related unparsed url issues at once. So, the first thing we want to fix here is to make it more easier to be debugged. Thus, this patch adds more QM_WARNING while MozURL::Init() is failing to parse the url. Secondly, if failures happen during metadata restoring or upgrading, breaking the whole initialization or upgrades is not the thing we want. Ideally, the best approach would be somehow keep the directory and wait until the problem on MozURL to be fixed. Then, upgrade the directroy. However, it's relative hard to do and might have many edge cases. Therefore, this patch take the approach of removing them in these situation. Note that restoring and upgrading should be rarly happens. Differential Revision: https://phabricator.services.mozilla.com/D25437 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c7d7937517
Коммит
f770fd0631
|
@ -2499,8 +2499,9 @@ QuotaManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
|
||||
if (!strcmp(aTopic, kProfileDoChangeTopic)) {
|
||||
if (NS_WARN_IF(gBaseDirPath)) {
|
||||
NS_WARNING("profile-before-change-qm must precede repeated "
|
||||
"profile-do-change!");
|
||||
NS_WARNING(
|
||||
"profile-before-change-qm must precede repeated "
|
||||
"profile-do-change!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3740,6 +3741,7 @@ nsresult QuotaManager::GetDirectoryMetadata2(
|
|||
RefPtr<MozURL> url;
|
||||
rv = MozURL::Init(getter_AddRefs(url), originNoSuffix);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
QM_WARNING("A URL %s is not recognized by MozURL", originNoSuffix.get());
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -5561,6 +5563,7 @@ bool QuotaManager::IsPrincipalInfoValid(const PrincipalInfo& aPrincipalInfo) {
|
|||
RefPtr<MozURL> specURL;
|
||||
nsresult rv = MozURL::Init(getter_AddRefs(specURL), info.spec());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
QM_WARNING("A URL %s is not recognized by MozURL", info.spec().get());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -8411,7 +8414,20 @@ nsresult StorageOperationBase::ProcessOriginDirectories() {
|
|||
RefPtr<MozURL> specURL;
|
||||
nsresult rv = MozURL::Init(getter_AddRefs(specURL), originProps.mSpec);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
// If a URL cannot be understood by MozURL during restoring or
|
||||
// upgrading, either marking the directory as broken or removing that
|
||||
// corresponding directory should be considered. While the cost of
|
||||
// marking the directory as broken during a upgrade is too high,
|
||||
// removing the directory is a better choice rather than blocking the
|
||||
// initialization or the upgrade.
|
||||
QM_WARNING(
|
||||
"A URL (%s) for the origin directory is not recognized by "
|
||||
"MozURL. The directory will be deleted for now to pass the "
|
||||
"initialization or the upgrade.",
|
||||
originProps.mSpec.get());
|
||||
|
||||
originProps.mType = OriginProps::eObsolete;
|
||||
break;
|
||||
}
|
||||
|
||||
nsCString originNoSuffix;
|
||||
|
|
|
@ -13,6 +13,11 @@ async function testSteps()
|
|||
const obsoleteOriginPaths = [
|
||||
"storage/default/chrome+++content+browser.xul/",
|
||||
"storage/default/moz-safe-about+++home/",
|
||||
// XXX Bug 1540247 will expose MozURL::Init to js so that we could test the
|
||||
// failure cases of that. The below directory is expected to fail now, but
|
||||
// we expect it to pass once the rust-url issue is fixed. Thus, only test it
|
||||
// manually.
|
||||
// "storage/default/https+++smaug----.github.io/",
|
||||
// Deprecated client
|
||||
"storage/default/https+++example.com/asmjs/"
|
||||
];
|
||||
|
|
Загрузка…
Ссылка в новой задаче