Bug 1795975 Comment 7 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[A pernosco trace from a reproduction](https://pernos.co/debug/TC8tALsh9ek0ybaqv9CUuQ/index.html#f{m[Gapr,y/w_,t[AQ,CB76_,f{e[Gapr,y8A_,s{aaaV4pTAA,bAcc,uC2A46A,oC2CKjw___,v[{wiLg,v[{f'list',q'stdouterr',p{_,xAYag_,{f'container',q'stack',p{_,xAYag_,{f'list',q'alerts',p{_,xAYag_,{f'notebook',q'notebook',p.,xAYag___,{w/eg,v[{f'source',q'source',p{_,xAYag_,{f'list',q'callees',p{_,xAYag____/) using the steps in comment 0 identifies the problem.
The `nsIAsyncShutdownClient#addBlocker()` call is failing a [recursion check](https://hg.mozilla.org/mozilla-central/annotate/ac1330b68d3e/js/src/vm/Interpreter.cpp#l384).
The recursion limit is reached due to a large number of "Printing failed while starting the print job." alerts, each starting nested event loops.

I haven't reproduced with the more recent changeset 7ea8042eaf1d0c5f78ccce2e79e3e13f73526c64, but `_displayPrintingError()` is [still using](https://searchfox.org/mozilla-central/rev/af78418c4b5f2c8721d1a06486cf4cf0b33e1e8d/toolkit/components/printing/content/printUtils.js#493) `nsIPromptService#alert()`, which uses a nested event loop.
Nested event loops are only suitable if there is some limit (preferably zero) on the number of further nested event loops that can be created.
`alert()` is therefore not suitable for the parent process because we do not want to block all other activity in the parent process.  (FWIW HTML's `alert()` [should block all other activity](https://bugzilla.mozilla.org/show_bug.cgi?id=637264).
[A pernosco trace from a reproduction](https://pernos.co/debug/TC8tALsh9ek0ybaqv9CUuQ/index.html#f{m[Gapr,y/w_,t[AQ,CB76_,f{e[Gapr,y8A_,s{aaaV4pTAA,bAcc,uC2A46A,oC2CKjw___,v[{wiLg,v[{f'list',q'stdouterr',p{_,xAYag_,{f'container',q'stack',p{_,xAYag_,{f'list',q'alerts',p{_,xAYag_,{f'notebook',q'notebook',p.,xAYag___,{w/eg,v[{f'source',q'source',p{_,xAYag_,{f'list',q'callees',p{_,xAYag____/) using the steps in comment 0 identifies the problem.
The `nsIAsyncShutdownClient#addBlocker()` call is failing a [recursion check](https://hg.mozilla.org/mozilla-central/annotate/ac1330b68d3e/js/src/vm/Interpreter.cpp#l384).
The recursion limit is reached due to a large number of "Printing failed while starting the print job." alerts, each starting a nested event loop.

I haven't reproduced with the more recent changeset 7ea8042eaf1d0c5f78ccce2e79e3e13f73526c64, but `_displayPrintingError()` is [still using](https://searchfox.org/mozilla-central/rev/af78418c4b5f2c8721d1a06486cf4cf0b33e1e8d/toolkit/components/printing/content/printUtils.js#493) `nsIPromptService#alert()`, which uses a nested event loop.
Nested event loops are only suitable if there is some limit (preferably zero) on the number of further nested event loops that can be created.
`alert()` is therefore not suitable for the parent process because we do not want to block all other activity in the parent process.  FWIW HTML's `alert()` [should block all other activity](https://bugzilla.mozilla.org/show_bug.cgi?id=637264).

Back to Bug 1795975 Comment 7