Skip to content

Commit

Permalink
Notify of appends to the right document when parsing into an already-…
Browse files Browse the repository at this point in the history
…adopted node.

nsContentSink used to decide that it was fine to not notify of silent appends to
a document from the parser if the node was not on our document already.

That's not ok, since if styling or layout have happened already on the document
we're getting inserted into nobody notices them, which is wrong.

Differential Revision: https://phabricator.services.mozilla.com/D25300

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1539742
gecko-commit: cf6cfe33476622c202fcbc34ef12f8ca1c039b8a
gecko-integration-branch: central
gecko-reviewers: bzbarsky
  • Loading branch information
emilio authored and moz-wptsync-bot committed Apr 8, 2019
1 parent 81ae708 commit 3a4ed45
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xhtml/adopt-while-parsing-001-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<title>Test reference</title>
<style>
html, body { margin: 0 }
</style>
<iframe src="about:blank"></iframe>
<div>
PASS
</div>
19 changes: 19 additions & 0 deletions xhtml/adopt-while-parsing-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<title>Appending from the parser after adopting in an XML document doesn't miss notifications</title>
<link rel="match" href="adopt-while-parsing-001-ref.html">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1511329">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<style>
html, body { margin: 0 }
</style>
<script>
// If we don't get notified of the <div> insertion, the PASS text will never appear.
function parsingInterrupted() {
let frameDoc = document.querySelector("iframe").contentDocument;
let root = frameDoc.documentElement;
document.documentElement.appendChild(root);
root.offsetTop;
}
</script>
<iframe src="adopt-while-parsing.xhtml"></iframe>
11 changes: 11 additions & 0 deletions xhtml/adopt-while-parsing.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<script>
window.parent.parsingInterrupted();
</script>
<div>
PASS
</div>
</body>
</html>

0 comments on commit 3a4ed45

Please sign in to comment.