summaryrefslogtreecommitdiffstats
path: root/toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js')
-rw-r--r--toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js60
1 files changed, 59 insertions, 1 deletions
diff --git a/toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js b/toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js
index 29c7c9170b..ac4722fd84 100644
--- a/toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js
+++ b/toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingRemoteOverrides.js
@@ -1,6 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
"use strict";
@@ -20,6 +20,18 @@ const TARGET_CanvasRandomization = 0x000000100;
const TARGET_WindowOuterSize = 0x002000000;
const TARGET_Gamepad = 0x00800000;
+const TEST_PAGE =
+ getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.com"
+ ) + "empty.html";
+
+const TEST_ANOTHER_PAGE =
+ getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.net"
+ ) + "empty.html";
+
// A helper function to filter high 32 bits.
function extractLow32Bits(value) {
return value & 0xffffffff;
@@ -404,3 +416,49 @@ add_task(async function test_pref_override_remote_settings() {
db.clear();
});
+
+// Bug 1873682 - Verify that a third-party beacon request won't hit the
+// assertion in nsRFPService::GetOverriddenFingerprintingSettingsForChannel().
+add_task(async function test_beacon_request() {
+ // Open an empty page.
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE);
+
+ await SpecialPowers.spawn(
+ tab.linkedBrowser,
+ [TEST_ANOTHER_PAGE],
+ async url => {
+ // Create a third-party iframe
+ let ifr = content.document.createElement("iframe");
+
+ await new content.Promise(resolve => {
+ ifr.onload = resolve;
+ content.document.body.appendChild(ifr);
+ ifr.src = url;
+ });
+
+ await SpecialPowers.spawn(ifr, [url], url => {
+ // Sending the beacon request right before the tab navigates away.
+ content.addEventListener("unload", _ => {
+ let value = ["text"];
+ let blob = new Blob(value, {
+ type: "application/x-www-form-urlencoded",
+ });
+ content.navigator.sendBeacon(url, blob);
+ });
+ });
+
+ // Navigate the tab to another page.
+ content.location = url;
+ }
+ );
+
+ await BrowserTestUtils.browserLoaded(
+ tab.linkedBrowser,
+ false,
+ TEST_ANOTHER_PAGE
+ );
+
+ ok(true, "Successfully navigates away.");
+
+ BrowserTestUtils.removeTab(tab);
+});