Open Bug 1701504 Opened 4 years ago Updated 3 years ago

Looking for hasSelection in window.print() needs to be smarter.

Categories

(Toolkit :: Printing, defect)

defect

Tracking

()

People

(Reporter: emilio, Unassigned)

References

Details

Right now when you window.print() on an iframe, we try to get the selection for the "print selection" functionality. This code generally wants to look at the active frame because you may be selecting on an iframe and press Ctrl+P for example.

But for window.print(), the root of the "printed" thing may not be the top level page, so the focused frame may be outside of the browsing context subtree. In such case, looking for a selection is pointless.

We should communicate the root of the subtree we're printing to the selection query, most likely, and that should return false if the active browsing context is not an inclusive descendant of that subtree. This should be reproducible with a test-case like the one in bug 1697836, but with a selection in the iframe you click the button on (and probably a timer instead of a button, as clicking the button most likely collapses the selection).

Component: Permission Manager → Printing
Product: Core → Toolkit
Severity: -- → S4
You need to log in before you can comment on or make changes to this bug.