diff --git a/background/storage.js b/background/storage.js index aca6e466..69438d85 100644 --- a/background/storage.js +++ b/background/storage.js @@ -1,4 +1,4 @@ -/* global LZStringUnsafe */ +/* global LZString */ 'use strict'; const RX_NAMESPACE = new RegExp([/[\s\r\n]*/, @@ -29,6 +29,8 @@ var cachedStyles = { }, }; +window.LZString = window.LZString || window.LZStringUnsafe; + // eslint-disable-next-line no-var var [chromeLocal, chromeSync] = [ chrome.storage.local, @@ -63,13 +65,13 @@ var [chromeLocal, chromeSync] = [ return wrapper.get(keys).then((data = {}) => { for (const key of keys) { const value = data[key]; - data[key] = value && tryJSONparse(LZStringUnsafe.decompressFromUTF16(value)); + data[key] = value && tryJSONparse(LZString.decompressFromUTF16(value)); } return data; }); }, setLZValue(key, value) { - return wrapper.set({[key]: LZStringUnsafe.compressToUTF16(JSON.stringify(value))}); + return wrapper.set({[key]: LZString.compressToUTF16(JSON.stringify(value))}); } }; return wrapper;