Skip to content

preparePrint() followed by print() may not do what is intended #48

@schenney-chromium

Description

@schenney-chromium

It's plausible that after preparePrint() has been called and executed, the browser may perform layout again before script has a chance to call print(). The browser may then decide that the loaded resources are not needed and release them. This creates a race condition on calling print() before resources are released. Regardless of resources, it will create style and layout churn.

Firefox would not have this problem because it snapshots the document before printing. But Chrome and Safari probably both have this potential problem.

The solution is to roll prepare and print together as, for example, requestPrint() which is essentially an async print().

Another option is to return some handle that will keep the print-ready document alive, though it would be challenging for Chromium and Safari, I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions