mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1645511 - Improve the provider manager's provider.updateBehavior calls. r=mak
I considered wrapping `provider.tryMethod("updateBehavior", queryContext)` in a promise in case there are implementations that aren't async or don't return a promise. But there's only one implementation of `updateBehavior`, it's async, and we probably won't end up with any more implementations, so for simplicity I didn't. Differential Revision: https://phabricator.services.mozilla.com/D79559
This commit is contained in:
parent
7024c06712
commit
15284e839e
@ -206,12 +206,21 @@ class ProvidersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the behavior of extension providers.
|
// Update the behavior of extension providers.
|
||||||
|
let updateBehaviorPromises = [];
|
||||||
for (let provider of this.providers) {
|
for (let provider of this.providers) {
|
||||||
if (
|
if (
|
||||||
provider.type == UrlbarUtils.PROVIDER_TYPE.EXTENSION &&
|
provider.type == UrlbarUtils.PROVIDER_TYPE.EXTENSION &&
|
||||||
provider.name != "Omnibox"
|
provider.name != "Omnibox"
|
||||||
) {
|
) {
|
||||||
await provider.tryMethod("updateBehavior", queryContext);
|
updateBehaviorPromises.push(
|
||||||
|
provider.tryMethod("updateBehavior", queryContext)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateBehaviorPromises.length) {
|
||||||
|
await Promise.all(updateBehaviorPromises);
|
||||||
|
if (query.canceled) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user