Extensions can't open a tab in a container: cookieStoreId is dropped in GeckoWebExtension.onNewTab
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start in GeckoWebExtension.onNewTab in the android-components engine-gecko code, where tabDetails.cookieStoreId is currently not forwarded to tabHandler.onNewTab. Use a-c-weblibre-new-window-context.patch as the reference for carrying a contextId into a new engine session, and check GeckoTabsApiImpl.addTab on the WebLibre side. Done means tabs.create({cookieStoreId}) opens the tab in the requested container, which you can verify with the minimal extension the reporter describes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
WebLibre ignores cookieStoreId when an extension creates a tab. browser.tabs.create({ url, cookieStoreId: "firefox-container-<uuid>" }) resolves successfully, but the tab opens in the default container, so an extension has no way to target one of WebLibre's containers.
That makes container-scoped automation impossible in WebLibre although the same add-ons work in desktop Firefox — e.g. opening a set of links into separate accounts, "open this link in " helpers, or a request queue that fans one URL out to several containers.
Related earlier reports: #283 (contextualIdentities — a larger ask, closed) and #587 (extensions can't modify cookies in containers — confirms containers are mapped to Gecko's contextId). This report is deliberately narrower than both.
Describe the solution you'd like
Make extension-created tabs honor cookieStoreId.
I traced where the value is lost. GeckoView already provides it (WebExtension.CreateTabDetails.cookieStoreId), and WebLibre already forwards a contextId when it creates tabs itself (GeckoTabsApiImpl.addTab(..., contextId, ...) → createTab(contextId = ...)). The value is dropped one layer earlier, in android-components:
// components/browser/engine-gecko/.../GeckoWebExtension.kt
override fun onNewTab(ext: GeckoNativeWebExtension, tabDetails: CreateTabDetails): GeckoResult<GeckoSession>? {
...
tabHandler.onNewTab(
this@GeckoWebExtension,
geckoEngineSession,
tabDetails.active == true,
tabDetails.url ?: "",
isPrivate, // tabDetails.cookieStoreId is not forwarded
)
So the fix looks like the pattern already used in a-c-weblibre-new-window-context.patch, which carries the opener's contextId into a new engine session for TARGET_WINDOW_NEW:
- create the new engine session with
contextId = tabDetails.cookieStoreId - keep the tab model's contextId consistent (as
WindowFeaturedoes) - optionally forward the value through
TabHandler.onNewTab/onNewTabOverrideso the app can pass it toaddTab(..., contextId = …)
Scope: creating a tab in an already known container id only. contextualIdentities (listing/creating containers) is not needed for this use case, so this does not reopen #283.
Describe alternatives you've considered
- Container-targeted deeplink / intent extra (e.g.
weblibre://open?url=…&container=…). Useful for external launchers, but from inside an extension it costs an extra throwaway tab, and it does not fix thetabs.createcontract. browser.contextualIdentities(#283). Not needed here; listing/creating containers is out of scope.- Manual workaround:
tabs.update()on a tab that already exists in a container keeps that container, so a container that has one open tab can be reused — but nothing can be opened into a container that has no tab yet.
Additional context
Measured on WebLibre 0.40.0, GeckoView 158.0.2, Android 16 (Xiaomi Pad mini):
| Operation | Result |
|---|---|
tabs.create({url, cookieStoreId: "firefox-container-<uuid>"}) |
opens in firefox-default, no error |
tabs.create({url, cookieStoreId: "firefox-container-1"}) |
opens in firefox-default |
activate a tab in the target container, then tabs.create({url}) |
still firefox-default |
browser.contextualIdentities |
undefined (with the permission declared) |
browser.tabs.query({cookieStoreId}) |
works — filters correctly |
tabs.update({tabId, url}) on a tab already in a container |
keeps the container |
Background: GeckoView implemented the cookieStoreId parameter for tabs.create in 2020 (bug 1622500) ahead of Fenix containers, which then did not ship — which is likely why the android-components callback still carries only url and isPrivate.
I can provide a minimal MV2 reproduction extension (manifest + ~20 lines) and, if you'd like, a patch against fennec-components plus the small GlobalComponents.kt change. I have had container-related issues/PRs accepted in other container extension projects (Container Tab Groups), so I'm happy to do the patch work.
- Ngôn ngữ chính
- Dart
- Star
- 1k
- Fork
- 41
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của FaFre/WebLibre
-
bug enhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
French app translationĐang mởenhancement needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 60/100
-
Chromium based weblibre.Đang mởenhancement needs-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
-
bug enhancement needs-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
needs-triage
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 48/100
Tất cả issue của FaFre/WebLibre
Issue tương tự
-
bug from-telegram platform:windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hiddify/hiddify-app#2592 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
cogwheel0/conduit#1122 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
夜間レビュー: 観点 tests の指摘 (PR #774)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bannzai/shoppinglist#779 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Android bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PostHog/posthog-flutter#731 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] JEFIT import fails because # characters are not recognisedCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày