Closed Bug 599509 Opened 12 years ago Closed 12 years ago

Canceling add-on install from a listener triggers an exception

Categories

(Toolkit :: Add-ons Manager, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla2.0b7
Tracking Status
blocking2.0 --- -

People

(Reporter: Mardak, Assigned: mossop)

References

Details

Attachments

(1 file)

Error: [Exception... "'Error: Cannot start installing from this state' when calling method: [mozIStorageStatementCallback::handleCompletion]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "<unknown>"  data: no]

sample code:

AddonManager.getInstallForURL(url, function(addon) {
  addon.addListener({
    onDownloadEnded: function() {
      addon.cancel();
    }
  });
  addon.install();
}, "application/x-xpiinstall");

If I return false from onDownloadEnded, there's no exception.
We should be checking that self.state is still STATE_DOWNLOADED before proceeding with the install in here: http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/XPIProvider.jsm#4786.

I don't think this blocks as there is an easy solution, but I'd review and approve a patch with a test.
blocking2.0: --- → -
Blocks: 600034
Blocks: 593535
Attached patch patch rev 1Splinter Review
A little extra protection to stop us ending up in odd states, just check that we're still in the state we expect to be in after calling out to listeners that can change the state.
Assignee: nobody → dtownsend
Status: NEW → ASSIGNED
Attachment #479839 - Flags: review?(robert.bugzilla)
Whiteboard: [has patch][needs review rs]
Attachment #479839 - Flags: review?(robert.bugzilla) → review+
Whiteboard: [has patch][needs review rs] → [has patch]
Landed: http://hg.mozilla.org/mozilla-central/rev/35dc1d30acf6
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Flags: in-litmus-
Resolution: --- → FIXED
Whiteboard: [has patch]
Target Milestone: --- → mozilla2.0b8
Kinda hard to test this manually. I will have to trust the automated test. No regressions filed so far. Means I assume its fixed now.
Status: RESOLVED → VERIFIED
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.