mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00
Bug 739866 - Store last accessed timestamp for tabbrowser tabs [r=zpao]
This commit is contained in:
parent
ff0f226d01
commit
effa34a879
@ -924,6 +924,7 @@
|
||||
|
||||
if (!this._previewMode) {
|
||||
this.mCurrentTab.removeAttribute("unread");
|
||||
this.selectedTab.lastAccessed = Date.now();
|
||||
|
||||
#ifdef MOZ_E10S_COMPAT
|
||||
// Bug 666816 - TypeAheadFind support for e10s
|
||||
@ -3816,6 +3817,7 @@
|
||||
<field name="mCorrespondingMenuitem">null</field>
|
||||
<field name="_fullyOpen">false</field>
|
||||
<field name="closing">false</field>
|
||||
<field name="lastAccessed">0</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
|
@ -273,6 +273,7 @@ _BROWSER_FILES = \
|
||||
browser_middleMouse_inherit.js \
|
||||
redirect_bug623155.sjs \
|
||||
browser_tabDrop.js \
|
||||
browser_lastAccessedTab.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
24
browser/base/content/test/browser_lastAccessedTab.js
Normal file
24
browser/base/content/test/browser_lastAccessedTab.js
Normal file
@ -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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user