Source code

Revision control

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: !is_fennec
  • This test was skipped 314 times in the preceding 7 days.
<meta charset="utf-8">
<title>Tabs lastAccessed Test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
"use strict";
add_task(async function testLastAccessed() {
const past =;"");"");
const extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs"],
async background() {
browser.test.onMessage.addListener(async function(msg, past) {
if (msg !== "past") {
const [tab1] = await browser.tabs.query({url: ""});
const [tab2] = await browser.tabs.query({url: ""});
browser.test.assertTrue(tab1 && tab2, "Expected tabs were found");
const now =;
browser.test.assertTrue(typeof tab1.lastAccessed == "number",
"tab1 lastAccessed should be a number");
browser.test.assertTrue(typeof tab2.lastAccessed == "number",
"tab2 lastAccessed should be a number");
browser.test.assertTrue(past <= tab1.lastAccessed &&
tab1.lastAccessed <= tab2.lastAccessed &&
tab2.lastAccessed <= now,
"lastAccessed timestamps are recent and in the right order");
await browser.tabs.remove([,]);
await extension.startup();
await extension.sendMessage("past", past);
await extension.awaitFinish("tabs.lastAccessed");
await extension.unload();