Verified Commit a9e5befe authored by David Shin's avatar David Shin Committed by ma1
Browse files

Bug 2068441: Make browsing context under printing browsing context not...

Bug 2068441: Make browsing context under printing browsing context not targetable.  a=diannaS DONTBUILD

Original Revision: https://phabricator.services.mozilla.com/D327854

Differential Revision: https://phabricator.services.mozilla.com/D329197
parent 94a287da
Loading
Loading
Loading
Loading
+1 −1
Changes for docshell/base/BrowsingContext.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1171,7 +1171,7 @@ void BrowsingContext::PrepareForProcessChange() {
}

bool BrowsingContext::IsTargetable() const {
  return !GetClosed() && AncestorsAreCurrent();
  return !GetClosed() && AncestorsAreCurrent() && !Top()->GetIsPrinting();
}

void BrowsingContext::SetOpener(BrowsingContext* aOpener) {
+45 −0
Changes for dom/base/crashtests/2068441.html: 45 added lines, 0 removed lines.
Original line number Diff line number Diff line
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
  canvas {
    break-before: page;
  }
  .fl {
    position: fixed;
    top: 0px;
    left: 0px;
  }
  .fl::first-letter {
    font-size: 3em;
  }
</style>
</head>
<body>
<iframe name="pf" srcdoc="<p>x</p>"></iframe>
<p class="fl" id="fp">                                                          aaa</p>

<canvas></canvas>
<script>
function cb(state) {
  const orig = document.querySelector("iframe[name=pf]");
  // Brush aside the live page's browsing context for the iframe.
  orig.name = "renamed";
  // Printing context is still named `pf`, look for it.
  const w = window.open("", "pf");
  try {
    w.parent.document.getElementById("fp").firstChild.data = "X";
  } finally {
    // Clean up for testing purposes.
    w.close();
    state.done();
  }
}

document.querySelector("canvas").mozPrintCallback = cb;
window.onload = () => { SpecialPowers.wrap(window).printPreview()?.close(); }
</script>
</body>
</html>
+1 −0
Changes for dom/base/crashtests/crashtests.list: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -285,3 +285,4 @@ load 1922153.html
load 1965664.html
load 1966485.html
load 1966466.html
load 2068441.html