зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1292049 - Prevent tab.lastAccessed from being set to a discrete value when the tab is selected. r=mdeboer
--HG-- extra : rebase_source : 6eecb2fab57870fc490b1d1d9881ef89654c74be
This commit is contained in:
Родитель
a4fcd0b442
Коммит
b3a935b435
|
@ -1118,9 +1118,9 @@
|
|||
if (!this._previewMode) {
|
||||
this._recordTabAccess(this.mCurrentTab);
|
||||
|
||||
this.mCurrentTab.lastAccessed = Infinity;
|
||||
this.mCurrentTab.updateLastAccessed();
|
||||
this.mCurrentTab.removeAttribute("unread");
|
||||
oldTab.lastAccessed = Date.now();
|
||||
oldTab.updateLastAccessed();
|
||||
|
||||
let oldFindBar = oldTab._findBar;
|
||||
if (oldFindBar &&
|
||||
|
@ -2020,7 +2020,6 @@
|
|||
|
||||
var position = this.tabs.length - 1;
|
||||
t._tPos = position;
|
||||
t.lastAccessed = Date.now();
|
||||
t.permanentKey = {};
|
||||
this.tabContainer._setPositionalAttributes();
|
||||
|
||||
|
@ -4480,7 +4479,6 @@
|
|||
this.mCurrentTab.permanentKey = this.mCurrentBrowser.permanentKey;
|
||||
this.mCurrentTab._tPos = 0;
|
||||
this.mCurrentTab._fullyOpen = true;
|
||||
this.mCurrentTab.lastAccessed = Infinity;
|
||||
this.mCurrentTab.cachePosition = 0;
|
||||
this.mCurrentTab.linkedBrowser = this.mCurrentBrowser;
|
||||
this.mCurrentTab.hasBrowser = true;
|
||||
|
@ -6283,6 +6281,11 @@
|
|||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
if (!("_lastAccessed" in this)) {
|
||||
this.updateLastAccessed();
|
||||
}
|
||||
]]></constructor>
|
||||
|
||||
<property name="_visuallySelected">
|
||||
<setter>
|
||||
|
@ -6358,10 +6361,13 @@
|
|||
<getter>
|
||||
return this._lastAccessed == Infinity ? Date.now() : this._lastAccessed;
|
||||
</getter>
|
||||
<setter>
|
||||
this._lastAccessed = val;
|
||||
</setter>
|
||||
</property>
|
||||
<method name="updateLastAccessed">
|
||||
<parameter name="aDate"/>
|
||||
<body><![CDATA[
|
||||
this._lastAccessed = this.selected ? Infinity : (aDate || Date.now());
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="cachePosition">Infinity</field>
|
||||
|
||||
|
|
|
@ -41,10 +41,22 @@ add_task(function* () {
|
|||
checkTabs(3);
|
||||
yield ctrlTabTest([2, 1, 0], 7, 1);
|
||||
|
||||
gBrowser.addTab();
|
||||
{ // test for bug 1292049
|
||||
let tabToClose = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:buildconfig");
|
||||
checkTabs(4);
|
||||
selectTabs([0, 1, 2, 3]);
|
||||
|
||||
yield BrowserTestUtils.removeTab(tabToClose);
|
||||
checkTabs(3);
|
||||
undoCloseTab();
|
||||
checkTabs(4);
|
||||
is(gBrowser.tabContainer.selectedIndex, 3, "tab is selected after closing and restoring it");
|
||||
|
||||
yield ctrlTabTest([], 1, 2);
|
||||
}
|
||||
|
||||
{ // test for bug 445369
|
||||
checkTabs(4);
|
||||
selectTabs([1, 2, 0]);
|
||||
|
||||
let selectedTab = gBrowser.selectedTab;
|
||||
|
@ -127,12 +139,7 @@ add_task(function* () {
|
|||
}
|
||||
|
||||
function checkTabs(aTabs) {
|
||||
var tabs = gBrowser.tabs.length;
|
||||
if (tabs != aTabs) {
|
||||
while (gBrowser.tabs.length > 1)
|
||||
gBrowser.removeCurrentTab();
|
||||
throw "expected " + aTabs + " open tabs, got " + tabs;
|
||||
}
|
||||
is(gBrowser.tabs.length, aTabs, "number of open tabs should be " + aTabs);
|
||||
}
|
||||
|
||||
function selectTabs(tabs) {
|
||||
|
|
|
@ -3264,7 +3264,7 @@ var SessionStoreInternal = {
|
|||
}
|
||||
|
||||
if (tabData.lastAccessed) {
|
||||
tab.lastAccessed = tabData.lastAccessed;
|
||||
tab.updateLastAccessed(tabData.lastAccessed);
|
||||
}
|
||||
|
||||
if ("attributes" in tabData) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче