From 51e92e5a7bc783c8f54f40ed832b8c63cf9b2b16 Mon Sep 17 00:00:00 2001 From: eight Date: Tue, 12 Sep 2017 20:08:09 +0800 Subject: [PATCH] Fix: use IIFE for try-catch in tDocLoader --- js/localization.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/localization.js b/js/localization.js index 0176f949..bcce2c15 100644 --- a/js/localization.js +++ b/js/localization.js @@ -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();