Loading browser/components/extensions/test/browser/browser_ext_tabs_cookieStoreId.js +27 −0 Original line number Diff line number Diff line Loading @@ -244,3 +244,30 @@ add_task(async function userContext_disabled() { await extension.unload(); await SpecialPowers.popPrefEnv(); }); add_task(async function tabs_query_cookiestoreid_nocookiepermission() { let extension = ExtensionTestUtils.loadExtension({ async background() { let tab = await browser.tabs.create({}); browser.test.assertEq( "firefox-default", tab.cookieStoreId, "Expecting cookieStoreId for new tab" ); let query = await browser.tabs.query({ index: tab.index, cookieStoreId: tab.cookieStoreId, }); browser.test.assertEq( "firefox-default", query[0].cookieStoreId, "Expecting cookieStoreId for new tab through browser.tabs.query" ); await browser.tabs.remove(tab.id); browser.test.sendMessage("done"); }, }); await extension.startup(); await extension.awaitMessage("done"); await extension.unload(); }); toolkit/components/extensions/ProxyChannelFilter.jsm +1 −1 Original line number Diff line number Diff line Loading @@ -309,7 +309,7 @@ class ProxyChannelFilter { ...extraData, }; if (originAttributes && this.extension.hasPermission("cookies")) { if (originAttributes) { data.cookieStoreId = getCookieStoreIdForOriginAttributes( originAttributes ); Loading toolkit/components/extensions/parent/ext-tabs-base.js +1 −4 Original line number Diff line number Diff line Loading @@ -654,6 +654,7 @@ class TabBase { isInReaderMode: this.isInReaderMode, sharingState: this.sharingState, successorTabId: this.successorTabId, cookieStoreId: this.cookieStoreId, }; // If the tab has not been fully layed-out yet, fallback to the geometry Loading @@ -668,10 +669,6 @@ class TabBase { result.openerTabId = opener; } if (this.extension.hasPermission("cookies")) { result.cookieStoreId = this.cookieStoreId; } if (this.hasTabPermission) { for (let prop of ["url", "title", "favIconUrl"]) { // We use the underscored variants here to avoid the redundant Loading toolkit/components/extensions/parent/ext-webRequest.js +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ function registerEvent( remoteTab = null ) { let listener = async data => { let event = data.serialize(eventName, extension); let event = data.serialize(eventName); if (data.registerTraceableChannel) { // If this is a primed listener, no tabParent was passed in here, // but the convert() callback later in this function will be called Loading toolkit/components/extensions/test/xpcshell/test_ext_webRequest_userContextId.js +1 −38 Original line number Diff line number Diff line Loading @@ -11,12 +11,7 @@ server.registerPathHandler("/dummy", (request, response) => { add_task(async function test_userContextId_webrequest() { let extension = ExtensionTestUtils.loadExtension({ manifest: { permissions: [ "webRequest", "webRequestBlocking", "<all_urls>", "cookies", ], permissions: ["webRequest", "webRequestBlocking", "<all_urls>"], }, background() { browser.webRequest.onBeforeRequest.addListener( Loading Loading @@ -44,35 +39,3 @@ add_task(async function test_userContextId_webrequest() { await extension.unload(); await contentPage.close(); }); add_task(async function test_userContextId_webrequest_nopermission() { let extension = ExtensionTestUtils.loadExtension({ manifest: { permissions: ["webRequest", "webRequestBlocking", "<all_urls>"], }, background() { browser.webRequest.onBeforeRequest.addListener( async details => { browser.test.assertEq( details.cookieStoreId, undefined, "cookieStoreId not set, requires cookies permission" ); browser.test.notifyPass("webRequest"); }, { urls: ["<all_urls>"] }, ["blocking"] ); }, }); await extension.startup(); let contentPage = await ExtensionTestUtils.loadContentPage( "http://example.com/dummy", { userContextId: 2 } ); await extension.awaitFinish("webRequest"); await extension.unload(); await contentPage.close(); }); Loading
browser/components/extensions/test/browser/browser_ext_tabs_cookieStoreId.js +27 −0 Original line number Diff line number Diff line Loading @@ -244,3 +244,30 @@ add_task(async function userContext_disabled() { await extension.unload(); await SpecialPowers.popPrefEnv(); }); add_task(async function tabs_query_cookiestoreid_nocookiepermission() { let extension = ExtensionTestUtils.loadExtension({ async background() { let tab = await browser.tabs.create({}); browser.test.assertEq( "firefox-default", tab.cookieStoreId, "Expecting cookieStoreId for new tab" ); let query = await browser.tabs.query({ index: tab.index, cookieStoreId: tab.cookieStoreId, }); browser.test.assertEq( "firefox-default", query[0].cookieStoreId, "Expecting cookieStoreId for new tab through browser.tabs.query" ); await browser.tabs.remove(tab.id); browser.test.sendMessage("done"); }, }); await extension.startup(); await extension.awaitMessage("done"); await extension.unload(); });
toolkit/components/extensions/ProxyChannelFilter.jsm +1 −1 Original line number Diff line number Diff line Loading @@ -309,7 +309,7 @@ class ProxyChannelFilter { ...extraData, }; if (originAttributes && this.extension.hasPermission("cookies")) { if (originAttributes) { data.cookieStoreId = getCookieStoreIdForOriginAttributes( originAttributes ); Loading
toolkit/components/extensions/parent/ext-tabs-base.js +1 −4 Original line number Diff line number Diff line Loading @@ -654,6 +654,7 @@ class TabBase { isInReaderMode: this.isInReaderMode, sharingState: this.sharingState, successorTabId: this.successorTabId, cookieStoreId: this.cookieStoreId, }; // If the tab has not been fully layed-out yet, fallback to the geometry Loading @@ -668,10 +669,6 @@ class TabBase { result.openerTabId = opener; } if (this.extension.hasPermission("cookies")) { result.cookieStoreId = this.cookieStoreId; } if (this.hasTabPermission) { for (let prop of ["url", "title", "favIconUrl"]) { // We use the underscored variants here to avoid the redundant Loading
toolkit/components/extensions/parent/ext-webRequest.js +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ function registerEvent( remoteTab = null ) { let listener = async data => { let event = data.serialize(eventName, extension); let event = data.serialize(eventName); if (data.registerTraceableChannel) { // If this is a primed listener, no tabParent was passed in here, // but the convert() callback later in this function will be called Loading
toolkit/components/extensions/test/xpcshell/test_ext_webRequest_userContextId.js +1 −38 Original line number Diff line number Diff line Loading @@ -11,12 +11,7 @@ server.registerPathHandler("/dummy", (request, response) => { add_task(async function test_userContextId_webrequest() { let extension = ExtensionTestUtils.loadExtension({ manifest: { permissions: [ "webRequest", "webRequestBlocking", "<all_urls>", "cookies", ], permissions: ["webRequest", "webRequestBlocking", "<all_urls>"], }, background() { browser.webRequest.onBeforeRequest.addListener( Loading Loading @@ -44,35 +39,3 @@ add_task(async function test_userContextId_webrequest() { await extension.unload(); await contentPage.close(); }); add_task(async function test_userContextId_webrequest_nopermission() { let extension = ExtensionTestUtils.loadExtension({ manifest: { permissions: ["webRequest", "webRequestBlocking", "<all_urls>"], }, background() { browser.webRequest.onBeforeRequest.addListener( async details => { browser.test.assertEq( details.cookieStoreId, undefined, "cookieStoreId not set, requires cookies permission" ); browser.test.notifyPass("webRequest"); }, { urls: ["<all_urls>"] }, ["blocking"] ); }, }); await extension.startup(); let contentPage = await ExtensionTestUtils.loadContentPage( "http://example.com/dummy", { userContextId: 2 } ); await extension.awaitFinish("webRequest"); await extension.unload(); await contentPage.close(); });