From d8bbe9a50182bc99390ca2a4257a387495086e55 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 27 Mar 2015 13:00:55 -0400 Subject: [PATCH] this fixes #1013, #1062 (draft) --- platform/firefox/vapi-background.js | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 0bd5c23..8ded3d7 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -691,6 +691,24 @@ vAPI.tabs.open = function(details) { /******************************************************************************/ +// Replace the URL of a tab. Noop if the tab does not exist. + +vAPI.tabs.replace = function(tabId, url) { + var targetURL = url; + + // extension pages + if ( /^[\w-]{2,}:/.test(targetURL) !== true ) { + targetURL = vAPI.getURL(targetURL); + } + + var tab = this.getTabsForIds(tabId); + if ( tab ) { + getBrowserForTab(tab).loadURI(targetURL); + } +}; + +/******************************************************************************/ + vAPI.tabs._remove = function(tab, tabBrowser) { if ( vAPI.fennec ) { tabBrowser.closeTab(tab); @@ -1119,18 +1137,13 @@ var httpObserver = { return true; } - if ( result.redirectUrl ) { - if ( type === 'main_frame' ) { - channel.cancel(this.ABORT); - vAPI.tabs.open({ tabId: details.tabId, url: result.redirectUrl }); - return true; - } - /*channel.redirectionLimit = 1; + /*if ( result.redirectUrl ) { + channel.redirectionLimit = 1; channel.redirectTo( Services.io.newURI(result.redirectUrl, null, null) ); - return true;*/ - } + return true; + }*/ return false; },