зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1583252 - Assert that there is no pending client at end of each test. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D46805 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
47cf5eca24
Коммит
19fdc6af3e
|
@ -29,19 +29,11 @@ add_task(async function() {
|
|||
info("Wait for the tab to appear in the debug targets with the correct name");
|
||||
await waitUntil(() => findDebugTargetByText("TEST_TAB", document));
|
||||
|
||||
const tabTarget = findDebugTargetByText("TEST_TAB", document);
|
||||
const inspectButton = tabTarget.querySelector(
|
||||
".qa-debug-target-inspect-button"
|
||||
);
|
||||
ok(inspectButton, "Inspect button for the tab is available");
|
||||
|
||||
info("Click on the inspect button for the test tab");
|
||||
inspectButton.click();
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
const newTabUrl = gBrowser.selectedBrowser.currentURI.spec;
|
||||
ok(
|
||||
newTabUrl.startsWith("about:devtools-toolbox"),
|
||||
"about:devtools-toolbox opened in a new tab"
|
||||
const { devtoolsTab } = await openAboutDevtoolsToolbox(
|
||||
document,
|
||||
tab,
|
||||
window,
|
||||
"TEST_TAB"
|
||||
);
|
||||
|
||||
const evts = readAboutDebuggingEvents().filter(e => e.method === "inspect");
|
||||
|
@ -63,7 +55,7 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
info("Close the about:devtools-toolbox tab");
|
||||
await removeTab(gBrowser.selectedTab);
|
||||
await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
|
||||
await waitForRequestsToSettle(window.AboutDebugging.store);
|
||||
|
||||
info("Remove first background tab");
|
||||
|
|
|
@ -50,6 +50,7 @@ add_task(async function() {
|
|||
const onToolboxDestroy = gDevTools.once("toolbox-destroyed");
|
||||
await removeTab(tab);
|
||||
await onToolboxDestroy;
|
||||
await debuggerClient.close();
|
||||
await removeTab(targetTab);
|
||||
});
|
||||
|
||||
|
|
|
@ -46,17 +46,20 @@ add_task(async function() {
|
|||
is(target.isLocalTab, false);
|
||||
is(target.chrome, true);
|
||||
is(target.isBrowsingContext, true);
|
||||
await target.client.close();
|
||||
|
||||
info("Test tab");
|
||||
windowId = browser.outerWindowID;
|
||||
target = await targetFromURL(new URL("http://foo?type=tab&id=" + windowId));
|
||||
assertTarget(target, TEST_URI);
|
||||
await target.client.close();
|
||||
|
||||
info("Test tab with chrome privileges");
|
||||
target = await targetFromURL(
|
||||
new URL("http://foo?type=tab&id=" + windowId + "&chrome")
|
||||
);
|
||||
assertTarget(target, TEST_URI, true);
|
||||
await target.client.close();
|
||||
|
||||
info("Test invalid tab id");
|
||||
try {
|
||||
|
@ -73,6 +76,7 @@ add_task(async function() {
|
|||
target = await targetFromURL(new URL("http://foo?type=process"));
|
||||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
await target.client.close();
|
||||
|
||||
await testRemoteTCP();
|
||||
await testRemoteWebSocket();
|
||||
|
|
|
@ -53,6 +53,8 @@ add_task(async function() {
|
|||
);
|
||||
})
|
||||
);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
||||
// Test against Frame targets
|
||||
|
@ -82,6 +84,8 @@ add_task(async function() {
|
|||
);
|
||||
})
|
||||
);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
||||
// Test against Webextension targets
|
||||
|
@ -113,6 +117,8 @@ add_task(async function() {
|
|||
);
|
||||
})
|
||||
);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
||||
// Test against worker targets on parent process
|
||||
|
@ -139,4 +145,6 @@ add_task(async function() {
|
|||
);
|
||||
})
|
||||
);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
|
|
@ -43,7 +43,6 @@ add_task(async function() {
|
|||
);
|
||||
|
||||
const onToolboxDestroyed = gDevTools.once("toolbox-destroyed");
|
||||
const onTabDetached = toolbox.target.once("tabDetached");
|
||||
|
||||
info("Removing the iframes");
|
||||
toolboxIframe.remove();
|
||||
|
@ -54,13 +53,5 @@ add_task(async function() {
|
|||
await onToolboxDestroyed;
|
||||
info("Toolbox destroyed");
|
||||
|
||||
// Also wait for tabDetached. Toolbox destroys the Target which calls
|
||||
// BrowsingContextTargetActor.detach(). But Target doesn't wait for detach's
|
||||
// end to resolve. Whereas it is quite important as it is a significant part
|
||||
// of toolbox cleanup. If we do not wait for it and starts removing debugged
|
||||
// document, the actor is still considered as being attached and continues
|
||||
// processing events.
|
||||
await onTabDetached;
|
||||
|
||||
iframe.remove();
|
||||
});
|
||||
|
|
|
@ -9,4 +9,6 @@ add_task(async function() {
|
|||
const { animationInspector, panel } = await openAnimationInspector();
|
||||
ok(animationInspector, "AnimationInspector should exist");
|
||||
ok(panel, "Main animation-inspector panel should exist");
|
||||
|
||||
await closeAnimationInspector();
|
||||
});
|
||||
|
|
|
@ -157,9 +157,30 @@ registerCleanupFunction(() => {
|
|||
});
|
||||
|
||||
registerCleanupFunction(async function cleanup() {
|
||||
// Close any tab opened by the test.
|
||||
// There should be only one tab opened by default when firefox starts the test.
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
await closeTabAndToolbox(gBrowser.selectedTab);
|
||||
}
|
||||
|
||||
// Note that this will run before cleanup functions registered by tests or other head.js files.
|
||||
// So all connections must be cleaned up by the test when the test ends,
|
||||
// before the harness starts invoking the cleanup functions
|
||||
await waitForTick();
|
||||
|
||||
// All connections must be cleaned up by the test when the test ends.
|
||||
const { DebuggerServer } = require("devtools/server/debugger-server");
|
||||
ok(
|
||||
!DebuggerServer.hasConnection(),
|
||||
"The main process DebuggerServer has no pending connection when the test ends"
|
||||
);
|
||||
// If there is still open connection, close all of them so that following tests
|
||||
// could pass.
|
||||
if (DebuggerServer.hasConnection()) {
|
||||
for (const conn of Object.values(DebuggerServer._connections)) {
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,7 +136,7 @@ var DebuggerServer = {
|
|||
},
|
||||
|
||||
hasConnection() {
|
||||
return Object.keys(this._connections).length > 0;
|
||||
return this._connections && Object.keys(this._connections).length > 0;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,11 +16,6 @@ add_task(
|
|||
info(
|
||||
"Setting up and connecting Debugger Server and Client in main process"
|
||||
);
|
||||
initDebuggerServer();
|
||||
const transport = DebuggerServer.connectPipe();
|
||||
const client = new DebuggerClient(transport);
|
||||
await client.connect();
|
||||
|
||||
info("Opening a non-extension page in a tab");
|
||||
const target = await addTabTarget("data:text/html;charset=utf-8,");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче