Fix: use IIFE for try-catch in tDocLoader

This commit is contained in:
eight 2017-09-12 20:08:09 +08:00
parent 7c1b140de9
commit 51e92e5a7b

View File

@ -103,11 +103,11 @@ function tNodeList(nodes) {
function tDocLoader() {
t.DOMParser = new DOMParser();
try {
t.cache = JSON.parse(localStorage.L10N);
} catch (err) {
t.cache = {};
}
t.cache = (function () {
try {
return JSON.parse(localStorage.L10N);
} catch (e) {}
})() || {};
// reset L10N cache on UI language change
const UIlang = chrome.i18n.getUILanguage();