Bug 1810340 - [devtools] Do not load DOMContentReference in the dedicated devtools global r=devtools-reviewers,ochameau

Parent process pages use a DevTools server loaded in the devtools global but should still load shared singletons in the regular global.

Differential Revision: https://phabricator.services.mozilla.com/D167731
This commit is contained in:
Julian Descottes 2023-01-25 19:52:47 +00:00
parent eec73ccfa8
commit 7d4467db1a
6 changed files with 82 additions and 12 deletions

View file

@ -184,6 +184,7 @@ skip-if = debug # Bug 1250058 - Docshell leak on debug
skip-if = win10_2004 # Bug 1723573
[browser_inspector_inspect_node_contextmenu.js]
[browser_inspector_inspect_node_contextmenu_nested.js]
[browser_inspector_inspect_parent_process_page.js]
[browser_inspector_invalidate.js]
[browser_inspector_keyboard-shortcuts-copy-outerhtml.js]
[browser_inspector_keyboard-shortcuts.js]

View file

@ -0,0 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the "inspect element" context menu item works for parent process
// chrome pages.
add_task(async function() {
const tab = await addTab("about:debugging");
const browser = tab.linkedBrowser;
const document = browser.contentDocument;
info("Wait until Connect page is displayed");
await waitUntil(() => document.querySelector(".qa-connect-page"));
const inspector = await clickOnInspectMenuItem(".qa-network-form-input");
const selectedNode = inspector.selection.nodeFront;
ok(selectedNode, "A node is selected in the inspector");
is(
selectedNode.tagName.toLowerCase(),
"input",
"The selected node has the correct tagName"
);
ok(
selectedNode.className.includes("qa-network-form-input"),
"The selected node has the expected className"
);
});

View file

@ -63,9 +63,19 @@ loader.lazyRequireGetter(
true
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.sys.mjs",
});
loader.lazyGetter(
lazy,
"ContentDOMReference",
() =>
ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs",
{
// ContentDOMReference needs to be retrieved from the shared global
// since it is a shared singleton.
loadInDevToolsLoader: false,
}
).ContentDOMReference
);
const RELATIONS_TO_IGNORE = new Set([
Ci.nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION,

View file

@ -5,9 +5,19 @@
"use strict";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.sys.mjs",
});
loader.lazyGetter(
lazy,
"ContentDOMReference",
() =>
ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs",
{
// ContentDOMReference needs to be retrieved from the shared global
// since it is a shared singleton.
loadInDevToolsLoader: false,
}
).ContentDOMReference
);
loader.lazyRequireGetter(
this,
["isFrameWithChildTarget", "isWindowIncluded"],

View file

@ -102,9 +102,19 @@ loader.lazyRequireGetter(
// ContentDOMReference requires ChromeUtils, which isn't available in worker context.
const lazy = {};
if (!isWorker) {
ChromeUtils.defineESModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.sys.mjs",
});
loader.lazyGetter(
lazy,
"ContentDOMReference",
() =>
ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs",
{
// ContentDOMReference needs to be retrieved from the shared global
// since it is a shared singleton.
loadInDevToolsLoader: false,
}
).ContentDOMReference
);
}
loader.lazyServiceGetter(

View file

@ -50,9 +50,19 @@ loader.lazyRequireGetter(
// ContentDOMReference requires ChromeUtils, which isn't available in worker context.
const lazy = {};
if (!isWorker) {
ChromeUtils.defineESModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.sys.mjs",
});
loader.lazyGetter(
lazy,
"ContentDOMReference",
() =>
ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs",
{
// ContentDOMReference needs to be retrieved from the shared global
// since it is a shared singleton.
loadInDevToolsLoader: false,
}
).ContentDOMReference
);
}
const {