Commit 43b8b5ab authored by Lucas Furukawa Gadani's avatar Lucas Furukawa Gadani Committed by Commit Bot

Portals: Do not create a RemoteFrame for a portal when a portal if

inserted into a disconnected node.

Bug: 1029508
Change-Id: I8d90a488198b0772baa2bd41a16c6a330fc792fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943310Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720283}
parent a2d0668d
...@@ -300,6 +300,13 @@ HTMLPortalElement::InsertionNotificationRequest HTMLPortalElement::InsertedInto( ...@@ -300,6 +300,13 @@ HTMLPortalElement::InsertionNotificationRequest HTMLPortalElement::InsertedInto(
break; break;
}; };
// When adopting a predecessor, it is possible to insert a portal that's
// eligible to have a guest contents to a node that's not connected. In this
// case, do not create the portal frame yet.
if (!node.isConnected()) {
return result;
}
if (portal_) { if (portal_) {
// The interface is already bound if the HTMLPortalElement is adopting the // The interface is already bound if the HTMLPortalElement is adopting the
// predecessor. // predecessor.
......
...@@ -62,4 +62,14 @@ ...@@ -62,4 +62,14 @@
}); });
window.open(`resources/portals-adopt-predecessor.html?test=${test}`); window.open(`resources/portals-adopt-predecessor.html?test=${test}`);
}, "Tests that the adopted predecessor is destroyed if it isn't inserted"); }, "Tests that the adopted predecessor is destroyed if it isn't inserted");
async_test(t => {
var test = "adopt-to-disconnected-node";
var bc = new BroadcastChannel(`test-${test}`);
bc.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "passed");
bc.close();
});
window.open(`resources/portals-adopt-predecessor.html?test=${test}`);
}, "Tests that an adopted portal can be inserted into a disconnected node.");
</script> </script>
...@@ -64,5 +64,14 @@ ...@@ -64,5 +64,14 @@
}); });
}); });
} }
if (test == "adopt-to-disconnected-node") {
var portal = e.adoptPredecessor();
document.body.appendChild(portal);
var node = document.createElement("div");
node.appendChild(portal);
var bc_test = new BroadcastChannel(`test-${test}`);
bc_test.postMessage("passed");
bc_test.close();
}
} }
</script> </script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment