summaryrefslogtreecommitdiffstats
path: root/devtools/client/dom/test/browser_dom_fission_target_switching.js
blob: 4393a7d8420528e4dd9d479da09bb933b08ce2c3 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

// Test top-level target switching in the DOM panel.

const PARENT_PROCESS_URI = "about:robots";
const CONTENT_PROCESS_URI = URL_ROOT_SSL + "page_basic.html";

add_task(async function () {
  // We use about:robots as the starting page because it will run in the parent process.
  // Navigating from that page to a regular content page will always trigger a target
  // switch, with or without fission.

  info("Open a page that runs in the parent process");
  const { panel } = await addTestTab(PARENT_PROCESS_URI);

  const _aProperty = getRowByLabel(panel, "_a");
  let buttonProperty = getRowByLabel(panel, "button");

  ok(!_aProperty, "There is no _a property on the about:robots page");
  ok(buttonProperty, "There is, however, a button property on this page");

  info("Navigate to a page that runs in the content process");
  // Wait for the DOM panel to refresh.
  const store = getReduxStoreFromPanel(panel);
  const onPropertiesFetched = waitForDispatch(store, "FETCH_PROPERTIES");
  // Also wait for the toolbox to switch to the new target, to avoid hanging requests when
  // the test ends.
  await navigateTo(CONTENT_PROCESS_URI);
  await onPropertiesFetched;

  await waitFor(() => getRowByLabel(panel, "_a"));
  ok(true, "This time, the _a property exists on this content process page");

  buttonProperty = getRowByLabel(panel, "button");
  ok(
    !buttonProperty,
    "There is, however, no more button property on this page"
  );
});