mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1495387 - introduce async front instantiation; r=ochameau
Depends on D8989 Differential Revision: https://phabricator.services.mozilla.com/D8990 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d440e92be8
commit
4448c52661
@ -1604,7 +1604,13 @@ var FrontClassWithSpec = function(actorSpec, frontProto) {
|
||||
// Existing Fronts are relying on the initialize instead of constructor methods.
|
||||
const cls = function() {
|
||||
const instance = Object.create(cls.prototype);
|
||||
instance.initialize.apply(instance, arguments);
|
||||
const initializer = instance.initialize.apply(instance, arguments);
|
||||
|
||||
// Async Initialization
|
||||
// return a promise that resolves with the instance if the initializer is async
|
||||
if (initializer && typeof initializer.then === "function") {
|
||||
return initializer.then(resolve => instance);
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
cls.prototype = extend(Front.prototype, generateRequestMethods(actorSpec, frontProto));
|
||||
|
Loading…
Reference in New Issue
Block a user