diff options
| author | Stephen Blott | 2015-03-15 16:00:08 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-03-15 16:00:08 +0000 |
| commit | 23cb1677bbc79328e7329fab4400f671ea6aee23 (patch) | |
| tree | fb1524027a68a50224ab43e1ceff2756444323cc | |
| parent | 359c6c3436d08ea0b80c7cdfaa482c04f7592512 (diff) | |
| download | vimium-23cb1677bbc79328e7329fab4400f671ea6aee23.tar.bz2 | |
Fall back to "chrome://newtab" in incognito mode.
| -rw-r--r-- | background_scripts/main.coffee | 12 | ||||
| -rw-r--r-- | pages/options.html | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 30576554..fe6cc70b 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -246,11 +246,13 @@ moveTab = (callback, direction) -> # mapped in commands.coffee. BackgroundCommands = createTab: (callback) -> - url = Settings.get "newTabUrl" - # FIXME(smblott). "pages/blank.html" doesn't work in incognito mode. It opens the tab in a - # non-incognito-mode window. Perhaps we should just use "chrome://newtab" in that case? - url = chrome.runtime.getURL url if url == "pages/blank.html" - openUrlInNewTab { url }, callback + chrome.tabs.query { active: true, currentWindow: true }, (tabs) -> + tab = tabs[0] + url = Settings.get "newTabUrl" + if url == "pages/blank.html" + # "pages/blank.html" does not work in incognito mode, so fall back to "chrome://newtab" instead. + url = if tab.incognito then "chrome://newtab" else chrome.runtime.getURL url + openUrlInNewTab { url }, callback duplicateTab: (callback) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.duplicate(tab.id) diff --git a/pages/options.html b/pages/options.html index 889d5ea0..f89ddcbb 100644 --- a/pages/options.html +++ b/pages/options.html @@ -200,7 +200,7 @@ b: http://b.com/?q=%s description <div class="help"> <div class="example"> The page to open with the "create new tab" command. - Set this to "<tt>pages/blank.html</tt>" for a blank page.<br /> + Set this to "<tt>pages/blank.html</tt>" for a blank page (except incognito mode).<br /> </div> </div> <input id="newTabUrl" type="text" /> |
