-
Notifications
You must be signed in to change notification settings - Fork 16.3k
fix: <webview> loses state on Element.moveBefore #47894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
3dcdca8
to
3e8a1ab
Compare
3e8a1ab
to
c0ce26c
Compare
Unfortunately, this doesn't work properly because of what appears to me to be a bug in Chromium that should affect all The "connected subframes count" is not maintained properly, which results in a crash in CheckConnectedSubframeCountIsConsistent. The reason for this is that In our case, if you perform an atomic move the
... while
The following patch fixes this particular issue, and makes sense to me, but I will admit I do not know this code base at all, and I would appreciate help reporting / fixing this upstream: diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/htm
l_frame_owner_element.cc
index 8ce07b4801824..44d14a847182a 100644
--- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc
+++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -212,7 +212,7 @@ Node::InsertionNotificationRequest HTMLFrameOwnerElement::InsertedInto(
// For the non-state-preserving atomic move case (i.e., when we're setting
// up a full frame due to real insertion), this is done in
// `HTMLFrameOwnerElement::SetContentFrame()` below.
- for (ContainerNode* node = this; node;
+ for (ContainerNode* node = &insertion_point; node;
node = node->ParentOrShadowHostNode()) {
node->IncrementConnectedSubframeCount();
}
@@ -232,10 +232,6 @@ void HTMLFrameOwnerElement::RemovedFrom(ContainerNode& insertion_point) {
// but we still have to do (2) manually to maintain bookkeeping consistency
// among the ancestor nodes.
if (GetDocument().StatePreservingAtomicMoveInProgress() && ContentFrame()) {
- // `this` is no longer connected, so we have to decrement our subframe count
- // separately from our old ancestors's subframe count (i.e.,
- // `insertion_point`).
- DecrementConnectedSubframeCount();
for (ContainerNode* node = &insertion_point; node;
node = node->ParentOrShadowHostNode()) {
node->DecrementConnectedSubframeCount();
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damz i'm super unclear as to what's going on here - the code you've modified just changed a test? It doesn't touch or fix any core code at all. What's you goal here?
@codebytere Thank you for taking a look. The code change is literally just the addition of the empty This allows moving the This is what the test itself asserts, that you can move a |
Description of Change
Allow the
<webview>
custom element to maintain its state when it is moved around in the DOM viaElement.moveBefore
.Checklist
npm test
passesRelease Notes
Notes:
<webview>
now maintain its state when moved around in the DOM via theElement.moveBefore()
API.