Closed Bug 1653334 Opened 4 years ago Closed 4 years ago

"Print selection" is broken if the selected text is in a subdocument (iframe)

Categories

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

defect

Tracking

()

VERIFIED FIXED
81 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- wontfix
firefox78 --- wontfix
firefox79 --- wontfix
firefox80 --- wontfix
firefox81 --- verified

People

(Reporter: jwatt, Assigned: bobowen)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [print2020_v81])

Attachments

(2 files)

We only call CachePrintSelectionRanges in nsPrintObject::InitAsRootObject. So if the selection is in a subdocument, then the "Print selection" functionality will be broken.

Looks like this is just a matter of adding the function call to do the caching into InitAsNestedObject.

Assignee: nobody → bobowencode
Status: NEW → ASSIGNED
Priority: P2 → P1

I also had in mind to propagate out from the InitAs*Object functions the information on whether there is a selection. That would allow later code to avoid querying the documents. Ideally nsPrintData would know exactly which of its nsPrintObjects has the selection it should use. I believe that should be the one from the document that was cloned from the focused window, or else the selection from the first document found in a depth first search.

These unused members are removed from nsIWebBrowserPrint and PPrintingTypes
along with their supporting functions.

This also refactors the selection printing code, so that as we build the tree we
record which nsPrintObject should be used if printing a Selection is chosen.

Depends on D85007

Whiteboard: [print2020] → [print2020_v81]
Blocks: 1653981
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/75a5873f02a4 part 1: Remove unused isRangeSelection and isIFrameSelected. r=jwatt https://hg.mozilla.org/integration/autoland/rev/6cc6bbaa91f0 part 2: Cache the selection ranges on subdocuments as we build the nsPrintObject tree. r=jwatt
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/93dd13edad8a part 1: Remove unused isRangeSelection and isIFrameSelected. r=jwatt https://hg.mozilla.org/integration/autoland/rev/2adc23aed2a6 part 2: Cache the selection ranges on subdocuments as we build the nsPrintObject tree. r=jwatt
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
Blocks: 1652258
Flags: needinfo?(bobowencode)

Is this worth uplifting to beta and/or esr78?

Flags: needinfo?(bobowencode)

(In reply to Julien Cristau [:jcristau] from comment #9)

Is this worth uplifting to beta and/or esr78?

This turned into quite a big change, so I'm a little nervous about uplifting to Beta now that Beta is quite short.
The crash that this fixes in bug 1653981 is fairly rare.
jwatt - what do you think?

I think once it looks good on Beta (but maybe Beta 81), we should probably uplift to ESR78.

Flags: needinfo?(bobowencode) → needinfo?(jwatt)

I agree with all the above.

Flags: needinfo?(jwatt)

Reproduced with Fx 80.0a1 (2020-07-16) on Windows 10.
Verified fixed with Fx 81.0a1 (2020-08-18) on Windows 10, macOS 10.15 and Ubuntu 18.04.

Status: RESOLVED → VERIFIED
Regressions: 1660463
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: