mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1603209
- Support remote frame targets in the omniscient browser toolbox r=ochameau
Depends on D57130 Differential Revision: https://phabricator.services.mozilla.com/D56347 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
38a3c757d8
commit
efe4d2c870
@ -15,6 +15,12 @@ loader.lazyRequireGetter(
|
||||
"devtools/server/connectors/frame-connector",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"connectToFrameWithJsWindowActor",
|
||||
"devtools/server/connectors/js-window-actor/frame-js-window-actor-connector",
|
||||
true
|
||||
);
|
||||
|
||||
const FrameDescriptorActor = ActorClassWithSpec(frameDescriptorSpec, {
|
||||
initialize(connection, browsingContext) {
|
||||
@ -36,11 +42,11 @@ const FrameDescriptorActor = ActorClassWithSpec(frameDescriptorSpec, {
|
||||
},
|
||||
|
||||
async _connectBrowsingContext() {
|
||||
const id = this.id;
|
||||
return {
|
||||
error: "NoJSWindowAPISupport",
|
||||
message: `The browsingContext '${id}' can only be accessed via JSWindowAPI`,
|
||||
};
|
||||
return connectToFrameWithJsWindowActor(
|
||||
this.conn,
|
||||
this._browsingContext,
|
||||
this.destroy
|
||||
);
|
||||
},
|
||||
|
||||
get _mm() {
|
||||
|
@ -9,7 +9,6 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
await pushPref("fission.autostart", true);
|
||||
const tabTarget = await addTabTarget(MAIN_DOMAIN + "doc_iframe.html");
|
||||
await testLocalListFrames(tabTarget);
|
||||
await testBrowserListFrames(tabTarget);
|
||||
@ -23,11 +22,10 @@ async function testLocalListFrames(tabTarget) {
|
||||
const { frames } = await tabTarget.listRemoteFrames();
|
||||
is(frames.length, 2, "Got two frames");
|
||||
|
||||
// Since we do not have access to remote frames yet this will return null.
|
||||
// This test should be updated when we have access to remote frames.
|
||||
info("Check that we can connect to the remote targets");
|
||||
for (const frame of frames) {
|
||||
const frameTarget = await frame.getTarget();
|
||||
is(frameTarget, null, "We cannot get remote iframe fronts yet");
|
||||
ok(frameTarget && frameTarget.actor, "Valid frame target retrieved");
|
||||
}
|
||||
|
||||
// However we can confirm that the newly created iframe is there.
|
||||
@ -68,13 +66,11 @@ async function getFrames(target) {
|
||||
const { result } = await consoleFront.evaluateJSAsync("var a = 42; a");
|
||||
is(result, 42, "console.eval worked");
|
||||
|
||||
// Although we can get metadata about the child frames,
|
||||
// since we do not have access to remote frames yet, this will return null.
|
||||
// This test should be updated when we have access to remote frames.
|
||||
info("Check that we can connect to the remote frames");
|
||||
const childFrames = frames.filter(d => d.parentID === descriptor.id);
|
||||
for (const frame of childFrames) {
|
||||
const frameTarget = await frame.getTarget();
|
||||
is(frameTarget, null, "We cannot get remote iframe fronts yet");
|
||||
ok(frameTarget && frameTarget.actor, "Valid frame target retrieved");
|
||||
}
|
||||
|
||||
await getFirstFrameAgain(front, descriptor, target);
|
||||
|
@ -844,16 +844,18 @@ exports.getAbsoluteScrollOffsetsForNode = getAbsoluteScrollOffsetsForNode;
|
||||
* - In the context of the content toolbox, a remote frame can be a <iframe> that contains
|
||||
* a different origin document.
|
||||
*
|
||||
* For now, this function only checks the former.
|
||||
*
|
||||
* @param {DOMNode} node
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isRemoteFrame(node) {
|
||||
return (
|
||||
node.childNodes.length == 0 &&
|
||||
ChromeUtils.getClassName(node) == "XULFrameElement" &&
|
||||
node.getAttribute("remote") == "true"
|
||||
);
|
||||
if (ChromeUtils.getClassName(node) == "HTMLIFrameElement") {
|
||||
return node.frameLoader && node.frameLoader.isRemoteFrame;
|
||||
}
|
||||
|
||||
if (ChromeUtils.getClassName(node) == "XULFrameElement") {
|
||||
return !node.childNodes.length && node.getAttribute("remote") == "true";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
exports.isRemoteFrame = isRemoteFrame;
|
||||
|
Loading…
Reference in New Issue
Block a user