Bug 745765 - Reuse existing tab for same app launch in about:apps r=fabrice a=blocking-fennec

This commit is contained in:
Mark Finkle 2012-04-20 00:54:52 -04:00
parent 4fe85a41b4
commit 9a190f5f34

View File

@ -1480,7 +1480,7 @@ nsBrowserAccess.prototype = {
if (newTab) {
let parentId = -1;
if (!isExternal) {
if (!isExternal && aOpener) {
let parent = BrowserApp.getTabForWindow(aOpener.top);
if (parent)
parentId = parent.id;
@ -4652,20 +4652,12 @@ var WebappsUI = {
},
openURL: function(aURI, aOrigin) {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let uri = Services.io.newURI(aURI, null, null);
if (!uri)
return;
let tabs = BrowserApp.tabs;
let tab = null;
for (let i = 0; i < tabs.length; i++) {
let appOrigin = ss.getTabValue(tabs[i], "appOrigin");
if (appOrigin == aOrigin)
tab = tabs[i];
}
if (tab)
BrowserApp.selectTab(tab);
else
BrowserApp.addTab(aURI, { pinned: true });
let bwin = window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow;
bwin.openURI(uri, null, Ci.nsIBrowserDOMWindow.OPEN_SWITCHTAB, Ci.nsIBrowserDOMWindow.OPEN_NEW);
}
}