More thorough mitigation for GM settings migration bug. #1630

This commit is contained in:
ccd0 2017-11-15 21:49:41 -08:00
parent 629e21619f
commit 883eba7049
2 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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