author | yulia <ystartsev@mozilla.com> |
Thu, 18 Oct 2018 14:34:33 +0000 | |
changeset 497699 | a6b4461eadf0622f4d4f6ea1ee8389d1c655b336 |
parent 497698 | 3a70a65a75cf9bf30152ebd0e69ccbde3a913f00 |
child 497702 | a58112b87de672f400dc5d23ad8bac80d292a2fd |
push id | 10002 |
push user | archaeopteryx@coole-files.de |
push date | Fri, 19 Oct 2018 23:09:29 +0000 |
treeherder | mozilla-beta@01378c910610 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ochameau |
bugs | 1495387 |
milestone | 64.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/shared/protocol.js +++ b/devtools/shared/protocol.js @@ -1599,17 +1599,23 @@ var generateRequestMethods = function(ac * @param object proto * The object prototype. Must have a 'typeName' property, * should have method definitions, can have event definitions. */ 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)); if (!registeredTypes.has(actorSpec.typeName)) { types.addActorType(actorSpec.typeName); } registeredTypes.get(actorSpec.typeName).frontClass = cls;