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

Commit

Permalink
Wait 5 seconds before showing any error notifications
Browse files Browse the repository at this point in the history
This change eliminates the highly-visible class of bugs where an error
notification is thrown at startup.
  • Loading branch information
jaredhirsch committed Jun 9, 2017
1 parent 43977db commit 9db01b7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions addon/webextension/background/senderror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

"use strict";

const startTime = Date.now();

this.senderror = (function() {
let exports = {};

Expand Down Expand Up @@ -73,12 +75,14 @@ this.senderror = (function() {
message = error.message;
}
}
browser.notifications.create(id, {
type: "basic",
// FIXME: need iconUrl for an image, see #2239
title,
message
});
if (Date.now() - startTime > 5 * 1000) {
browser.notifications.create(id, {
type: "basic",
// FIXME: need iconUrl for an image, see #2239
title,
message
});
}
};

exports.reportError = function(e) {
Expand Down

0 comments on commit 9db01b7

Please sign in to comment.