From 23cb1677bbc79328e7329fab4400f671ea6aee23 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 15 Mar 2015 16:00:08 +0000 Subject: Fall back to "chrome://newtab" in incognito mode. --- background_scripts/main.coffee | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'background_scripts') 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) -- cgit v1.2.3