diff --git a/src/background.js b/src/background.js index f55af6a..e5b7efd 100644 --- a/src/background.js +++ b/src/background.js @@ -319,6 +319,9 @@ const closeWindow = (id) => { const closeTab = (tab) => { chrome.tabs.remove(tab.id); } +const closeCurrentTab = () => { + getCurrentTab().then(closeTab) +} const removeBookmark = (bookmark) => { chrome.bookmarks.remove(bookmark.id); } @@ -395,6 +398,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { case "close-window": closeWindow(sender.tab.windowId); break; + case "close-tab": + closeCurrentTab(); + break; case "search-history": chrome.history.search({text:message.query, maxResults:1000, startTime:31536000000*5}).then((data) => { for (let action in actions) { diff --git a/src/content.js b/src/content.js index 7254f20..e2be550 100644 --- a/src/content.js +++ b/src/content.js @@ -210,9 +210,6 @@ $(document).ready(function(){ case "scroll-top": window.scrollTo(0,0); break; - case "close-tab": - window.close(); - break; case "navigation": if (e.ctrlKey) { window.open(action.url);