blob: 48aeb05273ed0cc0d9eab8c828eaee0ae51205bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check that tab descriptor survives after the page navigates and changes
* process.
*/
const EXAMPLE_COM_URI =
"https://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_ORG_URI =
"https://example.org/document-builder.sjs?html=<div id=org>org";
add_task(async function () {
const tab = await addTab(EXAMPLE_COM_URI);
const toolbox = await gDevTools.showToolboxForTab(tab);
const target = toolbox.target;
const client = toolbox.commands.client;
info("Retrieve the initial list of tab descriptors");
const tabDescriptors = await client.mainRoot.listTabs();
const tabDescriptor = tabDescriptors.find(
d => decodeURIComponent(d.url) === EXAMPLE_COM_URI
);
ok(tabDescriptor, "Should have a descriptor actor for the tab");
info("Retrieve the target corresponding to the TabDescriptor");
const comTabTarget = await tabDescriptor.getTarget();
is(
target,
comTabTarget,
"The toolbox target is also the target associated with the tab descriptor"
);
await navigateTo(EXAMPLE_ORG_URI);
info("Call list tabs again to update the tab descriptor forms");
await client.mainRoot.listTabs();
is(
decodeURIComponent(tabDescriptor.url),
EXAMPLE_ORG_URI,
"The existing descriptor now points to the new URI"
);
const newTarget = toolbox.target;
is(
comTabTarget.actorID,
null,
"With Fission or server side target switching, example.com target front is destroyed"
);
ok(
comTabTarget != newTarget,
"With Fission or server side target switching, a new target was created for example.org"
);
const onDescriptorDestroyed = tabDescriptor.once("descriptor-destroyed");
await removeTab(tab);
info("Wait for descriptor destroyed event");
await onDescriptorDestroyed;
ok(tabDescriptor.isDestroyed(), "the descriptor front is really destroyed");
});
|