Permalink
Browse files

Call onUpdateFinished when appropriate.

Also, don't die if the expected AddonListener method isn't defined.

Fixes #1621
  • Loading branch information...
arantius committed Sep 17, 2012
1 parent 9e05d39 commit 5f332fc07ed46431b492bfeb63c46a0ab56f6525
Showing with 11 additions and 5 deletions.
  1. +11 −5 modules/script.js
View
@@ -768,11 +768,17 @@ Script.prototype.handleRemoteUpdate = function(aAvailable, aListener) {
if (aListener) {
// When in the add-ons manager, listeners are passed around to keep
// the UI up to date.
- if (aAvailable) {
- AddonManagerPrivate.callAddonListeners("onNewInstall", scriptInstall);
- aListener.onUpdateAvailable(addon, scriptInstall);
- } else {
- aListener.onNoUpdateAvailable(addon);
+ try {
+ if (aAvailable) {
+ AddonManagerPrivate.callAddonListeners("onNewInstall", scriptInstall);
+ aListener.onUpdateAvailable(addon, scriptInstall);
+ } else {
+ aListener.onNoUpdateAvailable(addon);
+ }
+ aListener(onUpdateFinished(addon, 0));
+ } catch (e) {
+ // See #1621. Don't die if (e.g.) an addon listener doesn't provide
+ // the entire interface and thus a method is undefined.
}
} else {
// Otherwise, just install.

0 comments on commit 5f332fc

Please sign in to comment.