Closed Bug 570200 Opened 14 years ago Closed 14 years ago

Errors aren't passed sanely from getInstallForFile

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla2.0b1

People

(Reporter: mossop, Assigned: mossop)

References

Details

(Whiteboard: [AddonsRewrite])

Attachments

(1 file, 2 obsolete files)

Currently if getInstallForFile encounters an error it throws an exception rather than calling the callback. This kind of doesn't make sense I think and it would be better to instead pass the callback the AddonInstall instance in the DOWNLOAD_FAILED state, exactly matching what you'd get from onDownloadFailed for the same XPI if you used getInstallForURL.

As part of this I'm also going to fix bug 553023 by exposing the error since it will not be exposed any other way for this case and I'm also going to make the error parameter on onInstallFailed a simple error code rather than an exception which you can't compare to anything.
Whiteboard: [AddonsRewrite]
Blocks: 569194
Attached patch patch rev 1 (obsolete) — Splinter Review
Adds error handling and tests a bunch of cases. This fixes bug 553023, bug 562303, bug 567173 and bug 569194.
Attachment #449364 - Flags: review?(robert.bugzilla)
Attached patch patch rev 2 (obsolete) — Splinter Review
Updated from our discussion yesterday. I don't think it makes sense to call onNewInstall for AddonInstalls with errors so the only events that get installs in an error state are onDownloadFailed and onInstallFailed. It is perhaps a little redundant that we pass the error code as an argument to those while it is already available on the install object itself but I think for those states that code is more important so it makes some sense to include it. The alternative is removing it which would cause a certain amount of churn, probably doable at this stage but I'd still rather avoid it.
Attachment #449364 - Attachment is obsolete: true
Attachment #450163 - Flags: review?(robert.bugzilla)
Attachment #449364 - Flags: review?(robert.bugzilla)
Comment on attachment 450163 [details] [diff] [review]
patch rev 2

I would prefer consistency between them but understand wanting to avoid churn. How about a followup bug to make them consistent at some point?
Attachment #450163 - Flags: review?(robert.bugzilla) → review+
(In reply to comment #3)
> (From update of attachment 450163 [details] [diff] [review])
> I would prefer consistency between them but understand wanting to avoid churn.
> How about a followup bug to make them consistent at some point?

If you think it is necessary to do at some point then we should just do it now to avoid changing the API on people later. I'll update the patch to do that.
Attached patch patch rev 3Splinter Review
Updated to remove those arguments.
Attachment #450163 - Attachment is obsolete: true
Attachment #450419 - Flags: review?(robert.bugzilla)
Comment on attachment 450419 [details] [diff] [review]
patch rev 3

Looks great
Attachment #450419 - Flags: review?(robert.bugzilla) → review+
Landed: http://hg.mozilla.org/mozilla-central/rev/0d404b63f71b
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Flags: in-litmus-
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
Target Milestone: mozilla1.9.3a5 → mozilla1.9.3
Marking as verified fixed based on check-in and a green tinderbox in our area.
Status: RESOLVED → VERIFIED
Target Milestone: mozilla1.9.3 → mozilla1.9.3a6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: