-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Make print() run synchronously #4690
Conversation
This was a slip-up in the larger clean-up commit in 61da493, where "synchronous" was changed to "in parallel". All browsers implement the synchronous behavior. Fixes whatwg#4686.
I’m not sure quite to test this by the way, nor does there seem to be any existing tests for |
I think you could test at least beforeprint by calling preventDefault. Testing afterprint would require a manual test so that someone could cancel out of the print dialog. /cc @gsnedders in case he knows things about testing print dialogs. |
We should also, from https://html.spec.whatwg.org/multipage/parsing.html#the-end:print-when-loaded, queue a task to run the printing steps, instead of running them directly. Right? |
This doesn't seem to work, as printing steps don't respect
I think you are right from some light testing, though that seems to be an existing bug. In particular, the following <script>
onpageshow = () => { console.log('pageshow', document.readyState); };
onload = () => { console.log('load', document.readyState); };
onbeforeprint = (e) => { console.log('beforeprint', document.readyState); e.preventDefault(); };
print();
console.log('after print() returns');
</script> prints
in all the browsers I can test. |
Sorry, I forgot the purpose of beforeprint; you're right, it's not cancelable. So yeah, I'm happy to land this when we fix the preexisting bug, plus file an issue for adding manual tests and/or figuring out how to automate them. |
Pretty sure there's no way to test that it happens synchronously. |
Please make sure there's an issue in wpt with label This issue seems related at least web-platform-tests/wpt#5667 |
Test added in web-platform-tests/wpt#17439. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with tests in progress. Let's merge this.
Automatic update from web-platform-tests Add manual test for print() For whatwg/html#4690. -- wpt-commits: 8e53d2a89fe610b2ce480877c60bca88c949cf60 wpt-pr: 17439
Automatic update from web-platform-tests Add manual test for print() For whatwg/html#4690. -- wpt-commits: 8e53d2a89fe610b2ce480877c60bca88c949cf60 wpt-pr: 17439
Automatic update from web-platform-tests Add manual test for print() For whatwg/html#4690. -- wpt-commits: 8e53d2a89fe610b2ce480877c60bca88c949cf60 wpt-pr: 17439 UltraBlame original commit: 3c43e31a85a2a98871d88f17af5b6b9f31f32616
Automatic update from web-platform-tests Add manual test for print() For whatwg/html#4690. -- wpt-commits: 8e53d2a89fe610b2ce480877c60bca88c949cf60 wpt-pr: 17439 UltraBlame original commit: 3c43e31a85a2a98871d88f17af5b6b9f31f32616
Automatic update from web-platform-tests Add manual test for print() For whatwg/html#4690. -- wpt-commits: 8e53d2a89fe610b2ce480877c60bca88c949cf60 wpt-pr: 17439 UltraBlame original commit: 3c43e31a85a2a98871d88f17af5b6b9f31f32616
This was a slip-up in the larger clean-up commit in 61da493, where "synchronous" was changed to "in parallel". All browsers implement the synchronous behavior.
Fixes #4686.
/timers-and-user-prompts.html ( diff )