blob: f350816b245ac40dc298d3dc688e43d52213291f (
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
68
69
70
71
72
73
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Test that about:devtools-toolbox is reloaded correctly when reusing the same debugger
* client instance.
*/
add_task(async function () {
const devToolsClient = await createLocalClient();
info(
"Preload a local DevToolsClient as this-firefox in the remoteClientManager"
);
const {
remoteClientManager,
} = require("resource://devtools/client/shared/remote-debugging/remote-client-manager.js");
remoteClientManager.setClient(
"this-firefox",
"this-firefox",
devToolsClient,
{}
);
registerCleanupFunction(() => {
remoteClientManager.removeAllClients();
});
info("Create a dummy target tab");
const targetTab = await addTab("data:text/html,somehtml");
let onToolboxReady = gDevTools.once("toolbox-ready");
const { tab } = await openAboutToolbox({
id: targetTab.linkedBrowser.browserId,
remoteId: "this-firefox-this-firefox",
type: "tab",
});
await onToolboxReady;
info("Reload about:devtools-toolbox page");
onToolboxReady = gDevTools.once("toolbox-ready");
tab.linkedBrowser.reload();
await onToolboxReady;
info("Check if about:devtools-toolbox was reloaded correctly");
const refreshedDoc = tab.linkedBrowser.contentDocument;
ok(
refreshedDoc.querySelector(".debug-target-info"),
"about:devtools-toolbox header is correctly displayed"
);
const onToolboxDestroy = gDevTools.once("toolbox-destroyed");
await removeTab(tab);
await onToolboxDestroy;
await devToolsClient.close();
await removeTab(targetTab);
});
async function createLocalClient() {
const {
DevToolsClient,
} = require("resource://devtools/client/devtools-client.js");
const {
DevToolsServer,
} = require("resource://devtools/server/devtools-server.js");
DevToolsServer.init();
DevToolsServer.registerAllActors();
DevToolsServer.allowChromeProcess = true;
const devToolsClient = new DevToolsClient(DevToolsServer.connectPipe());
await devToolsClient.connect();
return devToolsClient;
}
|