chrome.browsingData.remove or chrome.cookies.remove not deleting all cookies

786 views Asked by At

In my chrome extension, I want to remove everything. I am using this code

chrome.browsingData.remove({
  "since": 0
}, {
  "appcache": true,
  "cache": true,
  "cacheStorage": true,
  "cookies": true,
  "downloads": true,
  "fileSystems": true,
  "formData": true,
  "history": true,
  "indexedDB": true,
  "localStorage": true,
  "passwords": true,
  "serviceWorkers": true,
  "webSQL": true
}, afterCleared);

This is removing other things but not all cookies and cache. I have the following permissions and using "manifest_version": 2

"permissions": [
        "activeTab",
        "tabs" ,
        "<all_urls>",
        "browsingData",
        "cookies"
    ]

I tried even using cookies method to delete all cookies

 chrome.cookies.getAll({}, function(cookie) {
            for (i = 0; i < cookie.length; i++) {
                chrome.cookies.remove({url: "https://" + cookie[i]["domain"], name: cookie[i]["name"]}) 
});

When I use chrome.cookies.getAll, after chrome.browsingData.remove or chrome.cookies.remove, this shows me 0 cookie count. But when I go to history clear option in the browser there I see some count showing in Cookies and other site data enter image description here

I tried even

"originTypes": {
    "protectedWeb": true,
    "unprotectedWeb": true
  }

in chrome.browsingData.remove but that also is not clearing some cookie. Even not all cache is cleared as you can see in the image. When I clear it from the browser clear option then the cookie count becomes 0 but not from the chrome extension. Am I missing something?

0

There are 0 answers