From 5ea93cd18611d859867bdd80c44c886d29a7b958 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 19 Apr 2014 10:02:14 +0100 Subject: Add remote sync test for setting cleared. --- background_scripts/sync.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/sync.coffee b/background_scripts/sync.coffee index 3a829722..3b34c5a6 100644 --- a/background_scripts/sync.coffee +++ b/background_scripts/sync.coffee @@ -56,7 +56,7 @@ root.Sync = Sync = @log "ignoring: #{key}" return # Ignore, it's unchanged - if localStorage[key] is value + if key of localStorage and localStorage[key] is value @log "unchanged: #{key}" return @@ -64,7 +64,7 @@ root.Sync = Sync = defaultValue = Settings.defaults[key] defaultValueJSON = JSON.stringify(defaultValue) - if value && value != defaultValueJSON + if value and value != defaultValueJSON # Key/value has been changed to non-default value at remote instance. @log "update: #{key}=#{value}" localStorage[key] = value @@ -72,7 +72,8 @@ root.Sync = Sync = else # Key has been reset to default value at remote instance. @log "clear: #{key}" - delete localStorage[key] + if key of localStorage + delete localStorage[key] Settings.doPostUpdateHook key, defaultValue # Only called synchronously from within vimium, never on a callback. -- cgit v1.2.3