зеркало из https://github.com/mozilla/gecko-dev.git
Bug 739866 - Store last accessed timestamp for tabbrowser tabs [r=zpao]
This commit is contained in:
Родитель
ff0f226d01
Коммит
effa34a879
|
@ -924,6 +924,7 @@
|
||||||
|
|
||||||
if (!this._previewMode) {
|
if (!this._previewMode) {
|
||||||
this.mCurrentTab.removeAttribute("unread");
|
this.mCurrentTab.removeAttribute("unread");
|
||||||
|
this.selectedTab.lastAccessed = Date.now();
|
||||||
|
|
||||||
#ifdef MOZ_E10S_COMPAT
|
#ifdef MOZ_E10S_COMPAT
|
||||||
// Bug 666816 - TypeAheadFind support for e10s
|
// Bug 666816 - TypeAheadFind support for e10s
|
||||||
|
@ -3816,6 +3817,7 @@
|
||||||
<field name="mCorrespondingMenuitem">null</field>
|
<field name="mCorrespondingMenuitem">null</field>
|
||||||
<field name="_fullyOpen">false</field>
|
<field name="_fullyOpen">false</field>
|
||||||
<field name="closing">false</field>
|
<field name="closing">false</field>
|
||||||
|
<field name="lastAccessed">0</field>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
|
||||||
<handlers>
|
<handlers>
|
||||||
|
|
|
@ -273,6 +273,7 @@ _BROWSER_FILES = \
|
||||||
browser_middleMouse_inherit.js \
|
browser_middleMouse_inherit.js \
|
||||||
redirect_bug623155.sjs \
|
redirect_bug623155.sjs \
|
||||||
browser_tabDrop.js \
|
browser_tabDrop.js \
|
||||||
|
browser_lastAccessedTab.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for bug 739866.
|
||||||
|
*
|
||||||
|
* 1. Adds a new tab (but doesn't select it)
|
||||||
|
* 2. Checks if timestamp on the new tab is 0
|
||||||
|
* 3. Selects the new tab, checks that the timestamp is updated (>0)
|
||||||
|
* 4. Selects the original tab & checks if new tab's timestamp has remained changed
|
||||||
|
*/
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
let originalTab = gBrowser.selectedTab;
|
||||||
|
let newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
|
||||||
|
is(newTab.lastAccessed, 0, "Timestamp on the new tab is 0.");
|
||||||
|
gBrowser.selectedTab = newTab;
|
||||||
|
let newTabAccessedDate = newTab.lastAccessed;
|
||||||
|
ok(newTabAccessedDate > 0, "Timestamp on the selected tab is more than 0.");
|
||||||
|
ok(newTabAccessedDate <= Date.now(), "Timestamp less than or equal current Date.");
|
||||||
|
gBrowser.selectedTab = originalTab;
|
||||||
|
is(newTab.lastAccessed, newTabAccessedDate, "New tab's timestamp remains the same.");
|
||||||
|
gBrowser.removeTab(newTab);
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче