Bug 1814281 - Make sure the pref is written before crash in cleanup test r=smaug

Another check to ensure the pref is there, in case it's not flushed to the disk yet (which would prevent the start cleanup from happening).

This is still a speculative patch.

Differential Revision: https://phabricator.services.mozilla.com/D204702
This commit is contained in:
Kagami Sascha Rosylight 2024-03-17 13:53:36 +00:00
parent 38263473fa
commit aa13544052

View file

@ -46,6 +46,11 @@ class MovedOriginDirectoryCleanupTestCase(MarionetteTestCase):
"""
)
def read_prefs_file(self):
pref_path = Path(self.marionette.profile_path) / "prefs.js"
with open(pref_path) as f:
return f.read()
def removeAllCookies(self):
with self.marionette.using_context("chrome"):
self.marionette.execute_script(
@ -83,6 +88,12 @@ class MovedOriginDirectoryCleanupTestCase(MarionetteTestCase):
message="privacy.sanitize.pending must include offlineApps",
)
# Make sure the pref is written to the file
Wait(self.marionette).until(
lambda _: "offlineApps" in self.read_prefs_file(),
message="prefs.js must include offlineApps",
)
# Cleanup happens via Sanitizer.onStartup after restart
self.marionette.restart(in_app=False)