Added unhandled error handler to display any uncaught errors to the user.
This commit is contained in:
parent
27e6890d04
commit
bf254f1d03
|
@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or
|
||||||
# Download
|
# Download
|
||||||
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
|
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
|
||||||
|
|
||||||
# Version: 0.2.3.6
|
# Version: 0.2.3.7
|
||||||
* Updated in place tab loading logic
|
* Added unhandled error handler to display any uncaught errors to the user.
|
||||||
|
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Easy Session Manager",
|
"name": "Easy Session Manager",
|
||||||
"version": "0.2.3.6",
|
"version": "0.2.3.7",
|
||||||
"description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
|
"description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
|
||||||
|
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
getSavedSessionIDs();
|
window.onload = (eve) => {
|
||||||
|
console.log("Loaded...");
|
||||||
|
getSavedSessionIDs();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(msg, url, line, col, error) {
|
||||||
|
// Note that col & error are new to the HTML 5 spec and may not be supported in every browser.
|
||||||
|
let suppressErrorAlert = false;
|
||||||
|
let extra = !col ? '' : '\ncolumn: ' + col;
|
||||||
|
extra += !error ? '' : '\nerror: ' + error;
|
||||||
|
const data = `Error: ${msg} \nurl: ${url} \nline: ${line} ${extra}`
|
||||||
|
|
||||||
|
messageWindow("danger", data, "", -1);
|
||||||
|
|
||||||
|
// If you return true, then error alerts (like in older versions of Internet Explorer) will be suppressed.
|
||||||
|
return suppressErrorAlert;
|
||||||
|
};
|
||||||
|
|
||||||
document.addEventListener("click", (e) => {
|
document.addEventListener("click", (e) => {
|
||||||
if (e.button == 0) { // Left click
|
if (e.button == 0) { // Left click
|
||||||
|
|
|
@ -254,8 +254,7 @@ const loadSession = (json = null, replaceTabs = false) => {
|
||||||
url: store[i].link,
|
url: store[i].link,
|
||||||
index: i + 1
|
index: i + 1
|
||||||
}
|
}
|
||||||
: { };
|
: { };
|
||||||
|
|
||||||
|
|
||||||
tabsApi.create(createOption).catch( async (e) => {
|
tabsApi.create(createOption).catch( async (e) => {
|
||||||
createOption.url = returnReplaceURL(
|
createOption.url = returnReplaceURL(
|
||||||
|
@ -264,7 +263,7 @@ const loadSession = (json = null, replaceTabs = false) => {
|
||||||
store[i].link,
|
store[i].link,
|
||||||
"../images/icons/error.png"
|
"../images/icons/error.png"
|
||||||
);
|
);
|
||||||
|
|
||||||
await tabsApi.create(createOption);
|
await tabsApi.create(createOption);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
let selectedItem = null;
|
let selectedItem = null;
|
||||||
|
|
||||||
|
|
||||||
const messageWindow = (type = "warning", message = "No message passed in...", target = "") => {
|
const messageWindow = (type = "warning", message = "No message passed in...", target = "", timeout = 3200) => {
|
||||||
let pTag = document.createElement("P");
|
let pTag = document.createElement("P");
|
||||||
let text = document.createTextNode(message);
|
let text = document.createTextNode(message);
|
||||||
let gutter = document.getElementById("message-gutter");
|
let gutter = document.getElementById("message-gutter");
|
||||||
|
@ -14,9 +14,11 @@ const messageWindow = (type = "warning", message = "No message passed in...", ta
|
||||||
pTag.appendChild(text);
|
pTag.appendChild(text);
|
||||||
gutter.prepend(pTag);
|
gutter.prepend(pTag);
|
||||||
|
|
||||||
|
timeout = (timeout === -1) ? 6200 : (timeout > 0) ? timeout : 3200;
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clearChildNodes(gutter);
|
clearChildNodes(gutter);
|
||||||
}, 3200);
|
}, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue