forked from mirrors/gecko-dev
MozReview-Commit-ID: Gm77Z0T3oJq --HG-- extra : rebase_source : 9a23baa102558d30302baf5044da207b7d79f3b6
94 lines
2.9 KiB
HTML
94 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf8">
|
|
<title></title>
|
|
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
|
|
<script type="application/javascript" src="head.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script type="application/javascript">
|
|
window.onload = function() {
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
let win;
|
|
|
|
SimpleTest.registerCleanupFunction(() => {
|
|
(async function() {
|
|
if (win) {
|
|
await closeWebIDE(win);
|
|
}
|
|
DebuggerServer.destroy();
|
|
await removeAllProjects();
|
|
})();
|
|
});
|
|
|
|
(async function() {
|
|
DebuggerServer.init();
|
|
DebuggerServer.registerAllActors();
|
|
|
|
win = await openWebIDE();
|
|
let docRuntime = getRuntimeDocument(win);
|
|
let docProject = getProjectDocument(win);
|
|
|
|
win.AppManager.update("runtime-list");
|
|
|
|
let deferred = new Promise(resolve => {
|
|
win.AppManager.connection.once(
|
|
win.Connection.Events.CONNECTED,
|
|
resolve);
|
|
});
|
|
|
|
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
|
|
|
|
ok(win.document.querySelector("window").className, "busy", "UI is busy");
|
|
await win.UI._busyPromise;
|
|
|
|
await deferred;
|
|
|
|
is(Object.keys(DebuggerServer._connections).length, 1, "Connected");
|
|
|
|
await waitForUpdate(win, "runtime-global-actors");
|
|
|
|
ok(win.AppManager.isMainProcessDebuggable(), "Main process available");
|
|
|
|
// Select main process
|
|
SimpleTest.executeSoon(() => {
|
|
docProject.querySelectorAll("#project-panel-runtimeapps .panel-item")[0].click();
|
|
});
|
|
|
|
await waitForUpdate(win, "project");
|
|
|
|
// Toolbox opens automatically for main process / runtime apps
|
|
ok(win.UI.toolboxPromise, "Toolbox promise exists");
|
|
let toolbox = await win.UI.toolboxPromise;
|
|
|
|
await toolbox.destroy();
|
|
|
|
ok(!win.UI.toolboxPromise, "Toolbox promise should be unset once toolbox.destroy()'s promise resolves");
|
|
|
|
// Reopen the toolbox right after to check races and also
|
|
// opening a toolbox more than just once against the same target
|
|
await win.Cmds.toggleToolbox();
|
|
|
|
ok(win.UI.toolboxPromise, "Toolbox promise exists");
|
|
|
|
await win.UI.destroyToolbox();
|
|
|
|
ok(!win.UI.toolboxPromise, "Toolbox promise is also nullified the second times");
|
|
|
|
await win.Cmds.disconnectRuntime();
|
|
|
|
SimpleTest.finish();
|
|
})();
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|