diff options
| author | Stephen Blott | 2015-02-09 08:55:47 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-02-09 08:55:47 +0000 |
| commit | 88f6eab0908ee05e67f4883ca3419681e7de39ef (patch) | |
| tree | 472c61d367fdf7b6305198c2cd4185c0e422ef6a /content_scripts/vimium_frontend.coffee | |
| parent | 8991e7b16bdee88195851db8832707fc256e53fc (diff) | |
| download | vimium-88f6eab0908ee05e67f4883ca3419681e7de39ef.tar.bz2 | |
Propagate queries to incognito-mode tabs.
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 9a50d373..06eaf334 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -551,16 +551,16 @@ FindModeHistory = @key = "findModeRawQueryListIncognito" if isIncognitoMode @storage.get @key, (items) => unless chrome.runtime.lastError - @rawQueryList = items[@key] - if isIncognitoMode and not @rawQueryList - # This is the first incognito tab, we need to initialize the incognito-mode query history. + @rawQueryList = items[@key] if items[@key] + if isIncognitoMode and not items[@key] + # This is the first incognito tab, so we need to initialize the incognito-mode query history. @storage.get "findModeRawQueryList", (items) => unless chrome.runtime.lastError @rawQueryList = items.findModeRawQueryList @storage.set findModeRawQueryListIncognito: @rawQueryList chrome.storage.onChanged.addListener (changes, area) => - @rawQueryList = changes[@key].newValue if changes[@key]?.newValue? + @rawQueryList = changes[@key].newValue if changes[@key]? getQuery: (index = 0) -> @rawQueryList?[index] or "" @@ -570,6 +570,12 @@ FindModeHistory = @rawQueryList = ([ query ].concat @rawQueryList.filter (q) => q != query)[0..@max] newSetting = {}; newSetting[@key] = @rawQueryList @storage.set newSetting + # Now, check whether we need to propagte this query to incognito mode too. + unless isIncognitoMode + @storage.get "findModeRawQueryListIncognito", (items) => + if not chrome.runtime.lastError and items.findModeRawQueryListIncognito + rawQueryList = ([ query ].concat items.findModeRawQueryListIncognito.filter (q) => q != query)[0..@max] + @storage.set findModeRawQueryListIncognito: rawQueryList # should be called whenever rawQuery is modified. updateFindModeQuery = -> |
