Backed out changeset 10cb82a1a314 (bug 1643736) for geckoview failures on testBrowserTabsCreate

This commit is contained in:
Narcis Beleuzu 2021-01-14 21:10:40 +02:00
Родитель ea38ea96c3
Коммит 242a631698
5 изменённых файлов: 2 добавлений и 182 удалений

Просмотреть файл

@ -331,13 +331,6 @@ this.tabs = class extends ExtensionAPI {
} }
} }
cookieStoreId = getUserContextIdForCookieStoreId(
extension,
cookieStoreId,
false // TODO bug 1372178: support creation of private browsing tabs
);
cookieStoreId = cookieStoreId ? cookieStoreId.toString() : undefined;
const nativeTab = await GeckoViewTabBridge.createNewTab({ const nativeTab = await GeckoViewTabBridge.createNewTab({
extensionId: context.extension.id, extensionId: context.extension.id,
createProperties: { createProperties: {

Просмотреть файл

@ -1,4 +1,4 @@
browser.tabs.create({ browser.tabs.create({
url: "https://www.mozilla.org/en-US/", url: "https://www.mozilla.org/en-US/",
cookieStoreId: "firefox-container-1", cookieStoreId: "1",
}); });

Просмотреть файл

@ -84,11 +84,6 @@ global.getContainerForCookieStoreId = function(storeId) {
} }
let containerId = storeId.substring(CONTAINER_STORE.length); let containerId = storeId.substring(CONTAINER_STORE.length);
if (AppConstants.platform === "android") {
return parseInt(containerId, 10);
} // TODO: Bug 1643740, support ContextualIdentityService on Android
if (ContextualIdentityService.getPublicIdentityFromId(containerId)) { if (ContextualIdentityService.getPublicIdentityFromId(containerId)) {
return parseInt(containerId, 10); return parseInt(containerId, 10);
} }

Просмотреть файл

@ -152,14 +152,13 @@ skip-if = xorigin # JavaScript Error: "SecurityError: Permission denied to acces
scheme=https scheme=https
[test_ext_storage_smoke_test.html] [test_ext_storage_smoke_test.html]
[test_ext_streamfilter_multiple.html] [test_ext_streamfilter_multiple.html]
skip-if = skip-if =
!debug # Bug 1628642 !debug # Bug 1628642
os == 'linux' # Bug 1628642 os == 'linux' # Bug 1628642
[test_ext_streamfilter_processswitch.html] [test_ext_streamfilter_processswitch.html]
[test_ext_subframes_privileges.html] [test_ext_subframes_privileges.html]
skip-if = os == 'android' || verify # bug 1489771 skip-if = os == 'android' || verify # bug 1489771
[test_ext_tabs_captureTab.html] [test_ext_tabs_captureTab.html]
[test_ext_tabs_create_cookieStoreId.html]
[test_ext_tabs_query_popup.html] [test_ext_tabs_query_popup.html]
[test_ext_tabs_sendMessage.html] [test_ext_tabs_sendMessage.html]
[test_ext_test.html] [test_ext_test.html]

Просмотреть файл

@ -1,167 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test tabs.create(cookieStoreId)</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
"use strict";
add_task(async function no_cookies_permission() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.userContext.enabled", true]],
});
let extension = ExtensionTestUtils.loadExtension({
async background() {
await browser.test.assertRejects(
browser.tabs.create({ cookieStoreId: "firefox-container-1" }),
/No permission for cookieStoreId/,
"cookieStoreId requires cookies permission"
);
browser.test.sendMessage("done");
},
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
await SpecialPowers.popPrefEnv();
});
add_task(async function invalid_cookieStoreId() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.userContext.enabled", true]],
});
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs", "cookies"],
},
async background() {
await browser.test.assertRejects(
browser.tabs.create({ cookieStoreId: "not-firefox-container-1" }),
/Illegal cookieStoreId/,
"cookieStoreId must be valid"
);
await browser.test.assertRejects(
browser.tabs.create({ cookieStoreId: "firefox-private" }),
/Illegal to set private cookieStoreId in a non-private window/,
"cookieStoreId cannot be private in a non-private window"
);
browser.test.sendMessage("done");
},
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
await SpecialPowers.popPrefEnv();
});
add_task(async function perma_private_browsing_mode() {
await SpecialPowers.pushPrefEnv({
set: [["browser.privatebrowsing.autostart", true]],
});
let extension = ExtensionTestUtils.loadExtension({
incognitoOverride: "spanning",
manifest: {
permissions: ["tabs", "cookies"],
},
async background() {
await browser.test.assertRejects(
browser.tabs.create({ cookieStoreId: "firefox-container-1" }),
/Contextual identities are unavailable in permanent private browsing mode/,
"cookieStoreId cannot be a container tab ID in perma-private browsing mode"
);
browser.test.sendMessage("done");
},
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
await SpecialPowers.popPrefEnv();
});
add_task(async function userContext_disabled() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.userContext.enabled", false]],
});
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs", "cookies"],
},
async background() {
await browser.test.assertRejects(
browser.tabs.create({ cookieStoreId: "firefox-container-1" }),
/Contextual identities are currently disabled/,
"cookieStoreId cannot be a container tab ID when contextual identities are disabled"
);
browser.test.sendMessage("done");
},
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
await SpecialPowers.popPrefEnv();
});
add_task(async function valid_cookieStoreId() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.userContext.enabled", true]],
});
const testCases = [
{
description: "no explicit URL",
createProperties: {
cookieStoreId: "firefox-container-1",
},
expectedCookieStoreId: "firefox-container-1",
},
{
description: "pass explicit url",
createProperties: {
url: "about:blank",
cookieStoreId: "firefox-container-1",
},
expectedCookieStoreId: "firefox-container-1",
},
];
async function background(testCases) {
for (let { createProperties, expectedCookieStoreId } of testCases) {
let tab = await browser.tabs.create(createProperties);
browser.test.assertEq(
expectedCookieStoreId,
tab.cookieStoreId,
"Expected cookieStoreId for container tab"
);
await browser.tabs.remove(tab.id);
}
browser.test.sendMessage("done");
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["tabs", "cookies"],
},
background: `(${background})(${JSON.stringify(testCases)})`,
});
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
await SpecialPowers.popPrefEnv();
});
</script>
</body>
</html>