mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-19 05:01:33 +00:00
gh-14905: Inherit context IDs when syncing tabs (gh-14908)
This commit is contained in:
@@ -1373,6 +1373,7 @@ class nsZenWindowSync {
|
||||
const newTab = win.gBrowser.addTrustedTab("about:blank", {
|
||||
animate: true,
|
||||
createLazyBrowser: true,
|
||||
userContextId: tab.userContextId,
|
||||
_forZenEmptyTab: tab.hasAttribute("zen-empty-tab"),
|
||||
});
|
||||
newTab.id = tab.id;
|
||||
|
||||
@@ -16,3 +16,41 @@ add_task(async function test_SimpleTabOpen() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_TabOpenInContainer() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["privacy.userContext.enabled", true]],
|
||||
});
|
||||
let newTab = null;
|
||||
await withNewSyncedWindow(async win => {
|
||||
await runSyncAction(
|
||||
() => {
|
||||
newTab = gBrowser.addTrustedTab("https://example.com/", {
|
||||
inBackground: true,
|
||||
userContextId: 1,
|
||||
});
|
||||
},
|
||||
async () => {
|
||||
Assert.equal(
|
||||
newTab.userContextId,
|
||||
1,
|
||||
"The opened tab should keep its container"
|
||||
);
|
||||
const otherTab = gZenWindowSync.getItemFromWindow(win, newTab.id);
|
||||
Assert.ok(
|
||||
otherTab,
|
||||
"The opened tab should be found in the synced window"
|
||||
);
|
||||
Assert.equal(
|
||||
otherTab.userContextId,
|
||||
newTab.userContextId,
|
||||
"The synced tab should inherit the original tab's container"
|
||||
);
|
||||
},
|
||||
"TabOpen"
|
||||
);
|
||||
});
|
||||
let tabClosing = BrowserTestUtils.waitForTabClosing(newTab);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
await tabClosing;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user