From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../test/unit/test_permmanager_cleardata.js | 17 +------ .../test/unit/test_permmanager_defaults.js | 30 +----------- .../permissions/test/unit/test_permmanager_ipc.js | 2 +- .../test/unit/test_permmanager_matches.js | 55 ---------------------- .../test/unit/test_permmanager_migrate_10-11.js | 4 +- .../test/unit/test_permmanager_migrate_11-12.js | 2 +- .../test/unit/test_permmanager_migrate_4-7.js | 9 ++-- .../test_permmanager_migrate_4-7_no_history.js | 8 ++-- .../test/unit/test_permmanager_migrate_5-7a.js | 9 ++-- .../test/unit/test_permmanager_migrate_5-7b.js | 3 +- .../test/unit/test_permmanager_migrate_6-7a.js | 9 ++-- .../test/unit/test_permmanager_migrate_6-7b.js | 3 +- .../test/unit/test_permmanager_migrate_7-8.js | 8 ++-- .../test/unit/test_permmanager_migrate_9-10.js | 4 +- 14 files changed, 26 insertions(+), 137 deletions(-) (limited to 'extensions/permissions/test') diff --git a/extensions/permissions/test/unit/test_permmanager_cleardata.js b/extensions/permissions/test/unit/test_permmanager_cleardata.js index 2bd4d11319..f732c70cce 100644 --- a/extensions/permissions/test/unit/test_permmanager_cleardata.js +++ b/extensions/permissions/test/unit/test_permmanager_cleardata.js @@ -66,13 +66,7 @@ function run_test() { pm = Services.perms; - let entries = [ - { origin: "http://example.com", originAttributes: {} }, - { - origin: "http://example.com", - originAttributes: { inIsolatedMozBrowser: true }, - }, - ]; + let entries = [{ origin: "http://example.com", originAttributes: {} }]; // In that case, all permissions should be removed. test(entries, getData({}), [ @@ -81,13 +75,4 @@ function run_test() { pm.ALLOW_ACTION, pm.ALLOW_ACTION, ]); - - // In that case, only the permissions related to a browserElement should be removed. - // All the other permissions should stay. - test(entries, getData({ inIsolatedMozBrowser: true }), [ - pm.ALLOW_ACTION, - pm.UNKNOWN_ACTION, - pm.ALLOW_ACTION, - pm.ALLOW_ACTION, - ]); } diff --git a/extensions/permissions/test/unit/test_permmanager_defaults.js b/extensions/permissions/test/unit/test_permmanager_defaults.js index 18ee7b4e11..c8f5f09e83 100644 --- a/extensions/permissions/test/unit/test_permmanager_defaults.js +++ b/extensions/permissions/test/unit/test_permmanager_defaults.js @@ -97,17 +97,7 @@ add_task(async function do_test() { {} ); - let attrs = { inIsolatedMozBrowser: true }; - let principal4 = Services.scriptSecurityManager.createContentPrincipal( - TEST_ORIGIN, - attrs - ); - let principal5 = Services.scriptSecurityManager.createContentPrincipal( - TEST_ORIGIN_3, - attrs - ); - - attrs = { userContextId: 1 }; + let attrs = { userContextId: 1 }; let principal1UserContext = Services.scriptSecurityManager.createContentPrincipal(TEST_ORIGIN, attrs); attrs = { privateBrowsingId: 1 }; @@ -140,10 +130,6 @@ add_task(async function do_test() { Ci.nsIPermissionManager.ALLOW_ACTION, pm.testPermissionFromPrincipal(principal3, TEST_PERMISSION) ); - Assert.equal( - Ci.nsIPermissionManager.ALLOW_ACTION, - pm.testPermissionFromPrincipal(principal4, TEST_PERMISSION) - ); // Depending on the prefs there are two scenarios here: // 1. We isolate by private browsing: The permission mgr should // add default permissions for these principals too. @@ -155,12 +141,6 @@ add_task(async function do_test() { pm.testPermissionFromPrincipal(principal1PrivateBrowsing, TEST_PERMISSION) ); - // Didn't add - Assert.equal( - Ci.nsIPermissionManager.UNKNOWN_ACTION, - pm.testPermissionFromPrincipal(principal5, TEST_PERMISSION) - ); - // the permission should exist in the enumerator. Assert.equal( Ci.nsIPermissionManager.ALLOW_ACTION, @@ -189,10 +169,6 @@ add_task(async function do_test() { Ci.nsIPermissionManager.ALLOW_ACTION, pm.testPermissionFromPrincipal(principal3, TEST_PERMISSION) ); - Assert.equal( - Ci.nsIPermissionManager.ALLOW_ACTION, - pm.testPermissionFromPrincipal(principal4, TEST_PERMISSION) - ); // remove all should not throw and the default should remain pm.removeAll(); @@ -209,10 +185,6 @@ add_task(async function do_test() { Ci.nsIPermissionManager.ALLOW_ACTION, pm.testPermissionFromPrincipal(principal3, TEST_PERMISSION) ); - Assert.equal( - Ci.nsIPermissionManager.ALLOW_ACTION, - pm.testPermissionFromPrincipal(principal4, TEST_PERMISSION) - ); // Default permission should have also been added for private browsing. Assert.equal( Ci.nsIPermissionManager.ALLOW_ACTION, diff --git a/extensions/permissions/test/unit/test_permmanager_ipc.js b/extensions/permissions/test/unit/test_permmanager_ipc.js index 239cc5aeaf..b80ab78152 100644 --- a/extensions/permissions/test/unit/test_permmanager_ipc.js +++ b/extensions/permissions/test/unit/test_permmanager_ipc.js @@ -12,7 +12,7 @@ add_task(async function test_permissions_sent_over_ipc_on_bloburl() { // setup a profile. do_get_profile(); - async function assertExpectedContentPage(contentPage) { + async function assertExpectedContentPage() { const [processType, remoteType, principalSpec] = await page.spawn( [], async () => { diff --git a/extensions/permissions/test/unit/test_permmanager_matches.js b/extensions/permissions/test/unit/test_permmanager_matches.js index 937a1ce750..04f2e41b3d 100644 --- a/extensions/permissions/test/unit/test_permmanager_matches.js +++ b/extensions/permissions/test/unit/test_permmanager_matches.js @@ -63,14 +63,6 @@ function run_test() { let uri4_n = secMan.createContentPrincipal(uri4, {}); let uri5_n = secMan.createContentPrincipal(uri5, {}); - attrs = { inIsolatedMozBrowser: true }; - let uri0_y_ = secMan.createContentPrincipal(uri0, attrs); - let uri1_y_ = secMan.createContentPrincipal(uri1, attrs); - let uri2_y_ = secMan.createContentPrincipal(uri2, attrs); - let uri3_y_ = secMan.createContentPrincipal(uri3, attrs); - let uri4_y_ = secMan.createContentPrincipal(uri4, attrs); - let uri5_y_ = secMan.createContentPrincipal(uri5, attrs); - attrs = { userContextId: 1 }; let uri0_1 = secMan.createContentPrincipal(uri0, attrs); let uri1_1 = secMan.createContentPrincipal(uri1, attrs); @@ -89,8 +81,6 @@ function run_test() { pm.addFromPrincipal(uri0_n, "test/matches", pm.ALLOW_ACTION); let perm_n = pm.getPermissionObject(uri0_n, "test/matches", true); - pm.addFromPrincipal(uri0_y_, "test/matches", pm.ALLOW_ACTION); - let perm_y_ = pm.getPermissionObject(uri0_y_, "test/matches", true); pm.addFromPrincipal(uri0_1, "test/matches", pm.ALLOW_ACTION); let perm_1 = pm.getPermissionObject(uri0_n, "test/matches", true); pm.addFromPrincipal(uri0_cnn, "test/matches", pm.ALLOW_ACTION); @@ -103,39 +93,6 @@ function run_test() { uri3_n, uri4_n, uri5_n, - uri0_y_, - uri1_y_, - uri2_y_, - uri3_y_, - uri4_y_, - uri5_y_, - uri2_1, - uri3_1, - uri4_1, - uri5_1, - uri0_cnn, - uri1_cnn, - uri2_cnn, - uri3_cnn, - uri4_cnn, - uri5_cnn, - ]); - - matches_always(perm_y_, [uri0_y_]); - matches_weak(perm_y_, [uri1_y_]); - matches_never(perm_y_, [ - uri2_y_, - uri3_y_, - uri4_y_, - uri5_y_, - uri0_n, - uri1_n, - uri2_n, - uri3_n, - uri4_n, - uri5_n, - uri0_1, - uri1_1, uri2_1, uri3_1, uri4_1, @@ -155,12 +112,6 @@ function run_test() { uri3_n, uri4_n, uri5_n, - uri0_y_, - uri1_y_, - uri2_y_, - uri3_y_, - uri4_y_, - uri5_y_, uri2_1, uri3_1, uri4_1, @@ -180,12 +131,6 @@ function run_test() { uri3_n, uri4_n, uri5_n, - uri0_y_, - uri1_y_, - uri2_y_, - uri3_y_, - uri4_y_, - uri5_y_, uri2_1, uri3_1, uri4_1, diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_10-11.js b/extensions/permissions/test/unit/test_permmanager_migrate_10-11.js index c0d30865ee..e7ebe09e03 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_10-11.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_10-11.js @@ -106,10 +106,10 @@ add_task(async function test() { ["https://foo.com", "storageAccessAPI^https://foo.com", 2, 0, 0, 0], ["http://foo.com", "storageAccessAPI^https://bar.com", 2, 0, 0, 0], ["http://foo.com", "storageAccessAPI^https://bar.com", 2, 0, 0, 0], - ["http://foo.com^inBrowser=1", "A", 2, 0, 0, 0], + ["http://foo.com", "A", 2, 0, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_11-12.js b/extensions/permissions/test/unit/test_permmanager_migrate_11-12.js index 97170a9240..b6ce96db0c 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_11-12.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_11-12.js @@ -139,7 +139,7 @@ add_task(async function test() { ["https://[::1]", "3rdPartyStorage^https://www.a.co.uk", 2, 0, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js b/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js index 857e0a462c..d9e09d810e 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js @@ -144,7 +144,6 @@ add_task(async function test() { // The http:// entries under foo.com won't be inserted, as there are history entries for foo.com, // and http://foo.com or a subdomain are never visited. // ["http://foo.com", "A", 1, 0, 0], - // ["http://foo.com^inBrowser=1", "A", 1, 0, 0], // // Because we search for port/scheme combinations under eTLD+1, we should not have http:// entries // for subdomains of foo.com either @@ -153,15 +152,14 @@ add_task(async function test() { ["https://foo.com", "A", 1, 0, 0], ["https://foo.com", "C", 1, 0, 0], - ["https://foo.com^inBrowser=1", "A", 1, 0, 0], ["https://sub.foo.com", "B", 1, 0, 0], ["https://subber.sub.foo.com", "B", 1, 0, 0], // bar.ca will have both http:// and https:// for all entries, because there are no associated history entries ["http://bar.ca", "B", 1, 0, 0], ["https://bar.ca", "B", 1, 0, 0], - ["http://bar.ca^inBrowser=1", "A", 1, 0, 0], - ["https://bar.ca^inBrowser=1", "A", 1, 0, 0], + ["http://bar.ca", "A", 1, 0, 0], + ["https://bar.ca", "A", 1, 0, 0], ["file:///some/path/to/file.html", "A", 1, 0, 0], ["file:///another/file.html", "A", 1, 0, 0], @@ -169,7 +167,6 @@ add_task(async function test() { // also have these entries ["ftp://foo.com:8000", "A", 1, 0, 0], ["ftp://foo.com:8000", "C", 1, 0, 0], - ["ftp://foo.com:8000^inBrowser=1", "A", 1, 0, 0], // In addition, because we search for port/scheme combinations under eTLD+1, we should have the // following entries @@ -185,7 +182,7 @@ add_task(async function test() { ["https://192.0.2.235", "A", 1, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js b/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js index ac40370a7e..cf30e591ac 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js @@ -178,21 +178,19 @@ add_task(function test() { let expected = [ ["http://foo.com", "A", 1, 0, 0], ["http://foo.com", "C", 1, 0, 0], - ["http://foo.com^inBrowser=1", "A", 1, 0, 0], ["http://sub.foo.com", "B", 1, 0, 0], ["http://subber.sub.foo.com", "B", 1, 0, 0], ["https://foo.com", "A", 1, 0, 0], ["https://foo.com", "C", 1, 0, 0], - ["https://foo.com^inBrowser=1", "A", 1, 0, 0], ["https://sub.foo.com", "B", 1, 0, 0], ["https://subber.sub.foo.com", "B", 1, 0, 0], // bar.ca will have both http:// and https:// for all entries, because there are no associated history entries ["http://bar.ca", "B", 1, 0, 0], ["https://bar.ca", "B", 1, 0, 0], - ["http://bar.ca^inBrowser=1", "A", 1, 0, 0], - ["https://bar.ca^inBrowser=1", "A", 1, 0, 0], + ["http://bar.ca", "A", 1, 0, 0], + ["https://bar.ca", "A", 1, 0, 0], ["file:///some/path/to/file.html", "A", 1, 0, 0], ["file:///another/file.html", "A", 1, 0, 0], @@ -203,7 +201,7 @@ add_task(function test() { ["https://127.0.0.1", "A", 1, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // This will force the permission-manager to reload the data. Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk"); diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js b/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js index 8ea03d5e16..2640d72120 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js @@ -211,7 +211,6 @@ add_task(async function test() { // The http:// entries under foo.com won't be inserted, as there are history entries for foo.com, // and http://foo.com or a subdomain are never visited. // ["http://foo.com", "A", 1, 0, 0], - // ["http://foo.com^inBrowser=1", "A", 1, 0, 0], // // Because we search for port/scheme combinations under eTLD+1, we should not have http:// entries // for subdomains of foo.com either @@ -220,15 +219,14 @@ add_task(async function test() { ["https://foo.com", "A", 1, 0, 0], ["https://foo.com", "C", 1, 0, 0], - ["https://foo.com^inBrowser=1", "A", 1, 0, 0], ["https://sub.foo.com", "B", 1, 0, 0], ["https://subber.sub.foo.com", "B", 1, 0, 0], // bar.ca will have both http:// and https:// for all entries, because there are no associated history entries ["http://bar.ca", "B", 1, 0, 0], ["https://bar.ca", "B", 1, 0, 0], - ["http://bar.ca^inBrowser=1", "A", 1, 0, 0], - ["https://bar.ca^inBrowser=1", "A", 1, 0, 0], + ["http://bar.ca", "A", 1, 0, 0], + ["https://bar.ca", "A", 1, 0, 0], ["file:///some/path/to/file.html", "A", 1, 0, 0], ["file:///another/file.html", "A", 1, 0, 0], @@ -236,7 +234,6 @@ add_task(async function test() { // also have these entries ["ftp://foo.com:8000", "A", 1, 0, 0], ["ftp://foo.com:8000", "C", 1, 0, 0], - ["ftp://foo.com:8000^inBrowser=1", "A", 1, 0, 0], // In addition, because we search for port/scheme combinations under eTLD+1, we should have the // following entries @@ -252,7 +249,7 @@ add_task(async function test() { ["https://192.0.2.235", "A", 1, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js b/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js index 8c330effa9..00273ed2a6 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js @@ -102,13 +102,12 @@ add_task(function test() { let expected = [ ["https://foo.com", "A", 2, 0, 0, 0], ["http://foo.com", "A", 2, 0, 0, 0], - ["http://foo.com^inBrowser=1", "A", 2, 0, 0, 0], ["http://127.0.0.1", "B", 2, 0, 0, 0], ["http://localhost", "B", 2, 0, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // This will force the permission-manager to reload the data. Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk"); diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js b/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js index 93b78e6478..efca3179c2 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js @@ -212,7 +212,6 @@ add_task(async function test() { // The http:// entries under foo.com won't be inserted, as there are history entries for foo.com, // and http://foo.com or a subdomain are never visited. // ["http://foo.com", "A", 1, 0, 0], - // ["http://foo.com^inBrowser=1", "A", 1, 0, 0], // // Because we search for port/scheme combinations under eTLD+1, we should not have http:// entries // for subdomains of foo.com either @@ -221,15 +220,14 @@ add_task(async function test() { ["https://foo.com", "A", 1, 0, 0], ["https://foo.com", "C", 1, 0, 0], - ["https://foo.com^inBrowser=1", "A", 1, 0, 0], ["https://sub.foo.com", "B", 1, 0, 0], ["https://subber.sub.foo.com", "B", 1, 0, 0], // bar.ca will have both http:// and https:// for all entries, because there are no associated history entries ["http://bar.ca", "B", 1, 0, 0], ["https://bar.ca", "B", 1, 0, 0], - ["http://bar.ca^inBrowser=1", "A", 1, 0, 0], - ["https://bar.ca^inBrowser=1", "A", 1, 0, 0], + ["http://bar.ca", "A", 1, 0, 0], + ["https://bar.ca", "A", 1, 0, 0], ["file:///some/path/to/file.html", "A", 1, 0, 0], ["file:///another/file.html", "A", 1, 0, 0], @@ -237,7 +235,6 @@ add_task(async function test() { // also have these entries ["ftp://foo.com:8000", "A", 1, 0, 0], ["ftp://foo.com:8000", "C", 1, 0, 0], - ["ftp://foo.com:8000^inBrowser=1", "A", 1, 0, 0], // In addition, because we search for port/scheme combinations under eTLD+1, we should have the // following entries @@ -253,7 +250,7 @@ add_task(async function test() { ["https://192.0.2.235", "A", 1, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js b/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js index feed156d29..a683db23af 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js @@ -101,10 +101,9 @@ add_task(function test() { let expected = [ ["https://foo.com", "A", 2, 0, 0, 0], ["http://foo.com", "A", 2, 0, 0, 0], - ["http://foo.com^inBrowser=1", "A", 2, 0, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // This will force the permission-manager to reload the data. Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk"); diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js b/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js index cd8b0f86cc..2ade2875b7 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js @@ -164,7 +164,7 @@ add_task(async function test() { let created7 = [ insertOrigin("https://foo.com", "A", 2, 0, 0, 0), insertOrigin("http://foo.com", "A", 2, 0, 0, 0), - insertOrigin("http://foo.com^inBrowser=1", "A", 2, 0, 0, 0), + insertOrigin("http://foo.com^inBrowser=1", "C", 2, 0, 0, 0), insertOrigin("https://192.0.2.235", "A", 2, 0, 0), ]; @@ -174,7 +174,7 @@ add_task(async function test() { insertHost("foo.com", "A", 1, 0, 0, 0, 0, false), insertHost("foo.com", "C", 1, 0, 0, 0, 0, false), insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false), - insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true), + insertHost("foo.com", "C", 1, 0, 0, 0, 2000, true), insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false), insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false), insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false), @@ -224,7 +224,7 @@ add_task(async function test() { // We should have kept the previously migrated entries ["https://foo.com", "A", 2, 0, 0, 0], ["http://foo.com", "A", 2, 0, 0, 0], - ["http://foo.com^inBrowser=1", "A", 2, 0, 0, 0], + ["http://foo.com", "C", 2, 0, 0, 0], // Make sure that we also support localhost, and IP addresses ["https://localhost:8080", "A", 1, 0, 0], @@ -238,7 +238,7 @@ add_task(async function test() { ["https://192.0.2.235", "A", 2, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( diff --git a/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js b/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js index 02aa3bb467..4e670c961c 100644 --- a/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js +++ b/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js @@ -172,10 +172,10 @@ add_task(async function test() { let expected = [ ["https://foo.com", "A", 2, 0, 0, 0], ["http://foo.com", "A", 2, 0, 0, 0], - ["http://foo.com^inBrowser=1", "A", 2, 0, 0, 0], + ["http://foo.com", "A", 2, 0, 0, 0], ]; - let found = expected.map(it => 0); + let found = expected.map(() => 0); // Add some places to the places database await PlacesTestUtils.addVisits( -- cgit v1.2.3