summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js')
-rw-r--r--devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js192
1 files changed, 92 insertions, 100 deletions
diff --git a/devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js b/devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js
index 5029c62306..d06274591e 100644
--- a/devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js
+++ b/devtools/client/framework/browser-toolbox/test/browser_browser_toolbox_unavailable_children.js
@@ -38,107 +38,99 @@ add_task(async function () {
selectNode,
});
- const tabProcessID =
- tab.linkedBrowser.browsingContext.currentWindowGlobal.osPid;
-
- const decodedTabURI = decodeURI(tab.linkedBrowser.currentURI.spec);
-
- await ToolboxTask.spawn(
- [tabProcessID, isFissionEnabled(), decodedTabURI],
- async (processID, _isFissionEnabled, tabURI) => {
- /* global gToolbox */
- const inspector = gToolbox.getPanel("inspector");
-
- info("Select the test browser element.");
- await selectNode('browser[remote="true"][test-tab]', inspector);
-
- info("Retrieve the node front for selected node.");
- const browserNodeFront = inspector.selection.nodeFront;
- ok(!!browserNodeFront, "Retrieved a node front for the browser");
- is(browserNodeFront.displayName, "browser");
-
- // Small helper to expand containers and return the child container
- // matching the provided display name.
- async function expandContainer(container, expectedChildName) {
- info(`Expand the node expected to contain a ${expectedChildName}`);
- await inspector.markup.expandNode(container.node);
- await waitUntil(() => !!container.getChildContainers().length);
-
- const children = container
- .getChildContainers()
- .filter(child => child.node.displayName === expectedChildName);
- is(children.length, 1);
- return children[0];
- }
-
- info("Check that the corresponding markup view container has children");
- const browserContainer = inspector.markup.getContainer(browserNodeFront);
- ok(browserContainer.hasChildren);
- ok(
- !browserContainer.node.childrenUnavailable,
- "childrenUnavailable un-set"
- );
- ok(
- !browserContainer.elt.querySelector(".unavailable-children"),
- "The unavailable badge is not displayed"
- );
-
- // Store the asserts as a helper to reuse it later in the test.
- async function assertMarkupView() {
- info("Check that the children are #document > html > body > div");
- let container = await expandContainer(browserContainer, "#document");
- container = await expandContainer(container, "html");
- container = await expandContainer(container, "body");
- container = await expandContainer(container, "div");
-
- info("Select the #pick-me div");
- await selectNode(container.node, inspector);
- is(inspector.selection.nodeFront.id, "pick-me");
- }
- await assertMarkupView();
-
- const parentProcessScope = gToolbox.doc.querySelector(
- 'input[name="chrome-debug-mode"][value="parent-process"]'
- );
-
- info("Switch to parent process only scope");
- const onInspectorUpdated = inspector.once("inspector-updated");
- parentProcessScope.click();
- await onInspectorUpdated;
-
- // Note: `getChildContainers` returns null when the container has no
- // children, instead of an empty array.
- await waitUntil(() => browserContainer.getChildContainers() === null);
-
- ok(!browserContainer.hasChildren, "browser container has no children");
- ok(browserContainer.node.childrenUnavailable, "childrenUnavailable set");
- ok(
- !!browserContainer.elt.querySelector(".unavailable-children"),
- "The unavailable badge is displayed"
- );
-
- const everythingScope = gToolbox.doc.querySelector(
- 'input[name="chrome-debug-mode"][value="everything"]'
- );
-
- info("Switch to multi process scope");
- everythingScope.click();
-
- info("Wait until browserContainer has children");
- await waitUntil(() => browserContainer.hasChildren);
- ok(browserContainer.hasChildren, "browser container has children");
- ok(
- !browserContainer.node.childrenUnavailable,
- "childrenUnavailable un-set"
- );
- ok(
- !browserContainer.elt.querySelector(".unavailable-children"),
- "The unavailable badge is no longer displayed"
- );
-
- await assertMarkupView();
+ await ToolboxTask.spawn([], async () => {
+ /* global gToolbox */
+ const inspector = gToolbox.getPanel("inspector");
+
+ info("Select the test browser element.");
+ await selectNode('browser[remote="true"][test-tab]', inspector);
+
+ info("Retrieve the node front for selected node.");
+ const browserNodeFront = inspector.selection.nodeFront;
+ ok(!!browserNodeFront, "Retrieved a node front for the browser");
+ is(browserNodeFront.displayName, "browser");
+
+ // Small helper to expand containers and return the child container
+ // matching the provided display name.
+ async function expandContainer(container, expectedChildName) {
+ info(`Expand the node expected to contain a ${expectedChildName}`);
+ await inspector.markup.expandNode(container.node);
+ await waitUntil(() => !!container.getChildContainers().length);
+
+ const children = container
+ .getChildContainers()
+ .filter(child => child.node.displayName === expectedChildName);
+ is(children.length, 1);
+ return children[0];
}
- );
+
+ info("Check that the corresponding markup view container has children");
+ const browserContainer = inspector.markup.getContainer(browserNodeFront);
+ ok(browserContainer.hasChildren);
+ ok(
+ !browserContainer.node.childrenUnavailable,
+ "childrenUnavailable un-set"
+ );
+ ok(
+ !browserContainer.elt.querySelector(".unavailable-children"),
+ "The unavailable badge is not displayed"
+ );
+
+ // Store the asserts as a helper to reuse it later in the test.
+ async function assertMarkupView() {
+ info("Check that the children are #document > html > body > div");
+ let container = await expandContainer(browserContainer, "#document");
+ container = await expandContainer(container, "html");
+ container = await expandContainer(container, "body");
+ container = await expandContainer(container, "div");
+
+ info("Select the #pick-me div");
+ await selectNode(container.node, inspector);
+ is(inspector.selection.nodeFront.id, "pick-me");
+ }
+ await assertMarkupView();
+
+ const parentProcessScope = gToolbox.doc.querySelector(
+ 'input[name="chrome-debug-mode"][value="parent-process"]'
+ );
+
+ info("Switch to parent process only scope");
+ const onInspectorUpdated = inspector.once("inspector-updated");
+ parentProcessScope.click();
+ await onInspectorUpdated;
+
+ // Note: `getChildContainers` returns null when the container has no
+ // children, instead of an empty array.
+ await waitUntil(() => browserContainer.getChildContainers() === null);
+
+ ok(!browserContainer.hasChildren, "browser container has no children");
+ ok(browserContainer.node.childrenUnavailable, "childrenUnavailable set");
+ ok(
+ !!browserContainer.elt.querySelector(".unavailable-children"),
+ "The unavailable badge is displayed"
+ );
+
+ const everythingScope = gToolbox.doc.querySelector(
+ 'input[name="chrome-debug-mode"][value="everything"]'
+ );
+
+ info("Switch to multi process scope");
+ everythingScope.click();
+
+ info("Wait until browserContainer has children");
+ await waitUntil(() => browserContainer.hasChildren);
+ ok(browserContainer.hasChildren, "browser container has children");
+ ok(
+ !browserContainer.node.childrenUnavailable,
+ "childrenUnavailable un-set"
+ );
+ ok(
+ !browserContainer.elt.querySelector(".unavailable-children"),
+ "The unavailable badge is no longer displayed"
+ );
+
+ await assertMarkupView();
+ });
await ToolboxTask.destroy();
});