Remove cookies created in the last week:
function onRemoved() {
console.log("removed");
}
function onError(error) {
console.error(error);
}
function weekInMilliseconds() {
return 1000 * 60 * 60 * 24 * 7;
}
let oneWeekAgo = new Date().getTime() - weekInMilliseconds();
browser.browsingData
.removeCookies({ since: oneWeekAgo })
.then(onRemoved, onError);
Remove all cookies:
Warning: Using the API to remove all cookies will, simultaneously, clear all local storage objects (including those of other extensions).
If you want to clear all cookies without disrupting local storage facilities, use browser.cookies to loop through and remove the contents of all cookie stores.
function onRemoved() {
console.log("removed");
}
function onError(error) {
console.error(error);
}
browser.browsingData.removeCookies({}).then(onRemoved, onError);