--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -22,26 +22,16 @@ window._gBrowser = {
if (AppConstants.platform == "macosx") {
Services.els.addSystemEventListener(document, "keypress", this, false);
}
window.addEventListener("sizemodechange", this);
window.addEventListener("occlusionstatechange", this);
this._setupInitialBrowserAndTab();
- // Hook up the event listeners to the first browser
- var tabListener = new TabProgressListener(this.mCurrentTab, this.mCurrentBrowser, true, false);
- const nsIWebProgress = Ci.nsIWebProgress;
- const filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
- .createInstance(nsIWebProgress);
- filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL);
- this._tabListeners.set(this.mCurrentTab, tabListener);
- this._tabFilters.set(this.mCurrentTab, filter);
- this.webProgress.addProgressListener(filter, nsIWebProgress.NOTIFY_ALL);
-
if (Services.prefs.getBoolPref("browser.display.use_system_colors")) {
this.mPanelContainer.style.backgroundColor = "-moz-default-background-color";
} else if (Services.prefs.getIntPref("browser.display.document_color_use") == 2) {
this.mPanelContainer.style.backgroundColor =
Services.prefs.getCharPref("browser.display.background_color");
}
let messageManager = window.getGroupMessageManager("browsers");
@@ -55,18 +45,18 @@ window._gBrowser = {
messageManager.addMessageListener("DOMWindowClose", this);
window.messageManager.addMessageListener("contextmenu", this);
messageManager.addMessageListener("Browser:Init", this);
// If this window has remote tabs, switch to our tabpanels fork
// which does asynchronous tab switching.
this.mPanelContainer.classList.add("tabbrowser-tabpanels");
} else {
- this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID,
- this.mCurrentBrowser);
+ this._outerWindowIDBrowserMap.set(this.selectedBrowser.outerWindowID,
+ this.selectedBrowser);
}
messageManager.addMessageListener("DOMWindowFocus", this);
messageManager.addMessageListener("RefreshBlocker:Blocked", this);
messageManager.addMessageListener("Browser:WindowCreated", this);
// To correctly handle keypresses for potential FindAsYouType, while
// the tab's find bar is not yet initialized.
this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind");
@@ -252,229 +242,238 @@ window._gBrowser = {
for (var i = 0; i < this.tabs.length; i++) {
if (!this.tabs[i].pinned)
break;
}
return i;
},
get popupAnchor() {
- if (this.mCurrentTab._popupAnchor) {
- return this.mCurrentTab._popupAnchor;
+ if (this.selectedTab._popupAnchor) {
+ return this.selectedTab._popupAnchor;
}
- let stack = this.mCurrentBrowser.parentNode;
+ let stack = this.selectedBrowser.parentNode;
// Create an anchor for the popup
let popupAnchor = document.createElementNS(this._XUL_NS, "hbox");
popupAnchor.className = "popup-anchor";
popupAnchor.hidden = true;
stack.appendChild(popupAnchor);
- return this.mCurrentTab._popupAnchor = popupAnchor;
+ return this.selectedTab._popupAnchor = popupAnchor;
},
set selectedTab(val) {
if (gNavToolbox.collapsed && !this._allowTabChange) {
return this.tabbox.selectedTab;
}
// Update the tab
this.tabbox.selectedTab = val;
return val;
},
get selectedTab() {
- return this.mCurrentTab;
+ return this._selectedTab;
},
get selectedBrowser() {
- return this.mCurrentBrowser;
+ return this._selectedBrowser;
},
get initialBrowser() {
delete this.initialBrowser;
return this.initialBrowser = document.getElementById("tabbrowser-initialBrowser");
},
_setupInitialBrowserAndTab() {
let browser = this.initialBrowser;
- this.mCurrentBrowser = browser;
+ this._selectedBrowser = browser;
browser.permanentKey = {};
browser.droppedLinkHandler = handleDroppedLink;
this._autoScrollPopup = browser._createAutoScrollPopup();
this._autoScrollPopup.id = "autoscroller";
document.getElementById("mainPopupSet").appendChild(this._autoScrollPopup);
browser.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
let tab = this.tabs[0];
- this.mCurrentTab = tab;
+ this._selectedTab = tab;
let uniqueId = this._generateUniquePanelID();
this.mPanelContainer.childNodes[0].id = uniqueId;
tab.linkedPanel = uniqueId;
tab.permanentKey = browser.permanentKey;
tab._tPos = 0;
tab._fullyOpen = true;
tab.linkedBrowser = browser;
this._tabForBrowser.set(browser, tab);
+
+ // Hook the browser up with a progress listener.
+ let tabListener = new TabProgressListener(tab, browser, true, false);
+ let filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
+ .createInstance(Ci.nsIWebProgress);
+ filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL);
+ this._tabListeners.set(tab, tabListener);
+ this._tabFilters.set(tab, filter);
+ browser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
},
/**
* BEGIN FORWARDED BROWSER PROPERTIES. IF YOU ADD A PROPERTY TO THE BROWSER ELEMENT
* MAKE SURE TO ADD IT HERE AS WELL.
*/
get canGoBack() {
- return this.mCurrentBrowser.canGoBack;
+ return this.selectedBrowser.canGoBack;
},
get canGoForward() {
- return this.mCurrentBrowser.canGoForward;
+ return this.selectedBrowser.canGoForward;
},
goBack() {
- return this.mCurrentBrowser.goBack();
+ return this.selectedBrowser.goBack();
},
goForward() {
- return this.mCurrentBrowser.goForward();
+ return this.selectedBrowser.goForward();
},
reload() {
- return this.mCurrentBrowser.reload();
+ return this.selectedBrowser.reload();
},
reloadWithFlags(aFlags) {
- return this.mCurrentBrowser.reloadWithFlags(aFlags);
+ return this.selectedBrowser.reloadWithFlags(aFlags);
},
stop() {
- return this.mCurrentBrowser.stop();
+ return this.selectedBrowser.stop();
},
/**
* throws exception for unknown schemes
*/
loadURI(aURI, aReferrerURI, aCharset) {
- return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset);
+ return this.selectedBrowser.loadURI(aURI, aReferrerURI, aCharset);
},
/**
* throws exception for unknown schemes
*/
loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData) {
// Note - the callee understands both:
// (a) loadURIWithFlags(aURI, aFlags, ...)
// (b) loadURIWithFlags(aURI, { flags: aFlags, ... })
// Forwarding it as (a) here actually supports both (a) and (b),
// so you can call us either way too.
- return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
+ return this.selectedBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
},
goHome() {
- return this.mCurrentBrowser.goHome();
+ return this.selectedBrowser.goHome();
},
gotoIndex(aIndex) {
- return this.mCurrentBrowser.gotoIndex(aIndex);
+ return this.selectedBrowser.gotoIndex(aIndex);
},
set homePage(val) {
- this.mCurrentBrowser.homePage = val;
+ this.selectedBrowser.homePage = val;
return val;
},
get homePage() {
- return this.mCurrentBrowser.homePage;
+ return this.selectedBrowser.homePage;
},
get currentURI() {
- return this.mCurrentBrowser.currentURI;
+ return this.selectedBrowser.currentURI;
},
get finder() {
- return this.mCurrentBrowser.finder;
+ return this.selectedBrowser.finder;
},
get docShell() {
- return this.mCurrentBrowser.docShell;
+ return this.selectedBrowser.docShell;
},
get webNavigation() {
- return this.mCurrentBrowser.webNavigation;
+ return this.selectedBrowser.webNavigation;
},
get webBrowserFind() {
- return this.mCurrentBrowser.webBrowserFind;
+ return this.selectedBrowser.webBrowserFind;
},
get webProgress() {
- return this.mCurrentBrowser.webProgress;
+ return this.selectedBrowser.webProgress;
},
get contentWindow() {
- return this.mCurrentBrowser.contentWindow;
+ return this.selectedBrowser.contentWindow;
},
get contentWindowAsCPOW() {
- return this.mCurrentBrowser.contentWindowAsCPOW;
+ return this.selectedBrowser.contentWindowAsCPOW;
},
get sessionHistory() {
- return this.mCurrentBrowser.sessionHistory;
+ return this.selectedBrowser.sessionHistory;
},
get markupDocumentViewer() {
- return this.mCurrentBrowser.markupDocumentViewer;
+ return this.selectedBrowser.markupDocumentViewer;
},
get contentDocument() {
- return this.mCurrentBrowser.contentDocument;
+ return this.selectedBrowser.contentDocument;
},
get contentDocumentAsCPOW() {
- return this.mCurrentBrowser.contentDocumentAsCPOW;
+ return this.selectedBrowser.contentDocumentAsCPOW;
},
get contentTitle() {
- return this.mCurrentBrowser.contentTitle;
+ return this.selectedBrowser.contentTitle;
},
get contentPrincipal() {
- return this.mCurrentBrowser.contentPrincipal;
+ return this.selectedBrowser.contentPrincipal;
},
get securityUI() {
- return this.mCurrentBrowser.securityUI;
+ return this.selectedBrowser.securityUI;
},
set fullZoom(val) {
- this.mCurrentBrowser.fullZoom = val;
+ this.selectedBrowser.fullZoom = val;
},
get fullZoom() {
- return this.mCurrentBrowser.fullZoom;
+ return this.selectedBrowser.fullZoom;
},
set textZoom(val) {
- this.mCurrentBrowser.textZoom = val;
+ this.selectedBrowser.textZoom = val;
},
get textZoom() {
- return this.mCurrentBrowser.textZoom;
+ return this.selectedBrowser.textZoom;
},
get isSyntheticDocument() {
- return this.mCurrentBrowser.isSyntheticDocument;
+ return this.selectedBrowser.isSyntheticDocument;
},
set userTypedValue(val) {
- return this.mCurrentBrowser.userTypedValue = val;
+ return this.selectedBrowser.userTypedValue = val;
},
get userTypedValue() {
- return this.mCurrentBrowser.userTypedValue;
+ return this.selectedBrowser.userTypedValue;
},
isFindBarInitialized(aTab) {
return (aTab || this.selectedTab)._findBar != undefined;
},
getFindBar(aTab) {
if (!aTab)
@@ -655,21 +654,21 @@ window._gBrowser = {
return this.getSidebarContainer(aBrowser).parentNode;
},
getSidebarContainer(aBrowser) {
return this.getBrowserContainer(aBrowser).parentNode;
},
getBrowserContainer(aBrowser) {
- return (aBrowser || this.mCurrentBrowser).parentNode.parentNode;
+ return (aBrowser || this.selectedBrowser).parentNode.parentNode;
},
getTabModalPromptBox(aBrowser) {
- let browser = (aBrowser || this.mCurrentBrowser);
+ let browser = (aBrowser || this.selectedBrowser);
if (!browser.tabModalPromptBox) {
browser.tabModalPromptBox = new TabModalPromptBox(browser);
}
return browser.tabModalPromptBox;
},
getTabFromAudioEvent(aEvent) {
if (!Services.prefs.getBoolPref("browser.tabs.showAudioPlayingIcon") ||
@@ -694,19 +693,19 @@ window._gBrowser = {
} catch (e) {
// don't inhibit other listeners
Cu.reportError(e);
}
}
}
}
- aBrowser = aBrowser || this.mCurrentBrowser;
-
- if (aCallGlobalListeners && aBrowser == this.mCurrentBrowser) {
+ aBrowser = aBrowser || this.selectedBrowser;
+
+ if (aCallGlobalListeners && aBrowser == this.selectedBrowser) {
callListeners(this.mProgressListeners, aArguments);
}
if (aCallTabsListeners) {
aArguments.unshift(aBrowser);
callListeners(this.mTabsProgressListeners, aArguments);
}
@@ -879,23 +878,24 @@ window._gBrowser = {
newTitle = uri.prePath + sep + newTitle;
}
} catch (e) {}
return newTitle;
},
updateTitlebar() {
- document.title = this.getWindowTitleForBrowser(this.mCurrentBrowser);
+ document.title = this.getWindowTitleForBrowser(this.selectedBrowser);
},
updateCurrentBrowser(aForceUpdate) {
var newBrowser = this.getBrowserAtIndex(this.tabContainer.selectedIndex);
- if (this.mCurrentBrowser == newBrowser && !aForceUpdate)
+ if (this.selectedBrowser == newBrowser && !aForceUpdate) {
return;
+ }
if (!aForceUpdate) {
document.commandDispatcher.lock();
TelemetryStopwatch.start("FX_TAB_SWITCH_UPDATE_MS");
if (!gMultiProcessBrowser) {
// old way of measuring tab paint which is not valid with e10s.
// Waiting until the next MozAfterPaint ensures that we capture
@@ -916,125 +916,125 @@ window._gBrowser = {
this._tabSwitchID = null;
}
window.removeEventListener("MozAfterPaint", onMozAfterPaint);
};
window.addEventListener("MozAfterPaint", onMozAfterPaint);
}
}
- var oldTab = this.mCurrentTab;
+ let oldTab = this.selectedTab;
// Preview mode should not reset the owner
if (!this._previewMode && !oldTab.selected)
oldTab.owner = null;
let lastRelatedTab = this._lastRelatedTabMap.get(oldTab);
if (lastRelatedTab) {
if (!lastRelatedTab.selected)
lastRelatedTab.owner = null;
}
this._lastRelatedTabMap = new WeakMap();
- var oldBrowser = this.mCurrentBrowser;
+ let oldBrowser = this.selectedBrowser;
if (!gMultiProcessBrowser) {
oldBrowser.removeAttribute("primary");
oldBrowser.docShellIsActive = false;
newBrowser.setAttribute("primary", "true");
newBrowser.docShellIsActive =
(window.windowState != window.STATE_MINIMIZED &&
!window.isFullyOccluded);
}
var updateBlockedPopups = false;
if ((oldBrowser.blockedPopups && !newBrowser.blockedPopups) ||
- (!oldBrowser.blockedPopups && newBrowser.blockedPopups))
+ (!oldBrowser.blockedPopups && newBrowser.blockedPopups))
updateBlockedPopups = true;
- this.mCurrentBrowser = newBrowser;
- this.mCurrentTab = this.tabContainer.selectedItem;
- this.showTab(this.mCurrentTab);
+ this._selectedBrowser = newBrowser;
+ this._selectedTab = this.tabContainer.selectedItem;
+ this.showTab(this.selectedTab);
gURLBar.setAttribute("switchingtabs", "true");
window.addEventListener("MozAfterPaint", function() {
gURLBar.removeAttribute("switchingtabs");
}, { once: true });
this._appendStatusPanel();
if (updateBlockedPopups)
- this.mCurrentBrowser.updateBlockedPopups();
+ this.selectedBrowser.updateBlockedPopups();
// Update the URL bar.
- var loc = this.mCurrentBrowser.currentURI;
-
- var webProgress = this.mCurrentBrowser.webProgress;
- var securityUI = this.mCurrentBrowser.securityUI;
+ let loc = this.selectedBrowser.currentURI;
+
+ let webProgress = this.selectedBrowser.webProgress;
+ let securityUI = this.selectedBrowser.securityUI;
this._callProgressListeners(null, "onLocationChange",
[webProgress, null, loc, 0],
true, false);
if (securityUI) {
// Include the true final argument to indicate that this event is
// simulated (instead of being observed by the webProgressListener).
this._callProgressListeners(null, "onSecurityChange",
[webProgress, null, securityUI.state, true],
true, false);
}
- var listener = this._tabListeners.get(this.mCurrentTab);
+ let listener = this._tabListeners.get(this.selectedTab);
if (listener && listener.mStateFlags) {
this._callProgressListeners(null, "onUpdateCurrentBrowser",
[listener.mStateFlags, listener.mStatus,
listener.mMessage, listener.mTotalProgress],
true, false);
}
if (!this._previewMode) {
- this.mCurrentTab.updateLastAccessed();
- this.mCurrentTab.removeAttribute("unread");
+ this.selectedTab.updateLastAccessed();
+ this.selectedTab.removeAttribute("unread");
oldTab.updateLastAccessed();
let oldFindBar = oldTab._findBar;
if (oldFindBar &&
oldFindBar.findMode == oldFindBar.FIND_NORMAL &&
!oldFindBar.hidden)
this._lastFindValue = oldFindBar._findField.value;
this.updateTitlebar();
- this.mCurrentTab.removeAttribute("titlechanged");
- this.mCurrentTab.removeAttribute("attention");
+ this.selectedTab.removeAttribute("titlechanged");
+ this.selectedTab.removeAttribute("attention");
// The tab has been selected, it's not unselected anymore.
// (1) Call the current tab's finishUnselectedTabHoverTimer()
// to save a telemetry record.
// (2) Call the current browser's unselectedTabHover() with false
// to dispatch an event.
- this.mCurrentTab.finishUnselectedTabHoverTimer();
- this.mCurrentBrowser.unselectedTabHover(false);
+ this.selectedTab.finishUnselectedTabHoverTimer();
+ this.selectedBrowser.unselectedTabHover(false);
}
// If the new tab is busy, and our current state is not busy, then
// we need to fire a start to all progress listeners.
const nsIWebProgressListener = Ci.nsIWebProgressListener;
- if (this.mCurrentTab.hasAttribute("busy") && !this.mIsBusy) {
+ if (this.selectedTab.hasAttribute("busy") && !this.mIsBusy) {
this.mIsBusy = true;
this._callProgressListeners(null, "onStateChange",
[webProgress, null,
nsIWebProgressListener.STATE_START |
nsIWebProgressListener.STATE_IS_NETWORK, 0],
true, false);
}
// If the new tab is not busy, and our current state is busy, then
// we need to fire a stop to all progress listeners.
- if (!this.mCurrentTab.hasAttribute("busy") && this.mIsBusy) {
+ if (!this.selectedTab.hasAttribute("busy") && this.mIsBusy) {
this.mIsBusy = false;
this._callProgressListeners(null, "onStateChange",
[webProgress, null,
nsIWebProgressListener.STATE_STOP |
nsIWebProgressListener.STATE_IS_NETWORK, 0],
true, false);
}
@@ -1045,20 +1045,20 @@ window._gBrowser = {
// We've selected the new tab, so go ahead and notify listeners.
let event = new CustomEvent("TabSelect", {
bubbles: true,
cancelable: false,
detail: {
previousTab: oldTab
}
});
- this.mCurrentTab.dispatchEvent(event);
+ this.selectedTab.dispatchEvent(event);
this._tabAttrModified(oldTab, ["selected"]);
- this._tabAttrModified(this.mCurrentTab, ["selected"]);
+ this._tabAttrModified(this.selectedTab, ["selected"]);
if (oldBrowser != newBrowser &&
oldBrowser.getInPermitUnload) {
oldBrowser.getInPermitUnload(inPermitUnload => {
if (!inPermitUnload) {
return;
}
// Since the user is switching away from a tab that has
@@ -1077,31 +1077,31 @@ window._gBrowser = {
// NB: This code assumes that the beforeunload prompt
// is the top-most prompt on the tab.
prompts[prompts.length - 1].abortPrompt();
}
});
}
if (!gMultiProcessBrowser) {
- this._adjustFocusBeforeTabSwitch(oldTab, this.mCurrentTab);
- this._adjustFocusAfterTabSwitch(this.mCurrentTab);
+ this._adjustFocusBeforeTabSwitch(oldTab, this.selectedTab);
+ this._adjustFocusAfterTabSwitch(this.selectedTab);
}
}
updateUserContextUIIndicator();
gIdentityHandler.updateSharingIndicator();
this.tabContainer._setPositionalAttributes();
// Enable touch events to start a native dragging
// session to allow the user to easily drag the selected tab.
// This is currently only supported on Windows.
oldTab.removeAttribute("touchdownstartsdrag");
- this.mCurrentTab.setAttribute("touchdownstartsdrag", "true");
+ this.selectedTab.setAttribute("touchdownstartsdrag", "true");
if (!gMultiProcessBrowser) {
document.commandDispatcher.unlock();
let event = new CustomEvent("TabSwitchDone", {
bubbles: true,
cancelable: true
});
@@ -1242,18 +1242,19 @@ window._gBrowser = {
tab.setAttribute("sharing", aState.sharing);
}
} else {
tab._sharingState = null;
tab.removeAttribute("sharing");
}
this._tabAttrModified(tab, ["sharing"]);
- if (aBrowser == this.mCurrentBrowser)
+ if (aBrowser == this.selectedBrowser) {
gIdentityHandler.updateSharingIndicator();
+ }
},
getTabSharingState(aTab) {
// Normalize the state object for consumers (ie.extensions).
let state = Object.assign({}, aTab._sharingState);
return {
camera: !!state.camera,
microphone: !!state.microphone,
@@ -1495,17 +1496,17 @@ window._gBrowser = {
var targetTabIndex = -1;
if (aReplace) {
let browser;
if (aTargetTab) {
browser = this.getBrowserForTab(aTargetTab);
targetTabIndex = aTargetTab._tPos;
} else {
- browser = this.mCurrentBrowser;
+ browser = this.selectedBrowser;
targetTabIndex = this.tabContainer.selectedIndex;
}
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
try {
@@ -2208,18 +2209,19 @@ window._gBrowser = {
aSkipBackgroundNotify = params.skipBackgroundNotify;
aNextTabParentId = params.nextTabParentId;
aNoInitialLabel = params.noInitialLabel;
aFocusUrlBar = params.focusUrlBar;
aName = params.name;
}
// if we're adding tabs, we're past interrupt mode, ditch the owner
- if (this.mCurrentTab.owner)
- this.mCurrentTab.owner = null;
+ if (this.selectedTab.owner) {
+ this.selectedTab.owner = null;
+ }
// Find the tab that opened this one, if any. This is used for
// determining positioning, and inherited attributes such as the
// user context ID.
//
// If we have a browser opener (which is usually the browser
// element from a remote window.open() call), use that.
//
@@ -2608,17 +2610,17 @@ window._gBrowser = {
}
}
for (let tab of tabsWithBeforeUnload) {
this.removeTab(tab, { animate: true });
}
},
removeCurrentTab(aParams) {
- this.removeTab(this.mCurrentTab, aParams);
+ this.removeTab(this.selectedTab, aParams);
},
removeTab(aTab, aParams) {
if (aParams) {
var animate = aParams.animate;
var byMouse = aParams.byMouse;
var skipPermitUnload = aParams.skipPermitUnload;
}
@@ -3391,17 +3393,17 @@ window._gBrowser = {
aIndex = Math.max(aIndex, this._numPinnedTabs);
if (oldPosition == aIndex)
return;
if (!aKeepRelatedTabs) {
this._lastRelatedTabMap = new WeakMap();
}
- let wasFocused = (document.activeElement == this.mCurrentTab);
+ let wasFocused = (document.activeElement == this.selectedTab);
aIndex = aIndex < aTab._tPos ? aIndex : aIndex + 1;
// invalidate cache
this._visibleTabs = null;
// use .item() instead of [] because dragging to the end of the strip goes out of
// bounds: .item() returns null (so it acts like appendChild), but [] throws
@@ -3412,50 +3414,50 @@ window._gBrowser = {
this.tabs[i]._selected = false;
}
// If we're in the midst of an async tab switch while calling
// moveTabTo, we can get into a case where _visuallySelected
// is set to true on two different tabs.
//
// What we want to do in moveTabTo is to remove logical selection
- // from all tabs, and then re-add logical selection to mCurrentTab
+ // from all tabs, and then re-add logical selection to selectedTab
// (and visual selection as well if we're not running with e10s, which
// setting _selected will do automatically).
//
// If we're running with e10s, then the visual selection will not
// be changed, which is fine, since if we weren't in the midst of a
// tab switch, the previously visually selected tab should still be
// correct, and if we are in the midst of a tab switch, then the async
// tab switcher will set the visually selected tab once the tab switch
// has completed.
- this.mCurrentTab._selected = true;
+ this.selectedTab._selected = true;
if (wasFocused)
- this.mCurrentTab.focus();
+ this.selectedTab.focus();
this.tabContainer._handleTabSelect(true);
if (aTab.pinned)
this.tabContainer._positionPinnedTabs();
this.tabContainer._setPositionalAttributes();
var evt = document.createEvent("UIEvents");
evt.initUIEvent("TabMove", true, false, window, oldPosition);
aTab.dispatchEvent(evt);
},
moveTabForward() {
- let nextTab = this.mCurrentTab.nextSibling;
+ let nextTab = this.selectedTab.nextSibling;
while (nextTab && nextTab.hidden)
nextTab = nextTab.nextSibling;
if (nextTab)
- this.moveTabTo(this.mCurrentTab, nextTab._tPos);
+ this.moveTabTo(this.selectedTab, nextTab._tPos);
else if (this.arrowKeysShouldWrap)
this.moveTabToStart();
},
/**
* Adopts a tab from another browser window, and inserts it at aIndex
*/
adoptTab(aTab, aIndex, aSelectTab) {
@@ -3507,36 +3509,36 @@ window._gBrowser = {
// for our new tab after we've done swapBrowsersAndCloseOther.
this.updateCurrentBrowser(true);
}
return newTab;
},
moveTabBackward() {
- let previousTab = this.mCurrentTab.previousSibling;
+ let previousTab = this.selectedTab.previousSibling;
while (previousTab && previousTab.hidden)
previousTab = previousTab.previousSibling;
if (previousTab)
- this.moveTabTo(this.mCurrentTab, previousTab._tPos);
+ this.moveTabTo(this.selectedTab, previousTab._tPos);
else if (this.arrowKeysShouldWrap)
this.moveTabToEnd();
},
moveTabToStart() {
- var tabPos = this.mCurrentTab._tPos;
+ let tabPos = this.selectedTab._tPos;
if (tabPos > 0)
- this.moveTabTo(this.mCurrentTab, 0);
+ this.moveTabTo(this.selectedTab, 0);
},
moveTabToEnd() {
- var tabPos = this.mCurrentTab._tPos;
+ let tabPos = this.selectedTab._tPos;
if (tabPos < this.browsers.length - 1)
- this.moveTabTo(this.mCurrentTab, this.browsers.length - 1);
+ this.moveTabTo(this.selectedTab, this.browsers.length - 1);
},
moveTabOver(aEvent) {
let direction = window.getComputedStyle(document.documentElement).direction;
if ((direction == "ltr" && aEvent.keyCode == KeyEvent.DOM_VK_RIGHT) ||
(direction == "rtl" && aEvent.keyCode == KeyEvent.DOM_VK_LEFT)) {
this.moveTabForward();
} else {
@@ -3619,17 +3621,17 @@ window._gBrowser = {
aEvent.preventDefault();
return;
}
}
if (AppConstants.platform != "macosx") {
if (aEvent.ctrlKey && !aEvent.shiftKey && !aEvent.metaKey &&
aEvent.keyCode == KeyEvent.DOM_VK_F4 &&
- !this.mCurrentTab.pinned) {
+ !this.selectedTab.pinned) {
this.removeCurrentTab({ animate: true });
aEvent.preventDefault();
}
}
},
_handleKeyPressEventMac(aEvent) {
if (!aEvent.isTrusted) {
@@ -3716,19 +3718,19 @@ window._gBrowser = {
this._handleKeyDownEvent(aEvent);
break;
case "keypress":
this._handleKeyPressEventMac(aEvent);
break;
case "sizemodechange":
case "occlusionstatechange":
if (aEvent.target == window && !this._switcher) {
- this.mCurrentBrowser.preserveLayers(
+ this.selectedBrowser.preserveLayers(
window.windowState == window.STATE_MINIMIZED || window.isFullyOccluded);
- this.mCurrentBrowser.docShellIsActive = this.shouldActivateDocShell(this.mCurrentBrowser);
+ this.selectedBrowser.docShellIsActive = this.shouldActivateDocShell(this.selectedBrowser);
}
break;
}
},
receiveMessage(aMessage) {
let data = aMessage.data;
let browser = aMessage.target;