Bug 1672390, remove frame script and message manager use from devtools/client/inspector tests, r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D94390
This commit is contained in:
Neil Deakin 2020-10-27 00:26:24 +00:00
Родитель 46d65ff561
Коммит 851cf6f453
2 изменённых файлов: 20 добавлений и 23 удалений

Просмотреть файл

@ -8,7 +8,6 @@
// devtools.chrome.enabled = false.
const TEST_URL = URL_ROOT + "doc_markup_events_chrome_listeners.html";
const FRAMESCRIPT_URL = `data:,(${frameScript.toString()})()`;
loadHelperScript("helper_events_test_runner.js");
@ -25,12 +24,16 @@ add_task(async function() {
const { tab, inspector, testActor } = await openInspectorForURL(TEST_URL);
const browser = tab.linkedBrowser;
const mm = browser.messageManager;
const badgeEventAdded = inspector.markup.once("badge-added-event");
info("Loading frame script");
mm.loadFrameScript(`${FRAMESCRIPT_URL}`, false);
await SpecialPowers.spawn(browser, [], () => {
const div = content.document.querySelector("div");
div.addEventListener("click", () => {
/* Do nothing */
});
});
// We need to check that the "badge-added-event" event is not triggered so we
// need to wait for 5 seconds here.
@ -41,10 +44,3 @@ add_task(async function() {
await checkEventsForNode(test, inspector, testActor);
}
});
function frameScript() {
const div = content.document.querySelector("div");
div.addEventListener("click", () => {
/* Do nothing */
});
}

Просмотреть файл

@ -2,13 +2,12 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from helper_events_test_runner.js */
"use strict";
("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";
const FRAMESCRIPT_URL = `data:,(${frameScript.toString()})()`;
loadHelperScript("helper_events_test_runner.js");
@ -18,9 +17,13 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: `${FRAMESCRIPT_URL}:1:109`,
filename:
getRootDirectory(gTestPath) +
"browser_markup_events_chrome_not_blocked.js:45:34",
attributes: ["Bubbling", "DOM2"],
handler: `() => { /* Do nothing */ }`,
handler: `() => {
/* Do nothing */
}`,
},
],
},
@ -32,21 +35,19 @@ add_task(async function() {
const { tab, inspector, testActor } = await openInspectorForURL(TEST_URL);
const browser = tab.linkedBrowser;
const mm = browser.messageManager;
const eventBadgeAdded = inspector.markup.once("badge-added-event");
info("Loading frame script");
mm.loadFrameScript(`${FRAMESCRIPT_URL}`, false);
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, testActor);
}
});
function frameScript() {
const div = content.document.querySelector("div");
div.addEventListener("click", () => {
/* Do nothing */
});
}