Open Bug 1776169 Opened 2 years ago Updated 2 years ago

Split cloning and layout for cross-origin iframes into two separate steps

Categories

(Core :: Printing: Setup, defect, P3)

defect

Tracking

()

People

(Reporter: jwatt, Unassigned)

Details

In nsGlobalWindowOuter::Print we call GetDefaultPrintSettingsForPrinting if aPrintSettings is null, which happens when this function is invoked by a window.print() call.

The question is, why do we even need this settings object at this point, given that in the window.print() case we only do the static clone when invoked by window.print(), and we avoid doing any pagination/layout until later (after a round-trip to the parent process) when we have a valid nsIPrintSettings object to do it with.

It turns out that, surprisingly, the thing we're doing with the settings object is passing it to the CreateStaticClone call. You would hope that a print settings object would be completely unnecessary for the clone, but it turns out that, since D119103, we've been calling UpdateRemotePrintSettings in BrowserChild::RecvCloneDocumentTreeIntoSelf. In other words, unfortunately there's not currently a strong separation between cloning and the subsequent layout for window.print() when it comes to any cross-origin iframes (as there is for those two operations in the originating nsGlobalWindowOuter::Print call, as described above).

Really we should change the code to have cloning and layout done in two distinct steps for cross-origin iframes. In that case CreateStaticClone wouldn't need an nsIPrintSettings object to be passed, and we wouldn't need the GetDefaultPrintSettingsForPrinting call mentioned above.

The severity field is not set for this bug.
:emilio, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(emilio)
Severity: -- → S3
Flags: needinfo?(emilio)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.