Closed Bug 1495749 Opened 6 years ago Closed 6 years ago

Extensions.Uninstall action should clear the Install runOnce pref so that an extension can be reinstalled

Categories

(Firefox :: Enterprise Policies, defect, P3)

62 Branch
defect

Tracking

()

VERIFIED FIXED
Firefox 65
Tracking Status
firefox-esr60 64+ verified
firefox63 --- wontfix
firefox64 - verified
firefox65 --- verified

People

(Reporter: nn1436401, Assigned: Felipe, Mentored)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Build ID: 20180920131237

Steps to reproduce:

Install extension using group policy in HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox\Extensions\Install 

Open Firefox.
See the extension installed.
In about:config the key "browser.policies.runOncePerModification.extensionsInstall" is set to the path of xpi.

Remove group policy registry key.
Run Firefox.
The extension is not removed
In about:config the value of browser.policies.runOncePerModification.extensionsInstall is not reset.

Same for HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox\Extensions\Uninstall
and key in about:config "browser.policies.runOncePerModification.extensionsUninstall" .
After adding extension to Uninstall, it won't be able to be installed once again due to the value which is not reset.


Actual results:

Cannot install and uninstall extensions using group policy


Expected results:

Install and uninstall extension using group policy should work as documented.
Component: Untriaged → Enterprise Policies
The Install/Uninstall actions are a one-time action, so removing them from the registry is not meant to revert their effects (i.e., removing an extension from Install is not going to Uninstall the extension).

But what you mentioned about Uninstall not clearing the runOnce pref and thus not being able to reinstall the extension is definitely a bug, and we should fix it.
Mentor: felipc
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug
Priority: -- → P3
Summary: browser.policies.runOncePerModification.extensionsInstall is not set when Install key is not present → Extensions.Uninstall action should clear the Install runOnce pref so that an extension can be reinstalled
Is there any reason to not work like Chrome does ?
(In reply to :Felipe Gomes (needinfo me!) from comment #1)
> The Install/Uninstall actions are a one-time action, so removing them from
> the registry is not meant to revert their effects (i.e., removing an
> extension from Install is not going to Uninstall the extension).
> 
> But what you mentioned about Uninstall not clearing the runOnce pref and
> thus not being able to reinstall the extension is definitely a bug, and we
> should fix it.

Hi, please note that while removing the install registry key isn't supposed to remove the extension like you say - it too does not clear the runOnce pref, and thus you won't be able to install the extension again, even if the uninstall runOnce pref is removed.
So the clearing of the runOnce pref should be fixed for both install and uninstall registry keys.
Also note that the defect exists & should be fixed in the ESR version.
@Felipe, any updates on this defect?
Planned fix? ETA?
(In reply to :Felipe Gomes (needinfo me!) from comment #1)
> The Install/Uninstall actions are a one-time action, so removing them from
> the registry is not meant to revert their effects (i.e., removing an
> extension from Install is not going to Uninstall the extension).
> 
> But what you mentioned about Uninstall not clearing the runOnce pref and
> thus not being able to reinstall the extension is definitely a bug, and we
> should fix it.

Felipe, can you please provide any kind of update on this issue?
Assignee: nobody → felipc
Status: NEW → ASSIGNED
(In reply to :Felipe Gomes (needinfo me!) from comment #7)
> Created attachment 9023435 [details]
> Bug 1495749 - Allow add-ons to be updated via policy by uninstalling and
> reinstalling them. r=mkaply

Thanks a lot Felipe!
I'd really love for this to be fixed in the earliest ESR version possible.
I'll stay tuned to this item for updates.
Pushed by fgomes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d96cbd9059cd
Allow add-ons to be updated via policy by uninstalling and reinstalling them. r=mkaply
Backed out for browser_policy_extensions.js failures.

backout: https://hg.mozilla.org/integration/autoland/rev/b4e8f93bf4bbb14ba152d49ca3fb5538b2d599bd

push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=d96cbd9059cdba2d896e50b1eeafbdae11933d00

failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=210671422&repo=autoland&lineNumber=2488

14:45:09     INFO - TEST-PASS | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | Sanity check the temporary file doesn't exist. - true == true - 
14:45:09     INFO - Console message: [JavaScript Error: "this.mm.content is null; can't access its "devicePixelRatio" property" {file: "resource:///modules/FaviconLoader.jsm" line: 445}]
14:45:09     INFO - loadIcons@resource:///modules/FaviconLoader.jsm:445:9
14:45:09     INFO - FaviconLoader/this.iconTask<@resource:///modules/FaviconLoader.jsm:441:44
14:45:09     INFO - idleDispatch/</<@resource://gre/modules/PromiseUtils.jsm:40:21
14:45:09     INFO - 
14:45:09     INFO - Console message: 1541717108889	addons.xpi	WARN	Download of http://mochi.test:8888/browser/browser/components/enterprisepolicies/tests/browser/policytest_v0.2.xpi failed: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIZipReader.open]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource://gre/modules/addons/XPIInstall.jsm :: XPIPackage :: line 327"  data: no] Stack trace: XPIPackage()@resource://gre/modules/addons/XPIInstall.jsm:327
14:45:09     INFO - get()@resource://gre/modules/addons/XPIInstall.jsm:227
14:45:09     INFO - loadManifest()@resource://gre/modules/addons/XPIInstall.jsm:1555
14:45:09     INFO - Console message: [JavaScript Error: "uncaught exception: undefined"]
14:45:09     INFO - Buffered messages finished
14:45:09     INFO - TEST-UNEXPECTED-FAIL | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | Uncaught exception - 
14:45:09     INFO - Not taking screenshot here: see the one that was previously logged
14:45:09     INFO - TEST-UNEXPECTED-FAIL | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | A promise chain failed to handle a rejection: (Unable to convert rejection reason to string.) - stack: onDownloadFailed@chrome://mochitests/content/browser/browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js:104:11
14:45:09     INFO - callInstallListeners@resource://gre/modules/AddonManager.jsm:1450:15
14:45:09     INFO - callInstallListeners@resource://gre/modules/AddonManager.jsm:2835:12
14:45:09     INFO - _callInstallListeners@resource://gre/modules/addons/XPIInstall.jsm:1953:12
14:45:09     INFO - downloadFailed@resource://gre/modules/addons/XPIInstall.jsm:2384:5
14:45:09     INFO - onStopRequest/<@resource://gre/modules/addons/XPIInstall.jsm:2357:11
14:45:09     INFO - Rejection date: Thu Nov 08 2018 14:45:08 GMT-0800 (Pacific Standard Time) - false == true - JS frame :: resource://testing-common/PromiseTestUtils.jsm :: assertNoUncaughtRejections :: line 257
14:45:09     INFO - Stack trace:
14:45:09     INFO - resource://testing-common/PromiseTestUtils.jsm:assertNoUncaughtRejections:257
14:45:09     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest/<:1123
14:45:09     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1089
14:45:09     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:987
14:45:09     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<:803
14:45:09     INFO - Leaving test bound test_addon_reinstall
14:45:09     INFO - Entering test bound test_addon_uninstall
14:45:09     INFO - TEST-PASS | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | Sanity check the temporary file doesn't exist. - true == true - 
14:45:53     INFO - Not taking screenshot here: see the one that was previously logged
14:45:53     INFO - TEST-UNEXPECTED-FAIL | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | Test timed out - 
14:45:53     INFO - TEST-PASS | browser/components/enterprisepolicies/tests/browser/browser_policy_extensions.js | Engine is inactive at the end of the test -
Flags: needinfo?(felipc)
The problem was due to phabsend not handling the binary file added (policytest_v0.2.xpi) correctly. I'll land this manually on inbound
Flags: needinfo?(felipc)
Pushed by felipc@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4e5d78c219f5
Allow add-ons to be updated via policy by uninstalling and reinstalling them. r=mkaply
https://hg.mozilla.org/mozilla-central/rev/4e5d78c219f5
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Hi Felipe thank you very much for this fix, is there any chance it can be pushed to version 64?

Thanks!
[Tracking Requested - why for this release]:

This is an improvement for the "Extensions" enterprise policy which allows admins to use policies to update an extension
Comment on attachment 9023435 [details]
Bug 1495749 - Allow add-ons to be updated via policy by uninstalling and reinstalling them. r=mkaply

[Beta/Release Uplift Approval Request]

Feature/Bug causing the regression: Enterprise Policies

User impact if declined: There's a policy called "Extensions" which can be used to install / uninstall extensions.  This improvement allow the same extension to be (first) uninstalled and reinstalled at the same time, allowing for a version upgrade (by reinstalling a newer version)

Is this code covered by automated tests?: Yes

Has the fix been verified in Nightly?: No

Needs manual test from QE?: Yes

If yes, steps to reproduce: 

List of other uplifts needed: None

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): Simple change to the code of this specific policy, covered by tests

String changes made/needed: none

[ESR Uplift Approval Request]

If this is not a sec:{high,crit} bug, please state case for ESR consideration: Enterprise Policy improvement

User impact if declined: We have been taking useful enterprise policies patches in ESR.  User who first requested this change has an ESR deployment

Fix Landed on Version: 65, asked for 64 uplift

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): Simple change to the code of this specific policy, covered by tests

String or UUID changes made by this patch: none
Attachment #9023435 - Flags: approval-mozilla-esr60?
Attachment #9023435 - Flags: approval-mozilla-beta?
Comment on attachment 9023435 [details]
Bug 1495749 - Allow add-ons to be updated via policy by uninstalling and reinstalling them. r=mkaply

improvement for enterprise policy, has test, looks safe enough; approved for 64.0b9 or 64.0b10
Attachment #9023435 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Let's wait for QA verification before ESR uplift.
Flags: qe-verify+
I have managed to reproduce this issue using Firefox 64.0a1 (BuildId:20181002100236).

The Extensions.Uninstall action clears the Install runOnce pref and the extension is successfully reinstalled using Firefox 65.0a1 (BuildId:20181112220107) on Windows 10 64bit.

Leaving the qe-verify+ flag for beta verification.
Status: RESOLVED → VERIFIED
QA Contact: emil.ghitta
Comment on attachment 9023435 [details]
Bug 1495749 - Allow add-ons to be updated via policy by uninstalling and reinstalling them. r=mkaply

Policy change verified in nightly; let's uplift for ESR.
Attachment #9023435 - Flags: approval-mozilla-esr60? → approval-mozilla-esr60+
Needs a rebased patch for ESR60 uplift.
Flags: needinfo?(felipc)
This is verified fixed using Firefox 64.0b10 (BuildId:20181115150739) on Windows 10 64bit.
Flags: qe-verify+
Rebased patch for ESR
Flags: needinfo?(felipc)
Attachment #9026197 - Flags: review+
This is verified fixed using Firefox 60.3.1esr (provided in comment 25) on Windows 10 64bit.
(In reply to Emil Ghitta, QA [:emilghitta] from comment #26)
> This is verified fixed using Firefox 60.3.1esr (provided in comment 25) on
> Windows 10 64bit.

Is there a scheduled release date for Firefox 60.3.1esr?
This will be in 60.4.0esr which ships December 11.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: