Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Action to clear cookies of the current tab. (issue 81) #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const clearActions = () => {
{title:"Clear all browsing data", desc:"Clear all of your browsing data", type:"action", action:"remove-all", emoji:true, emojiChar:"🧹", keycheck:false, keys:['⌘','D']},
{title:"Clear browsing history", desc:"Clear all of your browsing history", type:"action", action:"remove-history", emoji:true, emojiChar:"🗂", keycheck:false, keys:['⌘','D']},
{title:"Clear cookies", desc:"Clear all cookies", type:"action", action:"remove-cookies", emoji:true, emojiChar:"🍪", keycheck:false, keys:['⌘','D']},
{title:"Clear current site cookies", desc:"Clear cookies for the current tab", type:"action", action:"remove-current-cookies", emoji:true, emojiChar:"🍪", keycheck:false, keys:['⌘','D']},
{title:"Clear cache", desc:"Clear the cache", type:"action", action:"remove-cache", emoji:true, emojiChar:"🗄", keycheck:false, keys:['⌘','D']},
{title:"Clear local storage", desc:"Clear the local storage", type:"action", action:"remove-local-storage", emoji:true, emojiChar:"📦", keycheck:false, keys:['⌘','D']},
{title:"Clear passwords", desc:"Clear all saved passwords", type:"action", action:"remove-passwords", emoji:true, emojiChar:"🔑", keycheck:false, keys:['⌘','D']},
Expand Down Expand Up @@ -328,6 +329,15 @@ const clearBrowsingData = () => {
const clearCookies = () =>{
chrome.browsingData.removeCookies({"since": 0});
}
const clearCurrentCookie = () => {
getCurrentTab().then((response) => {
chrome.browsingData.remove({
"origins": [response.url]
}, {
"cookies": true
});
});
}
const clearCache = () => {
chrome.browsingData.removeCache({"since": 0});
}
Expand Down Expand Up @@ -402,6 +412,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
case "remove-cookies":
clearCookies();
break;
case "remove-current-cookies":
clearCurrentCookie();
break;
case "remove-cache":
clearCache();
break;
Expand Down
1 change: 1 addition & 0 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ $(document).ready(() => {
case "remove-all":
case "remove-history":
case "remove-cookies":
case "remove-current-cookies":
case "remove-cache":
case "remove-local-storage":
case "remove-passwords":
Expand Down