Bug 1132591 - Unpin shortcut tabs when navigating to a new host. r=mcomella

This commit is contained in:
Margaret Leibovic 2015-07-16 11:01:03 -07:00
parent a5b2ada707
commit 91125467bc
2 changed files with 21 additions and 9 deletions

View File

@ -4674,12 +4674,13 @@ Tab.prototype = {
this.pluginDoorhangerTimeout = null;
this.shouldShowPluginDoorhanger = true;
this.clickToPlayPluginsActivated = false;
// Borrowed from desktop Firefox: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/urlbarBindings.xml#174
let documentURI = contentWin.document.documentURIObject.spec
let documentURI = contentWin.document.documentURIObject.spec;
// If reader mode, get the base domain for the original url.
let strippedURI = this._stripAboutReaderURL(documentURI);
// Borrowed from desktop Firefox: http://hg.mozilla.org/mozilla-central/annotate/72835344333f/browser/base/content/urlbarBindings.xml#l236
let matchedURL = strippedURI.match(/^((?:[a-z]+:\/\/)?(?:[^\/]+@)?)(.+?)(?::\d+)?(?:\/|$)/);
let baseDomain = "";
if (matchedURL) {
@ -4696,13 +4697,24 @@ Tab.prototype = {
} catch (e) {}
}
// If we are navigating to a new location with a different host,
// clear any URL origin that might have been pinned to this tab.
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let appOrigin = ss.getTabValue(this, "appOrigin");
if (appOrigin) {
let originHost = Services.io.newURI(appOrigin, null, null).host;
if (originHost != aLocationURI.host) {
// Note: going 'back' will not make this tab pinned again
ss.deleteTabValue(this, "appOrigin");
}
}
// Update the page actions URI for helper apps.
if (BrowserApp.selectedTab == this) {
ExternalApps.updatePageActionUri(fixedURI);
}
let webNav = contentWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
let webNav = contentWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation);
let message = {
type: "Content:LocationChange",

View File

@ -1196,19 +1196,19 @@ SessionStore.prototype = {
setTabValue: function ss_setTabValue(aTab, aKey, aStringValue) {
let browser = aTab.browser;
if (!browser.__SS_extdata)
if (!browser.__SS_extdata) {
browser.__SS_extdata = {};
}
browser.__SS_extdata[aKey] = aStringValue;
this.saveStateDelayed();
},
deleteTabValue: function ss_deleteTabValue(aTab, aKey) {
let browser = aTab.browser;
if (browser.__SS_extdata && browser.__SS_extdata[aKey])
if (browser.__SS_extdata && aKey in browser.__SS_extdata) {
delete browser.__SS_extdata[aKey];
else
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
this.saveStateDelayed();
}
},
restoreLastSession: Task.async(function* (aSessionString) {