Source code

Revision control

Other Tools

1
<!DOCTYPE HTML>
2
<html>
3
<head>
4
<title>Tabs get Test</title>
5
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
7
<script type="text/javascript" src="head.js"></script>
8
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
9
</head>
10
<body>
11
12
<script type="text/javascript">
13
"use strict";
14
15
add_task(async function() {
16
let extension = ExtensionTestUtils.loadExtension({
17
manifest: {
18
permissions: ["tabs"],
19
},
20
async background() {
21
const tab1 = await browser.tabs.create({});
22
const tab2 = await browser.tabs.create({});
23
browser.test.assertEq(tab1.id, (await browser.tabs.get(tab1.id)).id, "tabs.get should return tab with given id");
24
browser.test.assertEq(tab2.id, (await browser.tabs.get(tab2.id)).id, "tabs.get should return tab with given id");
25
await browser.tabs.remove(tab1.id);
26
await browser.tabs.remove(tab2.id);
27
browser.test.notifyPass("tabs.get");
28
},
29
});
30
31
await extension.startup();
32
await extension.awaitFinish("tabs.get");
33
await extension.unload();
34
});
35
</script>
36
37
</body>
38
</html>