Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash in window.print() #19690

Merged
merged 2 commits into from
Aug 13, 2019
Merged

fix: crash in window.print() #19690

merged 2 commits into from
Aug 13, 2019

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Aug 8, 2019

Description of Change

Closes #19687.

window.print() also calls InitPrintSettings and would not receive the settings received when we call webContents.print() so we need to send PrintHostMsg_GetDefaultPrintSettings over IPC in that case.

cc @jkleinsc @deepak1556

Checklist

Release Notes

Notes: Fixed a crash in window.print().

@codebytere codebytere requested a review from a team as a code owner August 8, 2019 20:38
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Aug 8, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 9, 2019
@codebytere codebytere requested a review from brenca August 9, 2019 21:51
Copy link
Contributor

@brenca brenca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this, thanks! it can only be a basic api test but better to avoid situations where code path is accidentally removed.

@codebytere codebytere force-pushed the window-print branch 2 times, most recently from 55c8cf2 to d341b18 Compare August 10, 2019 03:23
@codebytere
Copy link
Member Author

codebytere commented Aug 12, 2019

@deepak1556 the test itself passes but the native printer dialog pops when window.print() gets called and blocks so the tests time out every time. How would you suggest we proceed here?

The webContents.print() tests don't block since they don't invoke the dialog and can stay, but we may not be able to programmatically test window.print() itself.

@deepak1556
Copy link
Member

Can you test with silent code path for window.print ?

Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM since we can't UI test this without introducing testing apis in printing code.

@codebytere codebytere merged commit e8fa248 into master Aug 13, 2019
@release-clerk
Copy link

release-clerk bot commented Aug 13, 2019

Release Notes Persisted

Fixed a crash in window.print().

@codebytere codebytere deleted the window-print branch August 13, 2019 06:44
@trop trop bot mentioned this pull request Aug 13, 2019
@trop
Copy link
Contributor

trop bot commented Aug 13, 2019

I have automatically backported this PR to "7-0-x", please check out #19728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

window.print() not working in electron 7.0.0-beta.2
3 participants