Closed
Bug 326895
Opened 20 years ago
Closed 20 years ago
Extension isn't uninstalled cleanly when its folder is in use ( safeInstallOperation failure )
Categories
(Toolkit :: Add-ons Manager, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.8.1alpha1
People
(Reporter: ancestor.ak, Assigned: mossop)
Details
(Keywords: fixed1.8.0.4, fixed1.8.1)
Attachments
(1 file, 1 obsolete file)
|
2.29 KB,
patch
|
mossop
:
review+
bugs
:
approval-branch-1.8.1+
jay
:
approval1.8.0.4+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060211 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060211 Firefox/1.5
When the extension folder is in use, the files get deleted but the folder does not and a phantom extension is left in the EM. Trying to bring up Options of the phantom extension freezes Firefox. The extension disappears after the folder is no longer in use.
Same happens with themes.
Reproducible: Always
Steps to Reproduce:
1. Make the extension folder in use e.g. open it in Total Commander (Windows Explorer won't do).
2. Uninstall the extension and restart Firefox.
3. The files are deleted but the folder remains. There's a phantom extension in the EM.
4. Try to bring up Options of the extension - this freezes Firefox.
5. After the folder is no longer in use, the extension gets cleaned up on the next restart.
Maybe we shouldn't uninstall anything until the folder is deletable. Leaving user with a permanent message that the extension will be uninstalled on the next restart which doesn't happen isn't perfect but it's definitely better. Normal users don't mess with folders in profile anyway, so the exposure is very low unless there are other variations of this bug.
Comment 1•20 years ago
|
||
This is caused by the code for putting back the files on removal failure not working properly in all situations.
Updated•20 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Extension isn't uninstalled cleanly when its folder is in use. → Extension isn't uninstalled cleanly when its folder is in use ( safeInstallOperation failure )
| Assignee | ||
Updated•20 years ago
|
Assignee: nobody → mossop
| Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•20 years ago
|
||
This patch makes three main changes:
Firstly rollbackMove is changed to remove files from the movedFiles array as each is rolled back. This is not really necessary for the rest of this patch or for any other situation I can think of, but I think it makes the system a bit cleaner.
Secondly moveDirectory previously absorbed any exceptions thrown from moveFile. That meant that if moveFile failed, the uninstallation would continue and try to remove the remaining files from the item location.
Thirdly, moveDirectory was basically broken because it did not QI the directoryEntries to a nsIDirectoryEnumerator, then attempted to use it as one, so no files were ever moved away and when any extension removal/upgrade failed, rollback didnt have anything to rollback.
Attachment #214096 -
Flags: review?(robert.bugzilla)
Comment 3•20 years ago
|
||
Comment on attachment 214096 [details] [diff] [review]
Fix rollback
Dave, thanks for taking care of this.
> function rollbackMove()
> {
>- for (var i = 0; i < movedFiles.length; ++i) {
>- var oldFile = movedFiles[i].oldFile;
>- var newFile = movedFiles[i].newFile;
>+ while (movedFiles.length > 0) {
>+ var movedFile = movedFiles.pop();
>+ var oldFile = movedFile.oldFile;
>+ var newFile = movedFile.newFile;
> try {
> newFile.moveTo(oldFile.parent, newFile.leafName);
> }
> catch (e) {
>+ movedFiles.push(movedFile);
Since this throws at this point what is the value of adding back the file it failed to move? I'm not entirely sure there isn't an edgecase where the last file in the array being rolled back won't fail and with the old way going from first to last it would at least put back all the files before failing entirely - that is if it had been working in the first place. :/
Since this change isn't needed I feel safer leaving it the way it was.
>+ while (true) {
>+ var entry = entries.nextFile;
>+ if (!entry)
>+ break;
>+ if (entry.isDirectory())
>+ moveDirectory(sourceDir, targetDir, entry);
>+ else {
>+ if (entry instanceof nsILocalFile) {
nit: this should be changed to an else if
With those two items fixed r=me and thanks again!
Attachment #214096 -
Flags: review?(robert.bugzilla) → review+
| Assignee | ||
Comment 4•20 years ago
|
||
(In reply to comment #3)
> Since this change isn't needed I feel safer leaving it the way it was.
That's fair enough.
> With those two items fixed r=me and thanks again!
Cheers :)
| Assignee | ||
Comment 5•20 years ago
|
||
Addressed comments, carried over review.
Attachment #214096 -
Attachment is obsolete: true
Attachment #214290 -
Flags: review+
Comment 6•20 years ago
|
||
Checked in on trunk
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Target Milestone: --- → Firefox 2 alpha1
Comment 7•20 years ago
|
||
Comment on attachment 214290 [details] [diff] [review]
Final patch
a=ben@mozilla.org for the 1.8.1 branch
Attachment #214290 -
Flags: approval-branch-1.8.1+
Updated•20 years ago
|
Attachment #214290 -
Flags: approval1.8.0.3?
Comment 9•20 years ago
|
||
Comment on attachment 214290 [details] [diff] [review]
Final patch
Please check in promptly on the 1.8.0 branch. Thanks!
Attachment #214290 -
Flags: approval1.8.0.3? → approval1.8.0.3+
Comment 10•20 years ago
|
||
Checked in to MOZILLA_1_8_0_BRANCH
Checking in mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in;
/cvsroot/mozilla/toolkit/mozapps/extensions/src/nsExtensionManager.js.in,v <-- nsExtensionManager.js.in
new revision: 1.144.2.16.2.6; previous revision: 1.144.2.16.2.5
Keywords: fixed1.8.0.3
Updated•18 years ago
|
Product: Firefox → Toolkit
You need to log in
before you can comment on or make changes to this bug.
Description
•