Closed Bug 1578096 Opened 5 years ago Closed 5 years ago

chrome.cookies.getAllCookieStores does not return all cookieStores

Categories

(WebExtensions :: General, defect)

68 Branch
defect
Not set
normal

Tracking

(firefox69 affected, firefox70 affected, firefox71 affected)

RESOLVED DUPLICATE of bug 1486274
Tracking Status
firefox69 --- affected
firefox70 --- affected
firefox71 --- affected

People

(Reporter: feedbro.reader, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

  1. Create a WebExtension with "cookies" permission.
  2. Install https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/
  3. Create a new Container and call it "Amazon"
  4. Open www.amazon.com in a Amazon container (now there should be cookies in that container)
  5. Close the amazon.com tab
  6. Open the other WebExtension (in Debug mode and developer tools) with cookies permission and run this:
    chrome.cookies.getAllCookieStores(function(stores) { console.log(stores); });

Actual results:

getAllCookieStores returns only "firefox-default" cookieStore although there are cookies in the other container storage as well (the amazon one).

Note! If you leave the amazon.com tab open, then this function will return the other store as well.

Now the problem is that currently it's not possible for a cookie extension to ask: "Hey Firefox, give me ALL cookieStores that have cookies" because Firefox is lying and giving just the "firefox-default" storage although there might be hundreds of cookies in other cookieStorages containers as well. As a result, a cookie managing extension can't properly purge unwanted cookies in all storages at start.

Expected results:

getAllCookieStores should return ALL different stores that have cookies. It should not matter whether such containers are open in tabs or not.

The main problem seems to be that getAllCookieStores() code is based on scanning open tabs. But that implementation does not do what the method name or the docs imply and it doesn't support the Use Case that WebExtension developers have (to find out ALL cookieStores that have cookies in order to process them).

The code should be changed so that instead of scanning open tabs, the code would loop through all cookies (all containers considered) and create a list of unique cookieStore ids. It should not require any open tabs.

https://searchfox.org/mozilla-central/source/toolkit/components/extensions/parent/ext-cookies.js#518

Component: Untriaged → General
Product: Firefox → WebExtensions
Version: 68 Branch → Firefox 68

Yeah, I think instead of looping through the open tabs, we should instead loop through the existing containers and add those containers as cookieStoreIds.

The issue can be reproduced on the latest Nightly (71.0a1/20190910213950), Beta (70.0b5/20190909162732) and Release versions (69.0/20190827005903) by following the above STR under Windows 10 Pro 64-bit and macOS High Sierra 10.13.6.

Status: UNCONFIRMED → NEW
Ever confirmed: true

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies) → needinfo?(mixedpuppy)

We opted for chrome compat in this regard already in bug 1486274. You can get the non default cookie store IDs from the contextualIdentities API regardless whether a tab is open using them.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(mixedpuppy)
Resolution: --- → DUPLICATE
Version: Firefox 68 → 68 Branch
You need to log in before you can comment on or make changes to this bug.