Bug 1671503 - Handle documents from iframes that haven't changed remoteness yet correctly. r=nordzilla

See the comment. A bit racy, but some of the time crashtest crashes
without the patch.

Null-check is just paranoia.

Differential Revision: https://phabricator.services.mozilla.com/D93756
This commit is contained in:
Emilio Cobos Álvarez 2020-10-16 17:37:00 +00:00
Родитель 70754a80e3
Коммит 09c912b47a
3 изменённых файлов: 20 добавлений и 1 удалений

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

@ -0,0 +1,12 @@
<html class="reftest-wait">
<script>
document.addEventListener("DOMContentLoaded", () => {
window.requestIdleCallback(() => {
SpecialPowers.wrap(window).printPreview()?.close()
SpecialPowers.wrap(window).printPreview()?.close()
document.documentElement.className = "";
})
})
</script>
<iframe src='data:text/html,foo'></iframe>
</html>

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

@ -3,3 +3,4 @@ load 509839-2.html
load 576878.xhtml
asserts-if(Android,0-1) load 793844.html
load 1662259.html
load 1671503.html

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

@ -281,7 +281,13 @@ static void BuildNestedPrintObjects(const UniquePtr<nsPrintObject>& aParentPO,
RefPtr<Document> doc = docShell->GetDocument();
MOZ_DIAGNOSTIC_ASSERT(doc);
MOZ_DIAGNOSTIC_ASSERT(doc->IsStaticDocument());
// We might find non-static documents here if the fission remoteness change
// hasn't happened / finished yet. In that case, just skip them, the same
// way we do for remote frames above.
MOZ_DIAGNOSTIC_ASSERT(doc->IsStaticDocument() || doc->IsInitialDocument());
if (!doc || !doc->IsStaticDocument()) {
continue;
}
auto childPO = MakeUnique<nsPrintObject>();
nsresult rv = childPO->InitAsNestedObject(docShell, doc, aParentPO.get());