зеркало из https://github.com/mozilla/pjs.git
Bug 745765 - Reuse existing tab for same app launch in about:apps r=fabrice a=blocking-fennec
This commit is contained in:
Родитель
cea37cc9da
Коммит
3c884a9b1c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче