guard against DOMException when checking for a weird cookie parameter

This commit is contained in:
ansuz 2021-11-22 16:36:26 +05:30
parent 15cf523144
commit 5dbff0709f

View file

@ -153,8 +153,9 @@ define([], function () {
out.registerInner = function () { }; out.registerInner = function () { };
out.registerOuter = function () { }; out.registerOuter = function () { };
if (document.cookie.indexOf('test=') === 0) {
try { try {
if (document.cookie.indexOf('test=') === 0) {
var x = JSON.parse(decodeURIComponent(document.cookie.replace('test=', ''))); var x = JSON.parse(decodeURIComponent(document.cookie.replace('test=', '')));
if (x.test === 'auto') { if (x.test === 'auto') {
out.options = x.opts; out.options = x.opts;
@ -165,8 +166,8 @@ define([], function () {
enableManual(); enableManual();
console.log("Enable manual testing " + window.origin); console.log("Enable manual testing " + window.origin);
} }
} catch (e) { } }
} } catch (e) { }
return out; return out;
}); });