Closed Bug 1676188 Opened 4 years ago Closed 3 years ago

Cross origin iframe’s content is not displayed while using window.print() with fission enabled

Categories

(Core :: Print Preview, defect, P2)

Firefox 84
defect

Tracking

()

RESOLVED FIXED
84 Branch
Fission Milestone Future
Tracking Status
firefox84 --- fixed

People

(Reporter: emilghitta, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Whiteboard: [print2020][old-ui+])

Attachments

(3 files)

Attached image crossOrigin.png

Affected versions

  • Firefox 84.0a1 (BuildId:20201108212832)

Affected platforms

  • Windows 10 64bit
  • Ubuntu 20.04 64bit
  • macOS 10.14

Preconditions
Enable the following prefs:

  • fission.autostart
  • gfx.webrender.all

Steps to reproduce

  1. Launch Firefox.
  2. Access the following link.
  3. Open the web console and input window.print().

Expected result

  • The print preview is displayed and the content from the Cross origin Iframe is successfully displayed.

Actual result

  • The print preview is displayed and the content from the Cross origin Iframe is not displayed. The actual print output seems to be affected as well.

Regression Window

  • I'll further investigate asap.

Additional Information

  • Please observe the attached screenshot for further information regarding this issue.
  • [Suggested Severity] S3
  • This issue is reproducible only with Fission enabled.
  • The old UI seems to be affected as well (this can be visible on Windows & Linux by opening the print preview via the hamburger menu).
  • This issue doesn’t seem to be reproducible on the new ui while opening the print preview via the hamburger menu, CTR+P or via menu bar print option.
Component: Printing → Print Preview
Product: Toolkit → Core

Seems like a regression because I thought cross-origin iframes were working in print preview, but now I don't recall testing with window.print(). ni? to Emilio.

Severity: -- → S3
Fission Milestone: --- → M6c
Flags: needinfo?(emilio)
Priority: -- → P2

Hmm yeah, not sure why window.print() would be different. Ctrl+P works just fine.

So this seems to be a race between the docshell swap that happens when window.print "swaps" into our dialog, and the process swap... If I delay enough the docshell swap like this, then it works:

diff --git a/toolkit/components/printing/content/printUtils.js b/toolkit/components/printing/content/printUtils.js
index cb09179c7146..5e45f88fae30 100644
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -216,6 +216,8 @@ var PrintUtils = {
       return Promise.reject();
     }
 
+    await new Promise(resolve => setTimeout(() => resolve(), 1000));
+
     // Create a preview browser.
     let args = PromptUtils.objectToPropBag({
       previewBrowser: aExistingPreviewBrowser,

Not sure yet where things are going wrong, though here's a pernosco recording of the problem: https://pernos.co/debug/WWLjbsuKOPlwmRh0pBKX7A/index.html

This doesn't fix the root cause of the issue, but it does fix the issue,
and I think it's worth it, because it's both less work, and less brittle
code (not involving swapDocShells() is always a win in any context).

I'll file a bug for the original problem (which is a Gecko race with the
compositor).

I had to tweak some tests because we insert the preview browser sooner
now, and abortAllDialogs() and such only work after the frame's
DOMContentLoaded event has fired.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Blocks: 1676721

Moving my ni? to bug 1676721, where I'll keep digging on the root cause.

Flags: needinfo?(emilio)

As there's no incremental reflow for non-print documents, we can't rely
on FinishReflow getting called.

Not ultra-pretty, better ideas welcome.

Keywords: leave-open
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4c8f30ddc6ec
Send position/size updates to remote print documents at paint time. r=mattwoodrow
Has Regression Range: --- → no
Has STR: --- → yes
Whiteboard: [print2020_v84][old-ui+] → [print2020_v85][old-ui+]
Whiteboard: [print2020_v85][old-ui+] → [print2020_v86][old-ui+]
Whiteboard: [print2020_v86][old-ui+] → [print2020_v87][old-ui+]

Emilio, what's left to do here?

Flags: needinfo?(emilio)

It looks fixed now, but I still want to land the swapDocShells change, which would be a nice simplification.

Flags: needinfo?(emilio)

Moving to Fission Future as the issue is now fixed and only a nice-to-have simplification is left.

Fission Milestone: M6c → Future
Whiteboard: [print2020_v87][old-ui+] → [print2020][old-ui+]

The leave-open keyword is there and there is no activity for 6 months.
:emilio, maybe it's time to close this bug?

Flags: needinfo?(emilio)
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(emilio)
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: