Bug 1575237 - allow access to all remote child targets' inspector fronts from the root target r=pbro,rcaliman

inspector front; r=!ochameau,!pbro"

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
yulia 2019-08-27 14:42:38 +00:00
Родитель a154c0ec39
Коммит 49511b6da8
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -30,6 +30,7 @@ const TELEMETRY_EYEDROPPER_OPENED_MENU =
const SHOW_ALL_ANONYMOUS_CONTENT_PREF =
"devtools.inspector.showAllAnonymousContent";
const SHOW_UA_SHADOW_ROOTS_PREF = "devtools.inspector.showUserAgentShadowRoots";
const FISSION_ENABLED = "devtools.browsertoolbox.fission";
const telemetry = new Telemetry();
@ -459,6 +460,9 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
// Finally retrieve the NodeFront of the remote frame's document
const documentNode = await walker.getRootNode();
// Force reparenting through the remote frame boundary.
documentNode.reparent(node);
// And return the same kind of response `walker.children` returns
return {
nodes: [documentNode],
@ -564,6 +568,25 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) {
telemetry.getHistogramById(TELEMETRY_EYEDROPPER_OPENED).add(true);
}
}
async getChildInspectors() {
const fissionEnabled = Services.prefs.getBoolPref(FISSION_ENABLED);
const childInspectors = [];
const target = this.targetFront;
// this line can be removed when we are ready for fission frames
if (fissionEnabled && target.chrome && !target.isAddon) {
const { frames } = await target.listRemoteFrames();
// attempt to get targets and filter by targets that could connect
for (const descriptor of frames) {
const remoteTarget = await descriptor.getTarget();
if (remoteTarget) {
const remoteInspectorFront = await remoteTarget.getFront("inspector");
childInspectors.push(remoteInspectorFront);
}
}
}
return childInspectors;
}
}
exports.InspectorFront = InspectorFront;