зеркало из https://github.com/mozilla/gecko-dev.git
bug 921011 fix nsIBrowserDOMWindow in chat window, r=felipe
This commit is contained in:
Родитель
e38fe92aa1
Коммит
a36d3ae000
|
@ -63,6 +63,9 @@ var gChatWindow = {
|
|||
document.getElementById(disabledItem).setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
|
||||
new chatBrowserAccess();
|
||||
|
||||
// initialise the offline listener
|
||||
BrowserOffline.init();
|
||||
},
|
||||
|
@ -72,9 +75,6 @@ var gChatWindow = {
|
|||
}
|
||||
}
|
||||
|
||||
__defineGetter__("content", function()
|
||||
document.getElementById("chatter").contentWindow);
|
||||
|
||||
// define a popupnotifications handler for this window. we don't use
|
||||
// an iconbox here, and only support the browser frame for chat.
|
||||
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
|
||||
|
@ -90,6 +90,49 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
|
|||
}
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
|
||||
"resource:///modules/RecentWindow.jsm");
|
||||
|
||||
function chatBrowserAccess() { }
|
||||
|
||||
chatBrowserAccess.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]),
|
||||
|
||||
_openURIInNewTab: function(aURI, aWhere) {
|
||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB)
|
||||
return null;
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
if (!win) {
|
||||
// We couldn't find a suitable window, a new one needs to be opened.
|
||||
return null;
|
||||
}
|
||||
|
||||
let loadInBackground =
|
||||
Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground");
|
||||
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank",
|
||||
{inBackground: loadInBackground});
|
||||
let browser = win.gBrowser.getBrowserForTab(tab);
|
||||
win.focus();
|
||||
|
||||
return browser;
|
||||
},
|
||||
|
||||
openURI: function (aURI, aOpener, aWhere, aContext) {
|
||||
let browser = this._openURIInNewTab(aURI, aWhere);
|
||||
return browser ? browser.contentWindow : null;
|
||||
},
|
||||
|
||||
openURIInFrame: function browser_openURIInFrame(aURI, aOpener, aWhere, aContext) {
|
||||
let browser = this._openURIInNewTab(aURI, aWhere);
|
||||
return browser ? browser.QueryInterface(Ci.nsIFrameLoaderOwner) : null;
|
||||
},
|
||||
|
||||
isTabContentWindow: function (aWindow) this.contentWindow == aWindow,
|
||||
|
||||
get contentWindow() document.getElementById("chatter").contentWindow
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
#include browser-sets.inc
|
||||
|
|
Загрузка…
Ссылка в новой задаче