If there's an active XMLHttpRequest window.print() is blocked; print dialog appears only when the request is completed. This is a problem for cases when XMLHttpRequest is used for long-polling. Steps to reproduce: 1. Extract the attached archive to a PHP enabled web server 2. Visit the index.php. 3. Click the button to see the result.
Created attachment 237302 [details] reproducible test case
Thank you for the bug report. I think that this is unintentional (and a consequence of delaying a print() that's called from an inline script), yet this still looks like a correct behavior. If XHR progress events were displayed under a modal print dialog, that would cause many undesirable effects (e.g. what if event handler tried to do a window.close() while the window was being printed). And if we stopped progress events, that would cause correctness issues on websites that expect them to be handled in a timely manner.
Thanks for the quick reply. The problem is that if I want to print something using window.print() then I have to wait until active XHR is completed. So if I have a long-polling request with 10 minutes timeout then in worst case I'd have to wait 10 minutes until the print dialog appears.
This is still an issue. Chrome seems to have fixed this [1], are there any plans for Safari to do the same as well? This makes it impossible to use the print API for websites that rely on long-polling to get real time updates. [1] https://bugs.chromium.org/p/chromium/issues/detail?id=173140
<rdar://problem/35035119>