electron icon indicating copy to clipboard operation
electron copied to clipboard

[Bug]: Window with iframes gets frozen after printing

Open IliaGusarov opened this issue 3 years ago • 1 comments

Preflight Checklist

Electron Version

19.0.9

What operating system are you using?

macOS

Operating System Version

macOS Monterey 12.3.1

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Window should not get frozen after printing

Actual Behavior

Window with iframes gets frozen after printing(Save as PDF)

Steps to reproduce:

  1. Load html file with an iframe
<html>
  <body>
    <iframe src="https://en.wikipedia.org/"></iframe>
    <button onclick="print()">Print me</button>
  </body>
</html>
  1. Click on print button
  2. Save as PDF
  3. As a result window content gets frozen

Testcase Gist URL

No response

Additional Information

No response

IliaGusarov avatar Jul 28 '22 21:07 IliaGusarov

I added the above code snippet to the stock Fiddle and could not reproduce.

To try and repro, I:

  1. Ran the Fiddle
  2. Clicked "print me"
  3. Clicked "Save as PDF" and saved the PDF
  4. Clicked back into the iframe and tried to load another page, which loaded successfully

So i'm not sure what you're experiencing in terms of the page ostensibly freezing. I also tried to print again, and could successfully.

codebytere avatar Aug 01 '22 09:08 codebytere

@codebytere Did you try to reproduce it on macOS Monterey ?

IliaGusarov avatar Aug 02 '22 14:08 IliaGusarov

same problem using 19.0.13

sohobloo avatar Sep 06 '22 07:09 sohobloo

Also seeing this on 19.0.12.

As a workaround, we're removing the iframes, printing, then restoring the iframes.

const iframes = Array.from(document.querySelector('iframe')).map(i => {
    const parent = iframe.parentElement
    const before = {
        iframe,
        parent,
        nextSibling: iframe.nextSibling
    }
    parent?.removeChild(iframe)
    return before;
})
window.print()
iframes.forEach(i => {
    const {
        iframe,
        parent,
        nextSibling
    } = i
    if (nextSibling) {
        parent.insertBefore(iframe, nextSibling)
    } else {
        parent.appendChild(iframe)
    }
})

patrickdbakke avatar Sep 27 '22 01:09 patrickdbakke

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

github-actions[bot] avatar Jan 10 '23 02:01 github-actions[bot]

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

github-actions[bot] avatar Feb 10 '23 02:02 github-actions[bot]

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

github-actions[bot] avatar May 15 '23 01:05 github-actions[bot]

bump

pushkin- avatar May 15 '23 14:05 pushkin-

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

github-actions[bot] avatar Aug 15 '23 01:08 github-actions[bot]

bump

patrickdbakke avatar Aug 15 '23 03:08 patrickdbakke

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

Same as before: https://github.com/electron/electron/issues/35119#issuecomment-1200968238

Cannot reproduce on macOS. Given this has been open for a long time and I've never been able to reproduce this i'm closing it out but if someone can provide a repro i can re-open.

codebytere avatar Nov 14 '23 09:11 codebytere