diff options
| author | mrmr1993 | 2015-04-27 19:58:10 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2015-05-29 12:06:00 +0100 | 
| commit | bfe304932b13eb1bfe65662490d3d6b830eefec7 (patch) | |
| tree | 8fb91decfa641fc5eff10c34eb8b7745017b1008 /background_scripts | |
| parent | d7a0daf5fa2c0a3302a8fc6b9fa0744cfa17ab42 (diff) | |
| download | vimium-bfe304932b13eb1bfe65662490d3d6b830eefec7.tar.bz2 | |
Only perform settings migration in the background page
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/settings.coffee | 28 | 
1 files changed, 15 insertions, 13 deletions
| diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index 6b33d239..607264a2 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -175,16 +175,18 @@ root.Settings = Settings =  # Export Sync via Settings for tests.  root.Settings.Sync = Sync - -# We use settingsVersion to coordinate any necessary schema changes. -if Utils.compareVersions("1.42", Settings.get("settingsVersion")) != -1 -  Settings.set("scrollStepSize", parseFloat Settings.get("scrollStepSize")) -Settings.set("settingsVersion", Utils.getCurrentVersion()) - -# Migration (after 1.49, 2015/2/1). -# Legacy setting: findModeRawQuery (a string). -# New setting: findModeRawQueryList (a list of strings), now stored in chrome.storage.local (not localStorage). -chrome.storage.local.get "findModeRawQueryList", (items) -> -  unless chrome.runtime.lastError or items.findModeRawQueryList -    rawQuery = Settings.get "findModeRawQuery" -    chrome.storage.local.set findModeRawQueryList: (if rawQuery then [ rawQuery ] else []) +# Perform migration from old settings versions, if this is the background page. +if Utils.isBackgroundPage() + +  # We use settingsVersion to coordinate any necessary schema changes. +  if Utils.compareVersions("1.42", Settings.get("settingsVersion")) != -1 +    Settings.set("scrollStepSize", parseFloat Settings.get("scrollStepSize")) +  Settings.set("settingsVersion", Utils.getCurrentVersion()) + +  # Migration (after 1.49, 2015/2/1). +  # Legacy setting: findModeRawQuery (a string). +  # New setting: findModeRawQueryList (a list of strings), now stored in chrome.storage.local (not localStorage). +  chrome.storage.local.get "findModeRawQueryList", (items) -> +    unless chrome.runtime.lastError or items.findModeRawQueryList +      rawQuery = Settings.get "findModeRawQuery" +      chrome.storage.local.set findModeRawQueryList: (if rawQuery then [ rawQuery ] else []) | 
