From bf54450230da3239068b1f2b253857bf9b66a988 Mon Sep 17 00:00:00 2001 From: juj Date: Wed, 8 Oct 2025 12:13:48 +0300 Subject: [PATCH] Fix macOS Firefox test run hangs (#1614) Fix macOS Firefox test run hangs by disabling macOS from prompting to restore windows after an unclean browser termination. --- emsdk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emsdk.py b/emsdk.py index 965af3a..243f4b0 100644 --- a/emsdk.py +++ b/emsdk.py @@ -1400,6 +1400,16 @@ def download_firefox(tool): } }''') + if MACOS: + # Disable a macOS feature where if the browser is terminated mid-execution, (e.g. by + # CI aborting), then the next time the browser is launched, macOS might bring up a dialog + # "The last time you opened Firefox, it unexpectedly quit while reopening windows. + # Do you want to try to reopen its windows again?" + # that will block automated CI runs. + # Disable this feature by changing the behavior of the program with macOS 'defaults'. + run(['defaults', 'write', '-app', root, 'ApplePersistenceIgnoreState', 'YES']) + run(['defaults', 'write', '-app', root, 'NSQuitAlwaysKeepsWindows', '-bool', 'false']) + save_actual_version() # If we didn't get a Firefox executable, then installation failed.