From 883eba7049bb0776bcccc656c58a0e8eba1fa4de Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 15 Nov 2017 21:49:41 -0800 Subject: [PATCH] More thorough mitigation for GM settings migration bug. #1630 --- src/General/Settings.coffee | 13 +++++++++++++ src/main/Main.coffee | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 4ebf2cba1..8f8c5fbc2 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -338,7 +338,20 @@ Settings = set 'usercss', Config['usercss'] unless data['usercss']? if data['usercss'].indexOf(css) < 0 set 'usercss', css + '\n\n' + data['usercss'] + # XXX https://github.com/greasemonkey/greasemonkey/issues/2600 + if (corrupted = (version[0] is '"')) + try + version = JSON.parse version compareString = version.replace(/\d+/g, (x) -> ('0000'+x)[-5..]) + if compareString < '00001.00013.00014.00008' + for key, val of data when typeof val is 'string' and typeof Conf[key] isnt 'string' and key not in ['Index Sort', 'Last Long Reply Thresholds 0', 'Last Long Reply Thresholds 1'] + corrupted = true + break + if corrupted + for key, val of data when typeof val is 'string' + try + val2 = JSON.parse val + set key, val2 if compareString < '00001.00011.00008.00000' unless data['Fixed Thread Watcher']? set 'Fixed Thread Watcher', data['Toggleable Thread Watcher'] ? true diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 840028fda..2408a40b9 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -84,16 +84,6 @@ Main = return $.asap docSet, -> - # XXX https://github.com/greasemonkey/greasemonkey/issues/2600 - if typeof items.watchedThreads is 'string' - changes = {} - for key, val of items when typeof val is 'string' - try - val2 = JSON.parse val - changes[key] = val2 - $.extend items, changes - $.set changes - # Don't hide the local storage warning behind a settings panel. if $.cantSet # pass