summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_events_chrome_not_blocked.js
blob: c04dd3c396e94e2f3fe631abf4e8a39e4440c67d (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
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from helper_events_test_runner.js */

("use strict");

// Test that markup view chrome event bubbles are shown when
// devtools.chrome.enabled = true.

const TEST_URL = URL_ROOT + "doc_markup_events_chrome_listeners.html";

loadHelperScript("helper_events_test_runner.js");

const TEST_DATA = [
  {
    selector: "div",
    expected: [
      {
        type: "click",
        filename:
          getRootDirectory(gTestPath) +
          "browser_markup_events_chrome_not_blocked.js:45:34",
        attributes: ["Bubbling"],
        handler: `() => {
          /* Do nothing */
        }`,
      },
    ],
  },
];

add_task(async function () {
  waitForExplicitFinish();
  await pushPref("devtools.chrome.enabled", true);

  const { tab, inspector } = await openInspectorForURL(TEST_URL);
  const browser = tab.linkedBrowser;

  const eventBadgeAdded = inspector.markup.once("badge-added-event");
  info("Loading frame script");

  await SpecialPowers.spawn(browser, [], () => {
    const div = content.document.querySelector("div");
    div.addEventListener("click", () => {
      /* Do nothing */
    });
  });
  await eventBadgeAdded;

  for (const test of TEST_DATA) {
    await checkEventsForNode(test, inspector);
  }
});