Bug 1440537 - SwapFrameLoaders should flush frames. r=bzbarsky

swapFrameLoaders relies on frame information, but doesn't ensure it's
up-to-date.

The test for this (test_swapFrameLoaders.xul) is relying right now on one of
flushes from the inner documents to also flush the parent document and thus
ensure there's a frame created.

With the patch for this bug, that flush no longer propagates to the parent
document, and the test fails because we throw in:

https://searchfox.org/mozilla-central/rev/66086345467c69685434dd1c5177b30a7511b1a5/dom/base/nsFrameLoader.cpp#1634

This API could probably be made to work without that requirement, but it's
probably not worth it. For now just flush.

Differential Revision: https://phabricator.services.mozilla.com/D29160
This commit is contained in:
Emilio Cobos Álvarez
2019-04-29 18:45:03 +00:00
parent 2d8c9db0df
commit 98d5d29095
2 changed files with 10 additions and 0 deletions

View File

@@ -173,6 +173,11 @@ void nsGenericHTMLFrameElement::SwapFrameLoaders(
void nsGenericHTMLFrameElement::SwapFrameLoaders(
nsFrameLoaderOwner* aOtherLoaderOwner, mozilla::ErrorResult& rv) {
if (RefPtr<Document> doc = GetComposedDoc()) {
// SwapWithOtherLoader relies on frames being up-to-date.
doc->FlushPendingNotifications(FlushType::Frames);
}
RefPtr<nsFrameLoader> loader = GetFrameLoader();
RefPtr<nsFrameLoader> otherLoader = aOtherLoaderOwner->GetFrameLoader();
if (!loader || !otherLoader) {