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

Commit

Permalink
Add a quiet parameter to watchFunction to match watchPromise (#2795)
Browse files Browse the repository at this point in the history
Quiet the watchFunction calls in tabs.onUpdated and tabs.onActivated, that should never pop up a message
  • Loading branch information
ianb authored and jaredhirsch committed May 2, 2017
1 parent 126fc0e commit 1add819
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ this.main = (function() {
disableButton(tabId);
}
}), true);
}));
}, true));

communication.register("sendEvent", (sender, ...args) => {
catcher.watchPromise(sendEvent(...args));
Expand Down
6 changes: 4 additions & 2 deletions addon/webextension/catcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ this.catcher = (function() {
}

/** Wrap the function, and if it raises any exceptions then call unhandled() */
exports.watchFunction = function watchFunction(func) {
exports.watchFunction = function watchFunction(func, quiet) {
return function() {
try {
return func.apply(this, arguments);
} catch (e) {
exports.unhandled(e);
if (!quiet) {
exports.unhandled(e);
}
throw e;
}
};
Expand Down

0 comments on commit 1add819

Please sign in to comment.