Closed Bug 1363379 Opened 7 years ago Closed 7 years ago

Support private browsing cookies in WebExtensions - url condition

Categories

(WebExtensions :: Untriaged, defect, P3)

53 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1354229

People

(Reporter: dominik.hoelzl, Unassigned)

Details

(Whiteboard: triaged)

For me this bug is not fully fixed.

I do the following using Firefox 53.0.2 (64-Bit) on Windows:

tabid is the id of the affected private browsing tab, and taburl is the current url of this tab.


chrome.cookies.getAllCookieStores(function(stores) {
  var storeid = null;
  for (var i = 0;i < stores.length; i++) {
    for (var j = 0;j < stores[i].tabIds.length; j++) {
      if (stores[i].tabIds[j] === tabid) {
        storeid = stores[i].id;
        break;
      }
    }
    if (storeid) {
      break;
    }
  }
  chrome.cookies.getAll({url:taburl, storeId:storeid}, function(cookies) {
    console.log(cookies);
  });
});


When executing this with a private tab, "storeid" resolves to "firefox-private", and an empty array is returned by "cookies.getAll".

When executing this with a non-private tab, "storeid" resolves to "firefox-default", and all expected cookies are returned.

When executing "cookies.getAll" without the "url:taburl" condition, also with the private tab all cookies are returned (including cookies for the domain/path of the otherwise specified URL).
The returned "domain", "path" and "secure" properties of the returned cookies from the private tab (without the "url:taburl" condition) exactly match the URL I want to specify.

As a workaround I could omit the URL condition and do the matching by myself.

The cookies I test with are all "httponly " and "secure".

In Google Chrome with the exact same setup all works as expected.







+++ This bug was initially created as a clone of Bug #1254221 +++

I am writing a site-specific WebExtension that reads the session cookie from a site and use it to call the site's own public API to enrich the information shown in the browser. It does not work in Firefox in private browsing mode. It seems like the chrome.cookies API cannot read private browsing cookies. It works fine in Chrome incognito mode.
Priority: -- → P2
Whiteboard: triaged
Priority: P2 → P3
Can you reproduce this?

When will this issue be fixed?
This looks like bug 1354229, which was fixed in Firefox 56.

Dominik, can you confirm that this bug has been fixed for you?
Flags: needinfo?(dominik.hoelzl)
I have tested Firefox 56.0.2 and 57.0.1 on Windows (64-Bit) and I could not reproduce the problem any more, whereas in Firefox 55.0.3 the bug still exists.
Thank you for fixing this!
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(dominik.hoelzl)
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.