WebExtension cookies API does not work in private browsing

NEW
Assigned to

Status

()

Toolkit
WebExtensions: Untriaged
P1
normal
6 months ago
2 months ago

People

(Reporter: Jesper Kristensen, Assigned: kmag)

Tracking

unspecified
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged[cookies])

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

6 months ago
WebExtension cookies API does not work in private browsing. I am not sure when it stopped working.
Comment hidden (mozreview-request)
(Reporter)

Comment 2

6 months ago
I uploaded a patch. There are no unit tests yet. I could not find any unit tests that test if the cookies seen by the WebExtension API are the same as the cookies seen by websites. I am not sure how to create such a unit test.
Comment hidden (mozreview-request)
(Reporter)

Comment 4

6 months ago
I made an attempt at a unit test, but it does not show the cookie header. I can't figure out why.

Updated

6 months ago
Assignee: nobody → kmaglione+bmo
Priority: -- → P1
Whiteboard: triaged
Comment hidden (mozreview-request)
I was hoping this might address bug 1309637 but it doesn't appear to.

Updated

6 months ago
Whiteboard: triaged → triaged[cookies]

Updated

2 months ago
webextensions: --- → ?

Updated

2 months ago
webextensions: ? → +

Comment 7

2 months ago
I encountered this issue while creating a cookie manager (https://addons.mozilla.org/en-US/firefox/addon/a-cookie-manager/) and independently discovered that privateBrowsingId is missing from OriginAttributes. The fix in the patch looks good to me (but I would create a separate variable to store {userContextId,privateBrowsingId} instead of duplicating the dictionary).
Why has this not landed yet?

(In reply to Jesper Kristensen from comment #4)
> I made an attempt at a unit test, but it does not show the cookie header. I
> can't figure out why.

Jesper, what can I do to help you with finishing this patch?
Flags: needinfo?(bugzilla)
(Reporter)

Comment 8

2 months ago
As I said in comment #2 I could not find out how to make a unit test that tests what cookies a website would actually see and set.
Flags: needinfo?(bugzilla)

Updated

2 months ago
See Also: → bug 1354229

Comment 9

2 months ago
You can use a content script (or just a normal web page) and use the document.cookie DOM API to read/write cookies.

See the test case in comment 2 at bug 1354229 for an example of writing cookies.
You need to log in before you can comment on or make changes to this bug.