gecko-dev/layout/reftests/printing/test-print-selection-iframe.html
Emilio Cobos Álvarez a68a0e6e0e Bug 1672864 - Don't resume printing too early. r=jfkthame
When we do the initial reflow, we remove nodes from the document if
we're printing the selection. If these operations cause one iframe to be
removed, for example, then we may get hit with an nsIWebProgress
notification synchronously, which may cause us to go through
MaybeResumePrintAfterResourcesLoaded too early (and thus twice), which
messes up our state.

The ideal solution would be to add us as a listener a bit later, but we
can't because we need to know whether we did load anything during the
initial reflow.

So instead of that, just avoid resuming print while we're doing the
reflow. We'll call MaybeResumePrintAfterResourcesLoaded a few lines
below.

Differential Revision: https://phabricator.services.mozilla.com/D94586
2020-10-23 18:34:05 +00:00

21 lines
557 B
HTML

<!DOCTYPE html>
<html reftest-print-range="selection">
<head>
<meta charset="utf-8">
<link href="print.css" rel="stylesheet">
<script>
function selectNodeById(id) {
var node = document.getElementById(id);
var rng = document.createRange();
rng.selectNode(node);
window.getSelection().addRange(rng);
}
</script>
</head>
<body onload="selectNodeById('selection')">
<p>This text should not be there</p>
<p id="selection">This text should appear on page 1</p>
<iframe src="data:text/html,"></iframe>
</body>
</html>