Unmute errors-to-exc errors, fix one, mend UI

This commit is contained in:
Ilya Ig. Petrov 2017-06-03 19:54:40 +05:00
parent a3c571cb22
commit 766529d8b9
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,7 @@
'use strict';
{
const chromified = window.utils.chromified;
const lastErrors = [];
const lastErrorsLength = 20;
@ -10,7 +11,7 @@
get: () => lastErrors,
}
chrome.webRequest.onErrorOccurred.addListener((details) => {
chrome.webRequest.onErrorOccurred.addListener(chromified((err/*Ignored*/, details) => {
if (!that.ifCollecting || [
'net::ERR_BLOCKED_BY_CLIENT',
@ -25,11 +26,11 @@
}
lastErrors.unshift(details);
if (lastErrors.length > lastErrorsLenght) {
if (lastErrors.length > lastErrorsLength) {
lastErrors.pop();
}
},
}),
{urls: ['<all_urls>']}
);

View File

@ -41,6 +41,7 @@
</head>
<body>
<h3>Список последних ошибок</h3>
Новые сверху, количество ошибок ограничено 20тью.
<table>
<thead>
<tr>

View File

@ -13,6 +13,10 @@ chrome.runtime.getBackgroundPage( (bgWindow) =>
const exc = bgWindow.apis.pacKitchen.getPacMods().exceptions || {};
tbody.innerHTML = '';
if (!errors.length) {
tbody.innerHTML = '<tr><td colspan="4">Ошибок пока не было.</td></tr>';
return;
}
errors.forEach((err, index) => {
const ifProxy = exc[err.hostname];