Open Bug 1643740 Opened 4 years ago Updated 4 months ago

use userContextId in GeckoView


(GeckoView :: Extensions, defect, P3)



(Not tracked)


(Reporter: agi, Unassigned, Mentored)


(Blocks 4 open bugs)


(Whiteboard: [geckoview:2023?][addons-jira])

There are a few places in the web extension implementation where we use userContextId but on GV we use geckoViewSessionContextId, we should fix that.

See Bug 1643688 for context.

Severity: -- → S3
Priority: -- → P1
Whiteboard: [geckoview:m79]
Whiteboard: [geckoview:m79] → [geckoview:m79][geckoview:m80]
Priority: P1 → P2
Whiteboard: [geckoview:m79][geckoview:m80] → [geckoview:m79]

So after some discussion with various people (including :snorp and :robwu) a while back we are thinking to actually make GeckoView use userContextId and move some desktop-specific logic from toolkit to browser (e.g. the list of predetermined containers shouldn't live in toolkit). Morphing this bug to that.

Component: Extensions → General
Summary: use geckoViewSessionContextId in the WebExtension implementation → use userContextId in GeckoView

Hi, I would love to work on this issue but unfortunately, the explanation provided in the description of bug 1643688 and in this comment was not very clear to me.
Could you please guide me on what needs to be done on this issue specifically?

Flags: needinfo?(agi)

Hi there! This is a little involved so I would definitely fix other, smaller and easier bugs before tackling this one.

To give an overview:

  • userContextId is used internally in Gecko to tag a tab with a "container" id. Many places in Gecko use this ID, among which the extension API, cookie jar, etc.
  • However, GeckoView doesn't use this ID, and instead uses geckoViewSessionContextId, mostly for historical reasons. Gecko has some front-end specific code around userContextId, and instead of refactoring that we decided to create our own field.
  • In hindsight, having our own fields has a lot of drawbacks: we can't use a lot of the existing code around userContextId, we need to special case mobile a lot etc.
  • So what we decided to do is to instead do the refactor, moving all the UI-related bits from toolkit (platform-independent code) to browser (Firefox Desktop specific)

To do this we need to:

(*) is, of course, a lot of work as there's probably a lot of code that relies on exactly the inner-workings of ContextualIdentityService.

I'm definitely available for mentoring on this, but again, let's fix some simpler stuff first :)

Mentor: agi
Flags: needinfo?(agi)

For Sure!... Do you have any recommendations for simpler issues related to this or in general, through which I can learn more about the platform?

Flags: needinfo?(agi)

Hey Ankush! Thanks for your interest. I think Bug 1651506 is a good one to practice a little bit. Rob has added some details already but feel free to drop in if you have further questions.

Flags: needinfo?(agi)
Whiteboard: [geckoview:m79] → [geckoview:m79][geckoview:m90?]
Whiteboard: [geckoview:m79][geckoview:m90?] → [geckoview:m79][geckoview:m91?]
Component: General → Extensions
Whiteboard: [geckoview:m79][geckoview:m91?] → [geckoview:m79]
Blocks: 1721460


I've been familiarizing myself with the codebase, and I think I am able to tackle this bug.

Blocks: 1743616

still relevant

Priority: P2 → P3
Whiteboard: [geckoview:m79] → [geckoview:2023?]
Blocks: 1796184
Whiteboard: [geckoview:2023?] → [geckoview:2023?][addons-jira]
Blocks: 1638878
No longer blocks: 1796184
You need to log in before you can comment on or make changes to this bug.