зеркало из https://github.com/mozilla/gecko-dev.git
Bug 861495 - Transplant getOuterWindowWithId from nsIDOMWindowUtils to a window-related service: WebConsoleUtils.jsm. r=msucan
This commit is contained in:
Родитель
47cf7b1844
Коммит
c8c7d80ad7
|
@ -157,31 +157,6 @@ this.WebConsoleUtils = {
|
|||
getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the window that has the given outer ID.
|
||||
*
|
||||
* @param integer aOuterId
|
||||
* @param nsIDOMWindow [aHintWindow]
|
||||
* Optional, the window object used to QueryInterface to
|
||||
* nsIDOMWindowUtils. If this is not given,
|
||||
* Services.wm.getMostRecentWindow() is used.
|
||||
* @return nsIDOMWindow|null
|
||||
* The window object with the given outer ID.
|
||||
*/
|
||||
getWindowByOuterId: function WCU_getWindowByOuterId(aOuterId, aHintWindow)
|
||||
{
|
||||
let someWindow = aHintWindow || Services.wm.getMostRecentWindow(null);
|
||||
let content = null;
|
||||
|
||||
if (someWindow) {
|
||||
let windowUtils = someWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
content = windowUtils.getOuterWindowWithId(aOuterId);
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
/**
|
||||
* Abbreviates the given source URL so that it can be displayed flush-right
|
||||
* without being too distracting.
|
||||
|
@ -1331,8 +1306,7 @@ PageErrorListener.prototype =
|
|||
}
|
||||
|
||||
let errorWindow =
|
||||
WebConsoleUtils.getWindowByOuterId(aScriptError.outerWindowID,
|
||||
this.window);
|
||||
Services.wm.getOuterWindowById(aScriptError.outerWindowID);
|
||||
if (!errorWindow || errorWindow.top != this.window) {
|
||||
return;
|
||||
}
|
||||
|
@ -1471,8 +1445,7 @@ ConsoleAPIListener.prototype =
|
|||
|
||||
let apiMessage = aMessage.wrappedJSObject;
|
||||
if (this.window) {
|
||||
let msgWindow = WebConsoleUtils.getWindowByOuterId(apiMessage.ID,
|
||||
this.window);
|
||||
let msgWindow = Services.wm.getOuterWindowById(apiMessage.ID);
|
||||
if (!msgWindow || msgWindow.top != this.window) {
|
||||
// Not the same window!
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче