Commits:
-
40d60a9e
by Fatih Kilic at 2025-09-30T13:22:00+00:00
Bug 1984333 - Spoof CPU cores to 4, or 8 if the machine has 8+ cores. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D261936
28 changed files:
Changes:
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_etp_iframes.js
| ... |
... |
@@ -10,7 +10,8 @@ |
|
10
|
10
|
|
|
11
|
11
|
"use strict";
|
|
12
|
12
|
|
|
13
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
13
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
14
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
14
|
15
|
|
|
15
|
16
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
16
|
17
|
|
| ... |
... |
@@ -27,6 +28,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
27
|
28
|
);
|
|
28
|
29
|
}
|
|
29
|
30
|
|
|
|
31
|
+add_setup(async function () {
|
|
|
32
|
+ registerCleanupFunction(async function () {
|
|
|
33
|
+ Services.prefs.clearUserPref(
|
|
|
34
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
35
|
+ );
|
|
|
36
|
+ });
|
|
|
37
|
+});
|
|
|
38
|
+
|
|
30
|
39
|
// The following are convenience objects that allow you to quickly see what is
|
|
31
|
40
|
// and is not modified from a logical set of values.
|
|
32
|
41
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutblank.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_aboutsrcdoc.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blob.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_blobcrossorigin.js
| ... |
... |
@@ -23,7 +23,8 @@ |
|
23
|
23
|
|
|
24
|
24
|
"use strict";
|
|
25
|
25
|
|
|
26
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
26
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
27
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
27
|
28
|
|
|
28
|
29
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
29
|
30
|
|
| ... |
... |
@@ -40,6 +41,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
40
|
41
|
);
|
|
41
|
42
|
}
|
|
42
|
43
|
|
|
|
44
|
+add_setup(async function () {
|
|
|
45
|
+ registerCleanupFunction(async function () {
|
|
|
46
|
+ Services.prefs.clearUserPref(
|
|
|
47
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
48
|
+ );
|
|
|
49
|
+ });
|
|
|
50
|
+});
|
|
|
51
|
+
|
|
43
|
52
|
// The following are convenience objects that allow you to quickly see what is
|
|
44
|
53
|
// and is not modified from a logical set of values.
|
|
45
|
54
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_data.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_iframes_sandboxediframe.js
| ... |
... |
@@ -20,7 +20,8 @@ |
|
20
|
20
|
|
|
21
|
21
|
"use strict";
|
|
22
|
22
|
|
|
23
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
23
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
24
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
24
|
25
|
|
|
25
|
26
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
26
|
27
|
|
| ... |
... |
@@ -37,6 +38,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
37
|
38
|
);
|
|
38
|
39
|
}
|
|
39
|
40
|
|
|
|
41
|
+add_setup(async function () {
|
|
|
42
|
+ registerCleanupFunction(async function () {
|
|
|
43
|
+ Services.prefs.clearUserPref(
|
|
|
44
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
45
|
+ );
|
|
|
46
|
+ });
|
|
|
47
|
+});
|
|
|
48
|
+
|
|
40
|
49
|
// The following are convenience objects that allow you to quickly see what is
|
|
41
|
50
|
// and is not modified from a logical set of values.
|
|
42
|
51
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups.js
| ... |
... |
@@ -16,7 +16,8 @@ |
|
16
|
16
|
|
|
17
|
17
|
"use strict";
|
|
18
|
18
|
|
|
19
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
19
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
20
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
20
|
21
|
|
|
21
|
22
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
22
|
23
|
|
| ... |
... |
@@ -33,6 +34,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
33
|
34
|
);
|
|
34
|
35
|
}
|
|
35
|
36
|
|
|
|
37
|
+add_setup(async function () {
|
|
|
38
|
+ registerCleanupFunction(async function () {
|
|
|
39
|
+ Services.prefs.clearUserPref(
|
|
|
40
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
41
|
+ );
|
|
|
42
|
+ });
|
|
|
43
|
+});
|
|
|
44
|
+
|
|
36
|
45
|
// The following are convenience objects that allow you to quickly see what is
|
|
37
|
46
|
// and is not modified from a logical set of values.
|
|
38
|
47
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_aboutblank.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_blob_noopener.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_data_noopener.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_hwconcurrency_popups_noopener.js
| ... |
... |
@@ -15,7 +15,8 @@ |
|
15
|
15
|
|
|
16
|
16
|
"use strict";
|
|
17
|
17
|
|
|
18
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
18
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
19
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
19
|
20
|
|
|
20
|
21
|
const DEFAULT_HARDWARE_CONCURRENCY = navigator.hardwareConcurrency;
|
|
21
|
22
|
|
| ... |
... |
@@ -32,6 +33,14 @@ async function testHWConcurrency(result, expectedResults, extraData) { |
|
32
|
33
|
);
|
|
33
|
34
|
}
|
|
34
|
35
|
|
|
|
36
|
+add_setup(async function () {
|
|
|
37
|
+ registerCleanupFunction(async function () {
|
|
|
38
|
+ Services.prefs.clearUserPref(
|
|
|
39
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
40
|
+ );
|
|
|
41
|
+ });
|
|
|
42
|
+});
|
|
|
43
|
+
|
|
35
|
44
|
// The following are convenience objects that allow you to quickly see what is
|
|
36
|
45
|
// and is not modified from a logical set of values.
|
|
37
|
46
|
// Be sure to always use `let expectedResults = structuredClone(allNotSpoofed)` to do a
|
browser/components/resistfingerprinting/test/browser/browser_navigator.js
| ... |
... |
@@ -88,7 +88,8 @@ const SPOOFED_UA_OS = { |
|
88
|
88
|
android: "Android 10; Mobile",
|
|
89
|
89
|
other: "X11; Linux x86_64",
|
|
90
|
90
|
};
|
|
91
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
91
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
92
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
92
|
93
|
|
|
93
|
94
|
const CONST_APPCODENAME = "Mozilla";
|
|
94
|
95
|
const CONST_APPNAME = "Netscape";
|
| ... |
... |
@@ -121,6 +122,12 @@ const SPOOFED_UA_GECKO_TRAIL = { |
|
121
|
122
|
|
|
122
|
123
|
add_setup(async () => {
|
|
123
|
124
|
DEFAULT_OSCPU.win = DEFAULT_UA_OS.win = await WindowsOscpuPromise;
|
|
|
125
|
+
|
|
|
126
|
+ registerCleanupFunction(async function () {
|
|
|
127
|
+ Services.prefs.clearUserPref(
|
|
|
128
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
129
|
+ );
|
|
|
130
|
+ });
|
|
124
|
131
|
});
|
|
125
|
132
|
|
|
126
|
133
|
async function testUserAgentHeader() {
|
browser/components/resistfingerprinting/test/browser/browser_navigator_iframes.js
| ... |
... |
@@ -103,7 +103,8 @@ const SPOOFED_UA_OS = { |
|
103
|
103
|
android: "Android 10; Mobile",
|
|
104
|
104
|
other: "X11; Linux x86_64",
|
|
105
|
105
|
};
|
|
106
|
|
-const SPOOFED_HW_CONCURRENCY = 2;
|
|
|
106
|
+const SPOOFED_HW_CONCURRENCY =
|
|
|
107
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
107
|
108
|
|
|
108
|
109
|
const CONST_APPCODENAME = "Mozilla";
|
|
109
|
110
|
const CONST_APPNAME = "Netscape";
|
| ... |
... |
@@ -306,6 +307,12 @@ add_setup(async () => { |
|
306
|
307
|
framer_crossOrigin_userAgentHTTPHeader: spoofedUserAgent,
|
|
307
|
308
|
framee_crossOrigin_userAgentHTTPHeader: spoofedUserAgent,
|
|
308
|
309
|
};
|
|
|
310
|
+
|
|
|
311
|
+ registerCleanupFunction(async function () {
|
|
|
312
|
+ Services.prefs.clearUserPref(
|
|
|
313
|
+ "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings"
|
|
|
314
|
+ );
|
|
|
315
|
+ });
|
|
309
|
316
|
});
|
|
310
|
317
|
|
|
311
|
318
|
const uri = `https://${FRAMER_DOMAIN}/browser/browser/components/resistfingerprinting/test/browser/file_navigator_iframer.html`;
|
browser/components/resistfingerprinting/test/browser/head.js
| ... |
... |
@@ -908,7 +908,7 @@ async function RFPPBMFPP_NormalMode_NoProtectionsTest( |
|
908
|
908
|
["privacy.fingerprintingProtection", true],
|
|
909
|
909
|
[
|
|
910
|
910
|
"privacy.fingerprintingProtection.overrides",
|
|
911
|
|
- "-NavigatorHWConcurrency,-CanvasRandomization",
|
|
|
911
|
+ "-NavigatorHWConcurrency,-NavigatorHWConcurrencyTiered,-CanvasRandomization",
|
|
912
|
912
|
],
|
|
913
|
913
|
].concat(extraPrefs || []),
|
|
914
|
914
|
});
|
dom/base/Navigator.cpp
| ... |
... |
@@ -690,7 +690,9 @@ uint64_t Navigator::HardwareConcurrency() { |
|
690
|
690
|
|
|
691
|
691
|
return rts->ClampedHardwareConcurrency(
|
|
692
|
692
|
nsGlobalWindowInner::Cast(mWindow)->ShouldResistFingerprinting(
|
|
693
|
|
- RFPTarget::NavigatorHWConcurrency));
|
|
|
693
|
+ RFPTarget::NavigatorHWConcurrency),
|
|
|
694
|
+ nsGlobalWindowInner::Cast(mWindow)->ShouldResistFingerprinting(
|
|
|
695
|
+ RFPTarget::NavigatorHWConcurrencyTiered));
|
|
694
|
696
|
}
|
|
695
|
697
|
|
|
696
|
698
|
namespace {
|
dom/base/test/test_navigator_hardwareConcurrency.html
| ... |
... |
@@ -19,8 +19,10 @@ |
|
19
|
19
|
SimpleTest.waitForExplicitFinish();
|
|
20
|
20
|
|
|
21
|
21
|
resistFingerprinting(true).then(() => {
|
|
|
22
|
+ const expected = SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
|
23
|
+
|
|
22
|
24
|
const y = navigator.hardwareConcurrency;
|
|
23
|
|
- ok(y === 2, "hardwareConcurrency should always be 2 when we're resisting fingerprinting.");
|
|
|
25
|
+ ok(y === expected, "hardwareConcurrency should always be 2 when we're resisting fingerprinting.");
|
|
24
|
26
|
|
|
25
|
27
|
resistFingerprinting(false).then(() => {
|
|
26
|
28
|
const z = navigator.hardwareConcurrency;
|
dom/workers/RuntimeService.cpp
| ... |
... |
@@ -1980,13 +1980,18 @@ void RuntimeService::MemoryPressureAllWorkers() { |
|
1980
|
1980
|
BroadcastAllWorkers([](auto& worker) { worker.MemoryPressure(); });
|
|
1981
|
1981
|
}
|
|
1982
|
1982
|
|
|
1983
|
|
-uint32_t RuntimeService::ClampedHardwareConcurrency(
|
|
1984
|
|
- bool aShouldResistFingerprinting) const {
|
|
1985
|
|
- // The Firefox Hardware Report says 70% of Firefox users have exactly 2 cores.
|
|
|
1983
|
+uint32_t RuntimeService::ClampedHardwareConcurrency(bool aRFPHardcoded,
|
|
|
1984
|
+ bool aRFPTiered) const {
|
|
|
1985
|
+ // The Firefox Hardware Report says 34% of Firefox users have exactly 4 cores.
|
|
1986
|
1986
|
// When the resistFingerprinting pref is set, we want to blend into the crowd
|
|
1987
|
|
- // so spoof navigator.hardwareConcurrency = 2 to reduce user uniqueness.
|
|
1988
|
|
- if (MOZ_UNLIKELY(aShouldResistFingerprinting)) {
|
|
1989
|
|
- return 2;
|
|
|
1987
|
+ // so spoof navigator.hardwareConcurrency = 4 to reduce user uniqueness. On
|
|
|
1988
|
+ // OSX, the majority of Macs have 8 cores.
|
|
|
1989
|
+ if (MOZ_UNLIKELY(aRFPHardcoded)) {
|
|
|
1990
|
+#ifdef XP_MACOSX
|
|
|
1991
|
+ return 8;
|
|
|
1992
|
+#else
|
|
|
1993
|
+ return 4;
|
|
|
1994
|
+#endif
|
|
1990
|
1995
|
}
|
|
1991
|
1996
|
|
|
1992
|
1997
|
// This needs to be atomic, because multiple workers, and even mainthread,
|
| ... |
... |
@@ -2014,6 +2019,13 @@ uint32_t RuntimeService::ClampedHardwareConcurrency( |
|
2014
|
2019
|
numberOfProcessors);
|
|
2015
|
2020
|
}
|
|
2016
|
2021
|
|
|
|
2022
|
+ if (MOZ_UNLIKELY(aRFPTiered)) {
|
|
|
2023
|
+ if (unclampedHardwareConcurrency >= 8) {
|
|
|
2024
|
+ return 8;
|
|
|
2025
|
+ }
|
|
|
2026
|
+ return 4;
|
|
|
2027
|
+ }
|
|
|
2028
|
+
|
|
2017
|
2029
|
return std::min(uint32_t(unclampedHardwareConcurrency),
|
|
2018
|
2030
|
StaticPrefs::dom_maxHardwareConcurrency());
|
|
2019
|
2031
|
}
|
dom/workers/RuntimeService.h
| ... |
... |
@@ -164,7 +164,8 @@ class RuntimeService final : public nsIObserver { |
|
164
|
164
|
|
|
165
|
165
|
void MemoryPressureAllWorkers();
|
|
166
|
166
|
|
|
167
|
|
- uint32_t ClampedHardwareConcurrency(bool aShouldResistFingerprinting) const;
|
|
|
167
|
+ uint32_t ClampedHardwareConcurrency(bool aRFPHardcoded,
|
|
|
168
|
+ bool aRFPTiered) const;
|
|
168
|
169
|
|
|
169
|
170
|
void CrashIfHanging();
|
|
170
|
171
|
|
dom/workers/WorkerNavigator.cpp
| ... |
... |
@@ -222,10 +222,12 @@ uint64_t WorkerNavigator::HardwareConcurrency() const { |
|
222
|
222
|
MOZ_ASSERT(rts);
|
|
223
|
223
|
|
|
224
|
224
|
WorkerPrivate* aWorkerPrivate = GetCurrentThreadWorkerPrivate();
|
|
225
|
|
- bool rfp = aWorkerPrivate->ShouldResistFingerprinting(
|
|
226
|
|
- RFPTarget::NavigatorHWConcurrency);
|
|
227
|
225
|
|
|
228
|
|
- return rts->ClampedHardwareConcurrency(rfp);
|
|
|
226
|
+ return rts->ClampedHardwareConcurrency(
|
|
|
227
|
+ aWorkerPrivate->ShouldResistFingerprinting(
|
|
|
228
|
+ RFPTarget::NavigatorHWConcurrency),
|
|
|
229
|
+ aWorkerPrivate->ShouldResistFingerprinting(
|
|
|
230
|
+ RFPTarget::NavigatorHWConcurrencyTiered));
|
|
229
|
231
|
}
|
|
230
|
232
|
|
|
231
|
233
|
StorageManager* WorkerNavigator::Storage() {
|
dom/workers/test/test_navigator_workers_hardwareConcurrency.html
| ... |
... |
@@ -31,8 +31,9 @@ |
|
31
|
31
|
resistFingerprinting(true).then(() => {
|
|
32
|
32
|
ok(true, "resistFingerprinting(true) resolved.");
|
|
33
|
33
|
getWorkerHardwareConcurrency(msg => {
|
|
|
34
|
+ const expected = SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
34
|
35
|
const y = msg.data;
|
|
35
|
|
- ok(y === 2, "hardwareConcurrency should always be 2 when we're resisting fingerprinting.");
|
|
|
36
|
+ ok(y === expected, "hardwareConcurrency should always be 2 when we're resisting fingerprinting.");
|
|
36
|
37
|
|
|
37
|
38
|
resistFingerprinting(false).then(() => {
|
|
38
|
39
|
ok(true, "resistFingerprinting(false) resolved.");
|
toolkit/components/resistfingerprinting/RFPTargets.inc
| ... |
... |
@@ -102,6 +102,7 @@ ITEM_VALUE(ScreenAvailToResolution, 68) |
|
102
|
102
|
ITEM_VALUE(UseHardcodedFontSubstitutes, 69)
|
|
103
|
103
|
ITEM_VALUE(DiskStorageLimit, 70)
|
|
104
|
104
|
ITEM_VALUE(WebCodecs, 71)
|
|
|
105
|
+ITEM_VALUE(NavigatorHWConcurrencyTiered,74)
|
|
105
|
106
|
|
|
106
|
107
|
|
|
107
|
108
|
// !!! Don't forget to update kDefaultFingerprintingProtections in nsRFPService.cpp
|
toolkit/components/resistfingerprinting/RFPTargetsDefault.inc
| ... |
... |
@@ -6,7 +6,9 @@ |
|
6
|
6
|
DESKTOP_DEFAULT(CanvasRandomization)
|
|
7
|
7
|
DESKTOP_DEFAULT(FontVisibilityLangPack)
|
|
8
|
8
|
DESKTOP_DEFAULT(JSMathFdlibm)
|
|
|
9
|
+DESKTOP_DEFAULT(NavigatorHWConcurrencyTiered)
|
|
9
|
10
|
|
|
10
|
11
|
ANDROID_DEFAULT(CanvasRandomization)
|
|
11
|
12
|
ANDROID_DEFAULT(FontVisibilityLangPack)
|
|
12
|
13
|
ANDROID_DEFAULT(JSMathFdlibm)
|
|
|
14
|
+ANDROID_DEFAULT(NavigatorHWConcurrencyTiered) |
toolkit/components/resistfingerprinting/tests/browser/browser_fpiServiceWorkers_fingerprinting.js
| ... |
... |
@@ -44,7 +44,8 @@ runTestInFirstAndThirdPartyContexts( |
|
44
|
44
|
);
|
|
45
|
45
|
},
|
|
46
|
46
|
async win => {
|
|
47
|
|
- let SPOOFED_HW_CONCURRENCY = 2;
|
|
|
47
|
+ let SPOOFED_HW_CONCURRENCY =
|
|
|
48
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
48
|
49
|
|
|
49
|
50
|
// Register service worker for the third-party window.
|
|
50
|
51
|
if (!win.sw) {
|
toolkit/components/resistfingerprinting/tests/browser/browser_serviceWorker_fingerprinting_webcompat.js
| ... |
... |
@@ -7,7 +7,8 @@ |
|
7
|
7
|
runTestInFirstAndThirdPartyContexts(
|
|
8
|
8
|
"ServiceWorkers - Ensure the fingerprinting WebCompat overrides the fingerprinting protection in third-party context.",
|
|
9
|
9
|
async win => {
|
|
10
|
|
- let SPOOFED_HW_CONCURRENCY = 2;
|
|
|
10
|
+ let SPOOFED_HW_CONCURRENCY =
|
|
|
11
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
11
|
12
|
|
|
12
|
13
|
// Register service worker for the first-party window.
|
|
13
|
14
|
if (!win.sw) {
|
| ... |
... |
@@ -90,7 +91,8 @@ runTestInFirstAndThirdPartyContexts( |
|
90
|
91
|
runTestInFirstAndThirdPartyContexts(
|
|
91
|
92
|
"ServiceWorkers - Ensure the fingerprinting WebCompat overrides the fingerprinting protection in third-party context with FPI enabled.",
|
|
92
|
93
|
async win => {
|
|
93
|
|
- let SPOOFED_HW_CONCURRENCY = 2;
|
|
|
94
|
+ let SPOOFED_HW_CONCURRENCY =
|
|
|
95
|
+ SpecialPowers.Services.appinfo.OS == "Darwin" ? 8 : 4;
|
|
94
|
96
|
|
|
95
|
97
|
// Register service worker for the first-party window.
|
|
96
|
98
|
if (!win.sw) {
|
|