Closed Bug 1709978 Opened 3 years ago Closed 3 years ago

Disable app updates when running out of an app package

Categories

(Firefox :: Installer, task)

Unspecified
Windows
task

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: molly, Assigned: molly)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

If we used our built-in updater when running as a package, it's difficult to fully mitigate the risk of prompting the user to install a manual update, and doing so would likely be a serious problem (they would probably no longer be using the same profile, for one thing). It's also possible that our updater might conflict with another instance not running from a package, because the update directories are not in one of the virtualized file system locations.

So, we should disable our update system when we are an app package, and rely on the one provided by whatever mechanism deployed the package instead. Since we know at runtime whether we are in a package or not, we can detect that state and behave as if update were disabled by policy. That way, we can be certain that everything we might want to avoid really does get disabled.

We'll also want to make sure that we don't end up having a "managed by your administrator" message showing up anywhere, since we're kind of piggybacking on the policy mechanism here.

Yeah, I've been thinking about this. Can we use the mechanism in policy to disable something (app updates), but the policy isn't technically running?

I think the answer is yes, but I need to do some tests.

Just wanted to throw out an idea. You could consolidate the existing instances of isAllowed("appUpate") so they instead check UpdateService.disabledByPolicy. Then you could check HasPackageIdentity() in the implementation of UpdateService.disabledByPolicy.

That way, no policy would actually be active, which would prevent problems with unexpected policy-related messages and conflicts with other policies.

Assignee: nobody → mhowell
Status: NEW → ASSIGNED

This patch disables the update service as if it were disabled by policy
whenever a package identify is present. User interfaces are treated as if
the updater had not been included in the build, because that prevents any of
our usual update UI from being shown, and in particular ensures that we do not
generate messages about an administrator handling updates, as would normally
happen when disabling updates via policy.

The telemetry environment's update.enabled flag is deliberately left alone in
this patch, because the mere fact of using an app package does not really say
anything about whether the user intends to allow automatic updating or not.

No longer blocks: 1710908

This bug might also come into play here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1710796

Is there a better thing to check in that patch so we cover both this and the policy case?

For the updated patch I just posted, I added a case for both this case and the policy to _setCurrentTipFromAppUpdaterStatus, so that it won't select any tip to display. I like that marginally better because it only uses the status value that's being returned by AppUpdater.jsm instead of trying to determine anything for itself (but that's a very fine distinction), and also that one change happens to not depend on any other Tikka work because I've had the existing NO_UPDATER status get returned in the packaged app case.

I'm just making a note to myself here: this will disable the background update mechanism, because:

Group: partner-confidential
Group: mozilla-employee-confidential
See Also: → 1720530
Pushed by mhowell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cec939837018 Disable app update when running as a packaged app. r=agashlin,preferences-reviewers

Backed for causing failures on app update.

backout: https://hg.mozilla.org/integration/autoland/rev/4ea396abdadeae570a22cf638c6ec952a57848d9

push: https://treeherder.mozilla.org/jobs?repo=autoland&revision=cec939837018bef2bf91fca78ea0bec26d18cc46&group_state=expanded

failure log example: https://treeherder.mozilla.org/logviewer?job_id=345217080&repo=autoland&lineNumber=4472

[task 2021-07-14T19:14:00.336Z] 19:14:00     INFO - TEST-PASS | toolkit/components/normandy/test/browser/browser_about_preferences.js | Clicking the view studies link opens about:studies in a new tab. - 
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - Console message: [JavaScript Error: "[Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIXPCComponents_Utils.readUTF8URI]"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame :: resource://gre/modules/L10nRegistry.jsm :: L10nRegistry.loadSync :: line 692"  data: no]"]
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - L10nRegistry.loadSync@resource://gre/modules/L10nRegistry.jsm:692:19
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - fetchFile@resource://gre/modules/L10nRegistry.jsm:607:31
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - generateResourceSetSync/<@resource://gre/modules/L10nRegistry.jsm:512:19
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - generateResourceSetSync@resource://gre/modules/L10nRegistry.jsm:507:22
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - generateResourceSetsForLocaleSync@resource://gre/modules/L10nRegistry.jsm:449:44
[task 2021-07-14T19:14:00.339Z] 19:14:00     INFO - generateBundlesSync@resource://gre/modules/L10nRegistry.jsm:186:7
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - touchNext@resource://gre/modules/Localization.jsm:167:37
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - generateBundles@resource://gre/modules/Localization.jsm:473:15
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - getLanguageDisplayNames@resource://gre/modules/mozIntl.jsm:788:19
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - getLocaleDisplayNames/<@resource://gre/modules/mozIntl.jsm:866:14
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - getLocaleDisplayNames@resource://gre/modules/mozIntl.jsm:845:24
[task 2021-07-14T19:14:00.340Z] 19:14:00     INFO - displayUseSystemLocale@chrome://browser/content/preferences/main.js:1427:43
[task 2021-07-14T19:14:00.341Z] 19:14:00     INFO - init@chrome://browser/content/preferences/main.js:370:10
[task 2021-07-14T19:14:00.341Z] 19:14:00     INFO - init@chrome://browser/content/preferences/preferences.js:105:22
[task 2021-07-14T19:14:00.341Z] 19:14:00     INFO - 
[task 2021-07-14T19:14:00.347Z] 19:14:00     INFO - Console message: [JavaScript Error: "[Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIXPCComponents_Utils.readUTF8URI]"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame :: resource://gre/modules/L10nRegistry.jsm :: L10nRegistry.loadSync :: line 692"  data: no]"]
[task 2021-07-14T19:14:00.347Z] 19:14:00     INFO - L10nRegistry.loadSync@resource://gre/modules/L10nRegistry.jsm:692:19
[task 2021-07-14T19:14:00.347Z] 19:14:00     INFO - fetchFile@resource://gre/modules/L10nRegistry.jsm:607:31
[task 2021-07-14T19:14:00.348Z] 19:14:00     INFO - generateResourceSetSync/<@resource://gre/modules/L10nRegistry.jsm:512:19
[task 2021-07-14T19:14:00.348Z] 19:14:00     INFO - generateResourceSetSync@resource://gre/modules/L10nRegistry.jsm:507:22
[task 2021-07-14T19:14:00.349Z] 19:14:00     INFO - generateResourceSetsForLocaleSync@resource://gre/modules/L10nRegistry.jsm:449:44
[task 2021-07-14T19:14:00.349Z] 19:14:00     INFO - generateBundlesSync@resource://gre/modules/L10nRegistry.jsm:186:7
[task 2021-07-14T19:14:00.349Z] 19:14:00     INFO - touchNext@resource://gre/modules/Localization.jsm:167:37
[task 2021-07-14T19:14:00.350Z] 19:14:00     INFO - generateBundles@resource://gre/modules/Localization.jsm:473:15
[task 2021-07-14T19:14:00.351Z] 19:14:00     INFO - getRegionDisplayNames@resource://gre/modules/mozIntl.jsm:815:19
[task 2021-07-14T19:14:00.351Z] 19:14:00     INFO - getLocaleDisplayNames/<@resource://gre/modules/mozIntl.jsm:875:16
[task 2021-07-14T19:14:00.352Z] 19:14:00     INFO - getLocaleDisplayNames@resource://gre/modules/mozIntl.jsm:845:24
[task 2021-07-14T19:14:00.352Z] 19:14:00     INFO - displayUseSystemLocale@chrome://browser/content/preferences/main.js:1427:43
[task 2021-07-14T19:14:00.353Z] 19:14:00     INFO - init@chrome://browser/content/preferences/main.js:370:10
[task 2021-07-14T19:14:00.353Z] 19:14:00     INFO - init@chrome://browser/content/preferences/preferences.js:105:22
[task 2021-07-14T19:14:00.354Z] 19:14:00     INFO - 
[task 2021-07-14T19:14:00.355Z] 19:14:00     INFO - Buffered messages finished
[task 2021-07-14T19:14:00.355Z] 19:14:00     INFO - TEST-UNEXPECTED-FAIL | toolkit/components/normandy/test/browser/browser_about_preferences.js | A promise chain failed to handle a rejection: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPropertyBag2.getProperty] - stack: get updateDisabledByPackage@resource:///modules/AppUpdater.jsm:190:29
[task 2021-07-14T19:14:00.356Z] 19:14:00     INFO - check@resource:///modules/AppUpdater.jsm:63:9
[task 2021-07-14T19:14:00.356Z] 19:14:00     INFO - appUpdater@chrome://browser/content/aboutDialog-appUpdater.js:53:20
[task 2021-07-14T19:14:00.356Z] 19:14:00     INFO - init@chrome://browser/content/preferences/main.js:661:21
[task 2021-07-14T19:14:00.357Z] 19:14:00     INFO - init@chrome://browser/content/preferences/preferences.js:105:22
[task 2021-07-14T19:14:00.357Z] 19:14:00     INFO - Rejection date: Wed Jul 14 2021 19:13:59 GMT+0000 (Coordinated Universal Time) - false == true - JS frame :: resource://testing-common/PromiseTestUtils.jsm :: assertNoUncaughtRejections :: line 285
[task 2021-07-14T19:14:00.357Z] 19:14:00     INFO - Stack trace:
[task 2021-07-14T19:14:00.357Z] 19:14:00     INFO - resource://testing-common/PromiseTestUtils.jsm:assertNoUncaughtRejections:285
[task 2021-07-14T19:14:00.357Z] 19:14:00     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest/<:1112
[task 2021-07-14T19:14:00.358Z] 19:14:00     INFO - Leaving test bound testViewStudiesLink
[task 2021-07-14T19:14:00.358Z] 19:14:00     INFO - GECKO(2753) | JavaScript error: resource:///modules/AppUpdater.jsm, line 190: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPropertyBag2.getProperty]
[task 2021-07-14T19:14:00.358Z] 19:14:00     INFO - Console message: [JavaScript Error: "AbortError: Actor 'ShieldFrame' destroyed before query 'Shield:GetMessagingSystemList' was resolved"]
[task 2021-07-14T19:14:00.359Z] 19:14:00     INFO - Console message: [JavaScript Error: "AbortError: Actor 'ShieldFrame' destroyed before query 'Shield:GetPreferenceStudyList' was resolved"]
[task 2021-07-14T19:14:00.359Z] 19:14:00     INFO - Console message: [JavaScript Error: "AbortError: Actor 'ShieldFrame' destroyed before query 'Shield:GetStudiesEnabled' was resolved"]
[task 2021-07-14T19:14:00.359Z] 19:14:00     INFO - Console message: [JavaScript Error: "AbortError: Actor 'ShieldFrame' destroyed before query 'Shield:GetAddonStudyList' was resolved"]
[task 2021-07-14T19:14:00.360Z] 19:14:00     INFO - Console message: [JavaScript Error: "NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPropertyBag2.getProperty]" {file: "resource:///modules/AppUpdater.jsm" line: 190}]
[task 2021-07-14T19:14:00.360Z] 19:14:00     INFO - GECKO(2753) | MEMORY STAT | vsize 130551149MB | residentFast 1909MB
[task 2021-07-14T19:14:00.360Z] 19:14:00     INFO - TEST-OK | toolkit/components/normandy/test/browser/browser_about_preferences.js | took 30806ms
Flags: needinfo?(mhowell)

The problem appears to be that I didn't realize nsIPropertyBag in JS throws if you get a property that isn't set; I thought it would return undefined. I'll update this patch to account for that.

Flags: needinfo?(mhowell)
Pushed by mhowell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bc99bac283b1 Disable app update when running as a packaged app. r=agashlin,preferences-reviewers
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
See Also: → 1720830
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: