Bug 1586201 - Include ContentDomReference in Node grips. r=pbro.

This will allow us to retrieve the appropriate inspector
(and thus walker, highlighter, ...) for a given element
later, potentially from a different DebuggerServer.

Differential Revision: https://phabricator.services.mozilla.com/D48807

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-10-18 09:06:27 +00:00
Родитель d71aa730aa
Коммит ac6ad6abfb
2 изменённых файлов: 22 добавлений и 0 удалений

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

@ -34,6 +34,16 @@ loader.lazyRequireGetter(
"devtools/server/actors/object/stringifiers"
);
// ContentDOMReference requires ChromeUtils, which isn't available in worker context.
if (!isWorker) {
loader.lazyRequireGetter(
this,
"ContentDOMReference",
"resource://gre/modules/ContentDOMReference.jsm",
true
);
}
const {
getArrayLength,
getPromiseState,
@ -249,6 +259,17 @@ const proto = {
this._populateGripPreview(g, raw);
this.hooks.decrementGripDepth();
if (raw && Node.isInstance(raw) && ContentDOMReference) {
// ContentDOMReference.get takes a DOM element and returns an object with
// its browsing context id, as well as a unique identifier. We are putting it in
// the grip here in order to be able to retrieve the node later, potentially from a
// different DebuggerServer running in the same process.
// If ContentDOMReference.get throws, we simply don't add the property to the grip.
try {
g.contentDomReference = ContentDOMReference.get(raw);
} catch (e) {}
}
return g;
},

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

@ -164,5 +164,6 @@ fail-if = fission
[browser_webextension_inspected_window.js]
[browser_dbg_promises-allocation-stack.js]
[browser_dbg_promises-chrome-allocation-stack.js]
skip-if = true # Bug 1589571
[browser_dbg_promises-fulfillment-stack.js]
[browser_dbg_promises-rejection-stack.js]