mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 1003968 - avoid Exists() calls for search plugin directories in the browser directory provider r=daleharvey,Gijs
This Change removes all call to Exists() in Directory Provider component, which creates the possibility for the componenet to return an empty list. SearchService.jsm is modified to handle this possibility. Differential Revision: https://phabricator.services.mozilla.com/D42772 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
55f03ef35d
commit
69f0254ddd
@ -554,13 +554,6 @@ const startupPhases = {
|
||||
stat: 1,
|
||||
close: 1,
|
||||
},
|
||||
{
|
||||
// bug 1003968
|
||||
path: "XREAppDist:searchplugins",
|
||||
condition: WIN,
|
||||
ignoreIfUnused: true, // with WebRender enabled this may happen during "before becoming idle"
|
||||
stat: 1,
|
||||
},
|
||||
{
|
||||
path: "XCurProcD:extensions",
|
||||
condition: WIN,
|
||||
@ -665,13 +658,6 @@ const startupPhases = {
|
||||
ignoreIfUnused: true,
|
||||
stat: 3,
|
||||
},
|
||||
{
|
||||
// bug 1003968
|
||||
path: "XREAppDist:searchplugins",
|
||||
condition: WIN,
|
||||
ignoreIfUnused: true, // with WebRender enabled this may happen during "before handling user events"
|
||||
stat: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -64,16 +64,11 @@ static void AppendDistroSearchDirs(nsIProperties* aDirSvc,
|
||||
if (NS_FAILED(rv)) return;
|
||||
searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins"));
|
||||
|
||||
bool exists;
|
||||
rv = searchPlugins->Exists(&exists);
|
||||
if (NS_FAILED(rv) || !exists) return;
|
||||
|
||||
nsCOMPtr<nsIFile> commonPlugins;
|
||||
rv = searchPlugins->Clone(getter_AddRefs(commonPlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
commonPlugins->AppendNative(NS_LITERAL_CSTRING("common"));
|
||||
rv = commonPlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) array.AppendObject(commonPlugins);
|
||||
array.AppendObject(commonPlugins);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
@ -92,11 +87,8 @@ static void AppendDistroSearchDirs(nsIProperties* aDirSvc,
|
||||
rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
defLocalePlugins->AppendNative(defLocale);
|
||||
rv = defLocalePlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) {
|
||||
array.AppendObject(defLocalePlugins);
|
||||
return; // all done
|
||||
}
|
||||
array.AppendObject(defLocalePlugins);
|
||||
return; // all done
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,11 +100,8 @@ static void AppendDistroSearchDirs(nsIProperties* aDirSvc,
|
||||
rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
curLocalePlugins->AppendNative(locale);
|
||||
rv = curLocalePlugins->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) {
|
||||
array.AppendObject(curLocalePlugins);
|
||||
return; // all done
|
||||
}
|
||||
array.AppendObject(curLocalePlugins);
|
||||
return; // all done
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,8 +134,6 @@ DirectoryProvider::AppendingEnumerator::GetNext(nsISupports** aResult) {
|
||||
|
||||
mNext = nullptr;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Ignore all errors
|
||||
|
||||
bool more;
|
||||
@ -166,10 +153,6 @@ DirectoryProvider::AppendingEnumerator::GetNext(nsISupports** aResult) {
|
||||
++i;
|
||||
}
|
||||
|
||||
bool exists;
|
||||
rv = mNext->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && exists) break;
|
||||
|
||||
mNext = nullptr;
|
||||
}
|
||||
|
||||
|
@ -1062,6 +1062,10 @@ SearchService.prototype = {
|
||||
if (!done) {
|
||||
distDirs.push(dir);
|
||||
}
|
||||
} catch (ex) {
|
||||
if (!(ex instanceof OS.File.Error) || !ex.becauseNoSuchFile) {
|
||||
throw ex;
|
||||
}
|
||||
} finally {
|
||||
iterator.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user