Bug 1777198 Comment 5 Edit History

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

Update: What the patch does

- Add each `ContentParent` also as blocker to phase `quitApplicationGranted`
- On `quitApplicationGranted`, just do `NotifyImpendingShutdown`, remove that blocker (and thus wait for the next shutdown phase for the real shutdown)
- The child then receives `NotifiedImpendingShutdown`, [sets an atomic flag](https://searchfox.org/mozilla-central/rev/284187d0a7130d21042beeff0af0627c8e68cacc/ipc/glue/ProcessChild.cpp#74) accessible via `ProcessChild::ExpectingShutdown()` and calls the virtual `NotifyImpendingShutdown` on its instance.
- `ContentProcess::NotifyImpendingShutdown` looks at the pref `dom.abort_script_on_child_shutdown` and in case sets an appropriate crash annotation. TODO: We want to find a way to reduce the `dom.max_script_run_time` timeout here.
- `XPCJSContext`'s `WatchdogMain` will then call `HangMonitorChild::InterruptCallback`, as before
- `HangMonitorChild::InterruptCallback` looks at the pref `dom.abort_script_on_child_shutdown` and the `ProcessChild::ExpectingShutdown()` flag and in case returns directly, signaling the JS engine to abort.
Update: What the patch does

- Add each `ContentParent` also as blocker to phase `quitApplicationGranted`
- On `quitApplicationGranted`, just do `NotifyImpendingShutdown`, remove that blocker (and thus wait for the next shutdown phase for the real shutdown)
- The child then receives `NotifiedImpendingShutdown`, [sets an atomic flag](https://searchfox.org/mozilla-central/rev/284187d0a7130d21042beeff0af0627c8e68cacc/ipc/glue/ProcessChild.cpp#74) accessible via `ProcessChild::ExpectingShutdown()` and calls the virtual `NotifyImpendingShutdown` on its instance.
- `ContentProcess::NotifyImpendingShutdown` looks at the pref `dom.abort_script_on_child_shutdown` and in case sets an appropriate crash annotation. TODO: We want to find a way to reduce the `dom.max_script_run_time` timeout here.
- `XPCJSContext`'s `WatchdogMain` will then call `HangMonitorChild::InterruptCallback`, as before
- `HangMonitorChild::InterruptCallback` looks at the pref `dom.abort_script_on_child_shutdown` and the `ProcessChild::ExpectingShutdown()` flag, checks if we are running content JS and in case returns directly, signaling the JS engine to abort.

Back to Bug 1777198 Comment 5