Bug 1229195: resolve the promise when the chat window has actually finished loading, not right away. r=Standard8

This commit is contained in:
Mike de Boer 2016-03-15 17:24:52 +01:00
parent 3f4af88298
commit 69b54120e3

View File

@ -1111,13 +1111,17 @@ var MozLoopServiceInternal = {
}, callback);
if (!chatboxInstance) {
resolve(null);
// It's common for unit tests to overload Chat.open.
// It's common for unit tests to overload Chat.open, so check if we actually
// got a DOM node back.
} else if (chatboxInstance.setAttribute) {
// Set properties that influence visual appearance of the chatbox right
// away to circumvent glitches.
chatboxInstance.setAttribute("customSize", "loopDefault");
chatboxInstance.parentNode.setAttribute("customSize", "loopDefault");
Chat.loadButtonSet(chatboxInstance, "minimize,swap," + kChatboxHangupButton.id);
// Final fall-through in case a unit test overloaded Chat.open. Here we can
// immediately resolve the promise.
} else {
resolve(windowId);
}
});