зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1875502) for causing bc failures @ browser_suppressTips.js CLOSED TREE
Backed out changeset 80a009c6aacd (bug 1875502) Backed out changeset 6a5f4e6e4368 (bug 1875502)
This commit is contained in:
Родитель
0656e54e74
Коммит
6031937db5
|
@ -270,6 +270,17 @@ const DEFAULT_SOCKET_RETRYTIMEOUT = 2000;
|
|||
// giving up.
|
||||
const DEFAULT_CANCELATIONS_OSX_MAX = 3;
|
||||
|
||||
// This maps app IDs to their respective notification topic which signals when
|
||||
// the application's user interface has been displayed.
|
||||
const APPID_TO_TOPIC = {
|
||||
// Firefox
|
||||
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "sessionstore-windows-restored",
|
||||
// SeaMonkey
|
||||
"{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": "sessionstore-windows-restored",
|
||||
// Thunderbird
|
||||
"{3550f703-e582-4d05-9a08-453d09bdfdc6}": "mail-startup-done",
|
||||
};
|
||||
|
||||
// The interval for the update xml write deferred task.
|
||||
const XML_SAVER_INTERVAL_MS = 200;
|
||||
|
||||
|
@ -2698,6 +2709,38 @@ UpdateService.prototype = {
|
|||
observe: async function AUS_observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "post-update-processing":
|
||||
// This pref was not cleared out of profiles after it stopped being used
|
||||
// (Bug 1420514), so clear it out on the next update to avoid confusion
|
||||
// regarding its use.
|
||||
Services.prefs.clearUserPref("app.update.enabled");
|
||||
Services.prefs.clearUserPref("app.update.BITS.inTrialGroup");
|
||||
|
||||
// Background tasks do not notify any delayed startup notifications.
|
||||
if (
|
||||
!lazy.gIsBackgroundTaskMode &&
|
||||
Services.appinfo.ID in APPID_TO_TOPIC
|
||||
) {
|
||||
// Delay post-update processing to ensure that possible update
|
||||
// dialogs are shown in front of the app window, if possible.
|
||||
// See bug 311614.
|
||||
Services.obs.addObserver(this, APPID_TO_TOPIC[Services.appinfo.ID]);
|
||||
break;
|
||||
}
|
||||
// intentional fallthrough
|
||||
case "sessionstore-windows-restored":
|
||||
case "mail-startup-done":
|
||||
// Background tasks do not notify any delayed startup notifications.
|
||||
if (
|
||||
!lazy.gIsBackgroundTaskMode &&
|
||||
Services.appinfo.ID in APPID_TO_TOPIC
|
||||
) {
|
||||
Services.obs.removeObserver(
|
||||
this,
|
||||
APPID_TO_TOPIC[Services.appinfo.ID]
|
||||
);
|
||||
}
|
||||
// intentional fallthrough
|
||||
case "test-post-update-processing":
|
||||
// Clean up any extant updates
|
||||
await this._postUpdateProcessing();
|
||||
break;
|
||||
|
|
|
@ -177,7 +177,7 @@ function waitForEvent(topic, status = null) {
|
|||
|
||||
/* Triggers post-update processing */
|
||||
function testPostUpdateProcessing() {
|
||||
gAUS.observe(null, "post-update-processing", "");
|
||||
gAUS.observe(null, "test-post-update-processing", "");
|
||||
}
|
||||
|
||||
/* Initializes the update service stub */
|
||||
|
|
|
@ -137,6 +137,9 @@ class TestNoWindowUpdateRestart(MarionetteTestCase):
|
|||
)
|
||||
self.assertTrue(quit_flags_correct)
|
||||
|
||||
# Normally, the update status file would have been removed at this point by Post Update
|
||||
# Processing. But restarting resets app.update.disabledForTesting, which causes that to be
|
||||
# skipped, allowing us to look at the update status file directly.
|
||||
update_status_path = self.marionette.execute_script(
|
||||
"""
|
||||
let statusFile = FileUtils.getDir("UpdRootD", ["updates", "0"]);
|
||||
|
@ -144,39 +147,14 @@ class TestNoWindowUpdateRestart(MarionetteTestCase):
|
|||
return statusFile.path;
|
||||
"""
|
||||
)
|
||||
try:
|
||||
with open(update_status_path, "r") as f:
|
||||
# If Firefox was built with "--enable-unverified-updates" (or presumably if we
|
||||
# tested with an actual, signed update), the update should succeed. Otherwise, it
|
||||
# will fail with CERT_VERIFY_ERROR (error code 19). Unfortunately, there is no good
|
||||
# way to tell which of those situations we are in. Luckily, it doesn't matter,
|
||||
# because we aren't trying to test whether the update applied successfully, just
|
||||
# whether the "No Window Update Restart" feature works.
|
||||
self.assertIn(f.read().strip(), ["succeeded", "failed: 19"])
|
||||
except FileNotFoundError:
|
||||
# Unfortunately the last test we want to do here involves some race conditions. We want
|
||||
# to ensure that when we restarted, we tried to apply the update. In theory, when we
|
||||
# restarted, `app.update.disabledForTesting` was reset, preventing post update
|
||||
# processing from running. But, in practice, `app.update.disabledForTesting` isn't set
|
||||
# before launch, it is set early during startup. Since post update processing also
|
||||
# happens sometime early during startup, it isn't well defined whether or not post
|
||||
# update processing will have run.
|
||||
# To resolve this, if the update status file appears to be missing, we'll try getting
|
||||
# the information out of the update history.
|
||||
update_status = self.marionette.execute_script(
|
||||
"""
|
||||
let UM =
|
||||
Cc["@mozilla.org/updates/update-manager;1"].getService(Ci.nsIUpdateManager);
|
||||
if (UM.getUpdateCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
return UM.getUpdateAt(0).state;
|
||||
"""
|
||||
)
|
||||
# Like above, whether we succeeded or failed isn't really important, only whether we
|
||||
# got far enough through to succeed or fail (i.e. "pending" would be a test failure
|
||||
# here).
|
||||
self.assertIn(update_status, ["succeeded", "failed"])
|
||||
with open(update_status_path, "r") as f:
|
||||
# If Firefox was built with "--enable-unverified-updates" (or presumably if we tested
|
||||
# with an actual, signed update), the update should succeed. Otherwise, it will fail
|
||||
# with CERT_VERIFY_ERROR (error code 19). Unfortunately, there is no good way to tell
|
||||
# which of those situations we are in. Luckily, it doesn't matter, because we aren't
|
||||
# trying to test whether the update applied successfully, just whether the
|
||||
# "No Window Update Restart" feature works.
|
||||
self.assertIn(f.read().strip(), ["succeeded", "failed: 19"])
|
||||
|
||||
def resetUpdate(self):
|
||||
self.marionette.execute_script(
|
||||
|
|
Загрузка…
Ссылка в новой задаче