Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2690, don't cancel the shot process when the upload fails
Browse files Browse the repository at this point in the history
Catch the particular request and connection errors that should not result in closing the selection, and do not tear down the selector in that case
  • Loading branch information
ianb authored and dannycoates committed Apr 26, 2017
1 parent 481d149 commit 88aae2d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion addon/webextension/selector/shooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ this.shooter = (function() { // eslint-disable-line no-unused-vars
// we use a timeout so in the case of a failure the button will
// still start working again
const uicontrol = global.uicontrol;
let deactivateAfterFinish = true;
if (isSaving) {
return;
}
Expand Down Expand Up @@ -109,11 +110,21 @@ this.shooter = (function() { // eslint-disable-line no-unused-vars
const copied = clipboard.copy(url);
return callBackground("openShot", { url, copied });
}, (error) => {
if ('popupMessage' in error && (error.popupMessage = "REQUEST_ERROR" || error.popupMessage == 'CONNECTION_ERROR')) {
// The error has been signaled to the user, but unlike other errors (or
// success) we should not abort the selection
deactivateAfterFinish = false;
return;
}
if (error.name != "BackgroundError") {
// BackgroundError errors are reported in the Background page
throw error;
}
}).then(() => uicontrol.deactivate()));
}).then(() => {
if (deactivateAfterFinish) {
uicontrol.deactivate();
}
}));
};

exports.downloadShot = function(selectedPos) {
Expand Down

0 comments on commit 88aae2d

Please sign in to comment.