diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 3def00c67a4c..a0588bc7a90d 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -587,6 +587,17 @@ var BrowserUI = { return tab; }, + newOrSelectTab: function newOrSelectTab(aURI, aOwner) { + let tabs = Browser.tabs; + for (let i = 0; i < tabs.length; i++) { + if (tabs[i].browser.currentURI.spec == aURI) { + Browser.selectedTab = tabs[i]; + return; + } + } + this.newTab(aURI, aOwner); + }, + closeTab : function closeTab(aTab) { // If no tab is passed in, assume the current tab Browser.closeTab(aTab || Browser.selectedTab); diff --git a/mobile/chrome/content/sync.js b/mobile/chrome/content/sync.js index f986df44157a..07c789b14794 100644 --- a/mobile/chrome/content/sync.js +++ b/mobile/chrome/content/sync.js @@ -48,7 +48,7 @@ let WeaveGlue = { }, openRemoteTabs: function openRemoteTabs() { - this._openTab("about:sync-tabs"); + BrowserUI.newOrSelectTab("about:sync-tabs", null); }, connect: function connect() { @@ -80,10 +80,6 @@ let WeaveGlue = { addEventListener("unload", function() addRem(false), false); }, - _openTab: function _openTab(url) { - setTimeout(function() BrowserUI.newTab(url), 0); - }, - get _settings() { // Do a quick test to see if the options exist yet let syncButton = document.getElementById("sync-syncButton");