Bug 1254091 - part 2: fix focus messaging from SpecialPowers to refer to the right window, r=enndeakin

MozReview-Commit-ID: DMnK23GoerQ

--HG--
extra : rebase_source : f9af09ead0cd5a52034e483386ba1b6c7db6f5a7
This commit is contained in:
Gijs Kruitbosch 2016-03-18 18:29:27 +00:00
Родитель e6fd6099aa
Коммит 18ed8df63e
1 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -7,6 +7,8 @@
"use strict";
var global = this;
var Ci = Components.interfaces;
var Cc = Components.classes;
var Cu = Components.utils;
@ -1624,7 +1626,19 @@ SpecialPowersAPI.prototype = {
// With aWindow, it is called in SimpleTest.waitForFocus to allow popup window opener focus switching
if (aWindow)
aWindow.focus();
sendAsyncMessage("SpecialPowers.Focus", {});
var mm = global;
if (aWindow) {
try {
mm = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIContentFrameMessageManager);
} catch (ex) {
/* Ignore exceptions for e.g. XUL chrome windows from mochitest-chrome
* which won't have a message manager */
}
}
mm.sendAsyncMessage("SpecialPowers.Focus", {});
},
getClipboardData: function(flavor, whichClipboard) {