Commits:
-
bb922d4c
by Fatih at 2024-09-02T10:35:36+02:00
Bug 1885101: Match screen and window properties with top window for ScreenRect, ScreenAvailRect and WindowOuterSize. r=timhuang,emilio
This patch removes test_iframe.html. We remove it because the newly introduced test covers the tests done in that test. The reason for removing it in the first place is now that screen properties are inherited/spoofed xorigin, we get a 4px difference. The reasosn for 4px difference is the test runner runs tests in an iframe with a 2px border on each side.
Differential Revision: https://phabricator.services.mozilla.com/D215509
12 changed files:
Changes:
browser/components/resistfingerprinting/test/mochitest/mochitest.toml
... |
... |
@@ -27,8 +27,6 @@ scheme = "https" |
27
|
27
|
scheme = "https"
|
28
|
28
|
support-files = ["test_hide_gamepad_info_iframe.html"]
|
29
|
29
|
|
30
|
|
-["test_iframe.html"]
|
31
|
|
-
|
32
|
30
|
["test_keyboard_event.html"]
|
33
|
31
|
|
34
|
32
|
["test_pointer_event.html"]
|
... |
... |
@@ -36,3 +34,5 @@ support-files = ["../../../../../dom/events/test/pointerevents/mochitest_support |
36
|
34
|
|
37
|
35
|
["test_speech_synthesis.html"]
|
38
|
36
|
skip-if = ["verify"]
|
|
37
|
+
|
|
38
|
+["test_bug1885101_screenwindow_sizes.html"] |
browser/components/resistfingerprinting/test/mochitest/test_bug1885101_screenwindow_sizes.html
|
1
|
+<!DOCTYPE html>
|
|
2
|
+<html>
|
|
3
|
+ <head>
|
|
4
|
+ <title>Tests if +WindowOuterSizeExceptIFrame works properly</title>
|
|
5
|
+ <link rel="stylesheet" type="text/css" href="">"/tests/SimpleTest/test.css" />
|
|
6
|
+ <script src="">"/tests/SimpleTest/SimpleTest.js"></script>
|
|
7
|
+ </head>
|
|
8
|
+
|
|
9
|
+ <body>
|
|
10
|
+ <iframe id="mainFrame"></iframe>
|
|
11
|
+
|
|
12
|
+ <template id="mainFrameContents">
|
|
13
|
+ <script>
|
|
14
|
+ window.parent.postMessage(
|
|
15
|
+ {
|
|
16
|
+ screen: {
|
|
17
|
+ height: window.screen.height,
|
|
18
|
+ width: window.screen.width,
|
|
19
|
+ availHeight: window.screen.availHeight,
|
|
20
|
+ availWidth: window.screen.availWidth,
|
|
21
|
+ },
|
|
22
|
+ outerHeight,
|
|
23
|
+ outerWidth,
|
|
24
|
+ },
|
|
25
|
+ "*"
|
|
26
|
+ );
|
|
27
|
+ </script>
|
|
28
|
+ </template>
|
|
29
|
+
|
|
30
|
+ <script>
|
|
31
|
+ document.addEventListener("DOMContentLoaded", function () {
|
|
32
|
+ SimpleTest.waitForExplicitFinish();
|
|
33
|
+
|
|
34
|
+ window.addEventListener("message", e => {
|
|
35
|
+ const data = e.data;
|
|
36
|
+
|
|
37
|
+ // Check for outer size
|
|
38
|
+ SimpleTest.is(
|
|
39
|
+ data.outerHeight,
|
|
40
|
+ window.outerHeight,
|
|
41
|
+ "iframe's window.outerHeight should be equal to window.top.outerHeight"
|
|
42
|
+ );
|
|
43
|
+
|
|
44
|
+ SimpleTest.is(
|
|
45
|
+ data.outerWidth,
|
|
46
|
+ window.outerWidth,
|
|
47
|
+ "iframe's window.outerWidth should be equal to window.top.outerWidth"
|
|
48
|
+ );
|
|
49
|
+
|
|
50
|
+ // Check for screen size
|
|
51
|
+ SimpleTest.is(
|
|
52
|
+ data.screen.height,
|
|
53
|
+ window.screen.height,
|
|
54
|
+ "iframe's window.screen.height should be equal to window.top.screen.height"
|
|
55
|
+ );
|
|
56
|
+
|
|
57
|
+ SimpleTest.is(
|
|
58
|
+ data.screen.width,
|
|
59
|
+ window.screen.width,
|
|
60
|
+ "iframe's window.screen.width should be equal to window.top.screen.width"
|
|
61
|
+ );
|
|
62
|
+
|
|
63
|
+ // Check for avail size
|
|
64
|
+ SimpleTest.is(
|
|
65
|
+ data.screen.availHeight,
|
|
66
|
+ window.screen.availHeight,
|
|
67
|
+ "iframe's window.screen.availHeight should be equal to window.top.screen.availHeight"
|
|
68
|
+ );
|
|
69
|
+
|
|
70
|
+ SimpleTest.is(
|
|
71
|
+ data.screen.availWidth,
|
|
72
|
+ window.screen.availWidth,
|
|
73
|
+ "iframe's window.screen.availWidth should be equal to window.top.screen.availWidth"
|
|
74
|
+ );
|
|
75
|
+
|
|
76
|
+ SimpleTest.finish();
|
|
77
|
+ });
|
|
78
|
+
|
|
79
|
+ function setFrameSource() {
|
|
80
|
+ const frame = document.getElementById("mainFrame");
|
|
81
|
+ const template = document.getElementById("mainFrameContents");
|
|
82
|
+ frame.srcdoc = template.innerHTML;
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ SpecialPowers.pushPrefEnv(
|
|
86
|
+ {
|
|
87
|
+ set: [
|
|
88
|
+ ["privacy.fingerprintingProtection", true],
|
|
89
|
+ [
|
|
90
|
+ "privacy.fingerprintingProtection.overrides",
|
|
91
|
+ "+WindowOuterSize,+ScreenRect,+ScreenAvailRect",
|
|
92
|
+ ],
|
|
93
|
+ ],
|
|
94
|
+ },
|
|
95
|
+ () => setFrameSource()
|
|
96
|
+ );
|
|
97
|
+ });
|
|
98
|
+ </script>
|
|
99
|
+ </body>
|
|
100
|
+</html> |
browser/components/resistfingerprinting/test/mochitest/test_iframe.html
deleted
1
|
|
-<!doctype html>
|
2
|
|
-<script src="">"/tests/SimpleTest/SimpleTest.js"></script>
|
3
|
|
-<link rel="stylesheet" href="">"/tests/SimpleTest/test.css"/>
|
4
|
|
-<body>
|
5
|
|
-<script>
|
6
|
|
- add_task(async function() {
|
7
|
|
- await SpecialPowers.pushPrefEnv({
|
8
|
|
- "set": [["privacy.resistFingerprinting", true]],
|
9
|
|
- });
|
10
|
|
- is(screen.width, window.innerWidth, "Width should be spoofed");
|
11
|
|
- is(screen.height, window.innerHeight, "Height should be spoofed");
|
12
|
|
- let iframe = document.createElement("iframe");
|
13
|
|
- document.body.appendChild(iframe);
|
14
|
|
- is(iframe.contentWindow.screen.width, iframe.contentWindow.innerWidth, "Width should be spoofed in iframe");
|
15
|
|
- is(iframe.contentWindow.screen.height, iframe.contentWindow.innerHeight, "Height should be spoofed in iframe");
|
16
|
|
- });
|
17
|
|
-</script>
|
18
|
|
-</body> |
docshell/base/BrowsingContext.h
... |
... |
@@ -272,7 +272,10 @@ struct EmbedderColorSchemes { |
272
|
272
|
/* If true, this browsing context is within a hidden embedded document. */ \
|
273
|
273
|
FIELD(IsUnderHiddenEmbedderElement, bool) \
|
274
|
274
|
/* If true, this browsing context is offline */ \
|
275
|
|
- FIELD(ForceOffline, bool)
|
|
275
|
+ FIELD(ForceOffline, bool) \
|
|
276
|
+ /* Used to propagate window.top's inner size for RFPTarget::Window* \
|
|
277
|
+ * protections */ \
|
|
278
|
+ FIELD(TopInnerSizeForRFP, CSSIntSize)
|
276
|
279
|
|
277
|
280
|
// BrowsingContext, in this context, is the cross process replicated
|
278
|
281
|
// environment in which information about documents is stored. In
|
... |
... |
@@ -1253,6 +1256,10 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { |
1253
|
1256
|
bool CanSet(FieldIndex<IDX_ForceOffline>, bool aNewValue,
|
1254
|
1257
|
ContentParent* aSource);
|
1255
|
1258
|
|
|
1259
|
+ bool CanSet(FieldIndex<IDX_TopInnerSizeForRFP>, bool, ContentParent*) {
|
|
1260
|
+ return IsTop();
|
|
1261
|
+ }
|
|
1262
|
+
|
1256
|
1263
|
bool CanSet(FieldIndex<IDX_EmbeddedInContentDocument>, bool,
|
1257
|
1264
|
ContentParent* aSource) {
|
1258
|
1265
|
return CheckOnlyEmbedderCanSet(aSource);
|
docshell/base/CanonicalBrowsingContext.cpp
... |
... |
@@ -324,6 +324,7 @@ void CanonicalBrowsingContext::ReplacedBy( |
324
|
324
|
txn.SetHasRestoreData(GetHasRestoreData());
|
325
|
325
|
txn.SetShouldDelayMediaFromStart(GetShouldDelayMediaFromStart());
|
326
|
326
|
txn.SetForceOffline(GetForceOffline());
|
|
327
|
+ txn.SetTopInnerSizeForRFP(GetTopInnerSizeForRFP());
|
327
|
328
|
|
328
|
329
|
// Propagate some settings on BrowsingContext replacement so they're not lost
|
329
|
330
|
// on bfcached navigations. These are important for GeckoView (see bug
|
dom/base/nsGlobalWindowOuter.cpp
... |
... |
@@ -3513,9 +3513,10 @@ CSSIntSize nsGlobalWindowOuter::GetOuterSize(CallerType aCallerType, |
3513
|
3513
|
ErrorResult& aError) {
|
3514
|
3514
|
if (nsIGlobalObject::ShouldResistFingerprinting(aCallerType,
|
3515
|
3515
|
RFPTarget::WindowOuterSize)) {
|
3516
|
|
- CSSSize size;
|
3517
|
|
- aError = GetInnerSize(size);
|
3518
|
|
- return RoundedToInt(size);
|
|
3516
|
+ if (BrowsingContext* bc = GetBrowsingContext()) {
|
|
3517
|
+ return bc->Top()->GetTopInnerSizeForRFP();
|
|
3518
|
+ }
|
|
3519
|
+ return {};
|
3519
|
3520
|
}
|
3520
|
3521
|
|
3521
|
3522
|
// Windows showing documents in RDM panes and any subframes within them
|
dom/base/nsScreen.cpp
... |
... |
@@ -62,7 +62,7 @@ nsDeviceContext* nsScreen::GetDeviceContext() const { |
62
|
62
|
CSSIntRect nsScreen::GetRect() {
|
63
|
63
|
// Return window inner rect to prevent fingerprinting.
|
64
|
64
|
if (ShouldResistFingerprinting(RFPTarget::ScreenRect)) {
|
65
|
|
- return GetWindowInnerRect();
|
|
65
|
+ return GetTopWindowInnerRectForRFP();
|
66
|
66
|
}
|
67
|
67
|
|
68
|
68
|
// Here we manipulate the value of aRect to represent the screen size,
|
... |
... |
@@ -91,7 +91,7 @@ CSSIntRect nsScreen::GetRect() { |
91
|
91
|
CSSIntRect nsScreen::GetAvailRect() {
|
92
|
92
|
// Return window inner rect to prevent fingerprinting.
|
93
|
93
|
if (ShouldResistFingerprinting(RFPTarget::ScreenAvailRect)) {
|
94
|
|
- return GetWindowInnerRect();
|
|
94
|
+ return GetTopWindowInnerRectForRFP();
|
95
|
95
|
}
|
96
|
96
|
|
97
|
97
|
// Here we manipulate the value of aRect to represent the screen size,
|
... |
... |
@@ -165,18 +165,14 @@ JSObject* nsScreen::WrapObject(JSContext* aCx, |
165
|
165
|
return Screen_Binding::Wrap(aCx, this, aGivenProto);
|
166
|
166
|
}
|
167
|
167
|
|
168
|
|
-CSSIntRect nsScreen::GetWindowInnerRect() {
|
169
|
|
- nsCOMPtr<nsPIDOMWindowInner> win = GetOwner();
|
170
|
|
- if (!win) {
|
171
|
|
- return {};
|
172
|
|
- }
|
173
|
|
- double width;
|
174
|
|
- double height;
|
175
|
|
- if (NS_FAILED(win->GetInnerWidth(&width)) ||
|
176
|
|
- NS_FAILED(win->GetInnerHeight(&height))) {
|
177
|
|
- return {};
|
|
168
|
+CSSIntRect nsScreen::GetTopWindowInnerRectForRFP() {
|
|
169
|
+ if (nsPIDOMWindowInner* inner = GetOwner()) {
|
|
170
|
+ if (BrowsingContext* bc = inner->GetBrowsingContext()) {
|
|
171
|
+ CSSIntSize size = bc->Top()->GetTopInnerSizeForRFP();
|
|
172
|
+ return {0, 0, size.width, size.height};
|
|
173
|
+ }
|
178
|
174
|
}
|
179
|
|
- return {0, 0, int32_t(std::round(width)), int32_t(std::round(height))};
|
|
175
|
+ return {};
|
180
|
176
|
}
|
181
|
177
|
|
182
|
178
|
bool nsScreen::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
dom/base/nsScreen.h
... |
... |
@@ -88,7 +88,7 @@ class nsScreen : public mozilla::DOMEventTargetHelper { |
88
|
88
|
nsDeviceContext* GetDeviceContext() const;
|
89
|
89
|
mozilla::CSSIntRect GetRect();
|
90
|
90
|
mozilla::CSSIntRect GetAvailRect();
|
91
|
|
- mozilla::CSSIntRect GetWindowInnerRect();
|
|
91
|
+ mozilla::CSSIntRect GetTopWindowInnerRectForRFP();
|
92
|
92
|
|
93
|
93
|
private:
|
94
|
94
|
virtual ~nsScreen();
|
dom/base/test/chrome/bug418986-1.js
... |
... |
@@ -24,14 +24,14 @@ var test = function (isContent) { |
24
|
24
|
["mozInnerScreenY", 0],
|
25
|
25
|
["screen.pixelDepth", 24],
|
26
|
26
|
["screen.colorDepth", 24],
|
27
|
|
- ["screen.availWidth", "innerWidth"],
|
28
|
|
- ["screen.availHeight", "innerHeight"],
|
|
27
|
+ ["screen.availWidth", "outerWidth"],
|
|
28
|
+ ["screen.availHeight", "outerHeight"],
|
29
|
29
|
["screen.left", 0],
|
30
|
30
|
["screen.top", 0],
|
31
|
31
|
["screen.availLeft", 0],
|
32
|
32
|
["screen.availTop", 0],
|
33
|
|
- ["screen.width", "innerWidth"],
|
34
|
|
- ["screen.height", "innerHeight"],
|
|
33
|
+ ["screen.width", "outerWidth"],
|
|
34
|
+ ["screen.height", "outerHeight"],
|
35
|
35
|
["screen.orientation.type", "'landscape-primary'"],
|
36
|
36
|
["screen.orientation.angle", 0],
|
37
|
37
|
["screen.mozOrientation", "'landscape-primary'"],
|
layout/base/nsPresContext.cpp
... |
... |
@@ -1459,6 +1459,32 @@ void nsPresContext::SetOverrideDPPX(float aDPPX) { |
1459
|
1459
|
MediaFeatureChangePropagation::JustThisDocument);
|
1460
|
1460
|
}
|
1461
|
1461
|
|
|
1462
|
+void nsPresContext::UpdateTopInnerSizeForRFP() {
|
|
1463
|
+ if (!mDocument->ShouldResistFingerprinting(RFPTarget::WindowOuterSize) ||
|
|
1464
|
+ !mDocument->GetBrowsingContext() ||
|
|
1465
|
+ !mDocument->GetBrowsingContext()->IsTop()) {
|
|
1466
|
+ return;
|
|
1467
|
+ }
|
|
1468
|
+
|
|
1469
|
+ CSSSize size = CSSPixel::FromAppUnits(GetVisibleArea().Size());
|
|
1470
|
+
|
|
1471
|
+ switch (StaticPrefs::dom_innerSize_rounding()) {
|
|
1472
|
+ case 1:
|
|
1473
|
+ size.width = std::roundf(size.width);
|
|
1474
|
+ size.height = std::roundf(size.height);
|
|
1475
|
+ break;
|
|
1476
|
+ case 2:
|
|
1477
|
+ size.width = std::truncf(size.width);
|
|
1478
|
+ size.height = std::truncf(size.height);
|
|
1479
|
+ break;
|
|
1480
|
+ default:
|
|
1481
|
+ break;
|
|
1482
|
+ }
|
|
1483
|
+
|
|
1484
|
+ Unused << mDocument->GetBrowsingContext()->SetTopInnerSizeForRFP(
|
|
1485
|
+ CSSIntSize{(int)size.width, (int)size.height});
|
|
1486
|
+}
|
|
1487
|
+
|
1462
|
1488
|
gfxSize nsPresContext::ScreenSizeInchesForFontInflation(bool* aChanged) {
|
1463
|
1489
|
if (aChanged) {
|
1464
|
1490
|
*aChanged = false;
|
... |
... |
@@ -2972,6 +2998,8 @@ void nsPresContext::SetVisibleArea(const nsRect& r) { |
2972
|
2998
|
{mozilla::MediaFeatureChangeReason::ViewportChange},
|
2973
|
2999
|
MediaFeatureChangePropagation::JustThisDocument);
|
2974
|
3000
|
}
|
|
3001
|
+
|
|
3002
|
+ UpdateTopInnerSizeForRFP();
|
2975
|
3003
|
}
|
2976
|
3004
|
}
|
2977
|
3005
|
|
layout/base/nsPresContext.h
... |
... |
@@ -540,6 +540,7 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { |
540
|
540
|
void SetFullZoom(float aZoom);
|
541
|
541
|
void SetOverrideDPPX(float);
|
542
|
542
|
void SetInRDMPane(bool aInRDMPane);
|
|
543
|
+ void UpdateTopInnerSizeForRFP();
|
543
|
544
|
|
544
|
545
|
public:
|
545
|
546
|
float GetFullZoom() { return mFullZoom; }
|
toolkit/components/resistfingerprinting/tests/browser/browser_fingerprintingWebCompat.js
... |
... |
@@ -34,12 +34,12 @@ const TEST_CASES = [ |
34
|
34
|
{
|
35
|
35
|
id: "1",
|
36
|
36
|
last_modified: 1000000000000001,
|
37
|
|
- overrides: "+WindowOuterSize",
|
|
37
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
38
|
38
|
firstPartyDomain: "*",
|
39
|
39
|
},
|
40
|
40
|
],
|
41
|
41
|
expects: {
|
42
|
|
- windowOuter: {
|
|
42
|
+ screenAvailRect: {
|
43
|
43
|
top: true,
|
44
|
44
|
firstParty: true,
|
45
|
45
|
thirdParty: true,
|
... |
... |
@@ -57,12 +57,12 @@ const TEST_CASES = [ |
57
|
57
|
{
|
58
|
58
|
id: "1",
|
59
|
59
|
last_modified: 1000000000000001,
|
60
|
|
- overrides: "+WindowOuterSize",
|
|
60
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
61
|
61
|
firstPartyDomain: "example.com",
|
62
|
62
|
},
|
63
|
63
|
],
|
64
|
64
|
expects: {
|
65
|
|
- windowOuter: {
|
|
65
|
+ screenAvailRect: {
|
66
|
66
|
top: true,
|
67
|
67
|
firstParty: true,
|
68
|
68
|
thirdParty: false,
|
... |
... |
@@ -80,13 +80,13 @@ const TEST_CASES = [ |
80
|
80
|
{
|
81
|
81
|
id: "1",
|
82
|
82
|
last_modified: 1000000000000001,
|
83
|
|
- overrides: "+WindowOuterSize",
|
|
83
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
84
|
84
|
firstPartyDomain: "example.com",
|
85
|
85
|
thirdPartyDomain: "*",
|
86
|
86
|
},
|
87
|
87
|
],
|
88
|
88
|
expects: {
|
89
|
|
- windowOuter: {
|
|
89
|
+ screenAvailRect: {
|
90
|
90
|
top: true,
|
91
|
91
|
firstParty: true,
|
92
|
92
|
thirdParty: true,
|
... |
... |
@@ -104,13 +104,13 @@ const TEST_CASES = [ |
104
|
104
|
{
|
105
|
105
|
id: "1",
|
106
|
106
|
last_modified: 1000000000000001,
|
107
|
|
- overrides: "+WindowOuterSize",
|
|
107
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
108
|
108
|
firstPartyDomain: "example.com",
|
109
|
109
|
thirdPartyDomain: "example.org",
|
110
|
110
|
},
|
111
|
111
|
],
|
112
|
112
|
expects: {
|
113
|
|
- windowOuter: {
|
|
113
|
+ screenAvailRect: {
|
114
|
114
|
top: false,
|
115
|
115
|
firstParty: false,
|
116
|
116
|
thirdParty: true,
|
... |
... |
@@ -128,13 +128,13 @@ const TEST_CASES = [ |
128
|
128
|
{
|
129
|
129
|
id: "1",
|
130
|
130
|
last_modified: 1000000000000001,
|
131
|
|
- overrides: "+WindowOuterSize",
|
|
131
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
132
|
132
|
firstPartyDomain: "*",
|
133
|
133
|
thirdPartyDomain: "example.org",
|
134
|
134
|
},
|
135
|
135
|
],
|
136
|
136
|
expects: {
|
137
|
|
- windowOuter: {
|
|
137
|
+ screenAvailRect: {
|
138
|
138
|
top: false,
|
139
|
139
|
firstParty: false,
|
140
|
140
|
thirdParty: true,
|
... |
... |
@@ -153,12 +153,12 @@ const TEST_CASES = [ |
153
|
153
|
{
|
154
|
154
|
id: "1",
|
155
|
155
|
last_modified: 1000000000000001,
|
156
|
|
- overrides: "+WindowOuterSize",
|
|
156
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
157
|
157
|
firstPartyDomain: "example.net",
|
158
|
158
|
},
|
159
|
159
|
],
|
160
|
160
|
expects: {
|
161
|
|
- windowOuter: {
|
|
161
|
+ screenAvailRect: {
|
162
|
162
|
top: false,
|
163
|
163
|
firstParty: false,
|
164
|
164
|
thirdParty: false,
|
... |
... |
@@ -177,13 +177,13 @@ const TEST_CASES = [ |
177
|
177
|
{
|
178
|
178
|
id: "1",
|
179
|
179
|
last_modified: 1000000000000001,
|
180
|
|
- overrides: "+WindowOuterSize",
|
|
180
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
181
|
181
|
firstPartyDomain: "example.net",
|
182
|
182
|
thirdPartyDomain: "*",
|
183
|
183
|
},
|
184
|
184
|
],
|
185
|
185
|
expects: {
|
186
|
|
- windowOuter: {
|
|
186
|
+ screenAvailRect: {
|
187
|
187
|
top: false,
|
188
|
188
|
firstParty: false,
|
189
|
189
|
thirdParty: false,
|
... |
... |
@@ -202,13 +202,13 @@ const TEST_CASES = [ |
202
|
202
|
{
|
203
|
203
|
id: "1",
|
204
|
204
|
last_modified: 1000000000000001,
|
205
|
|
- overrides: "+WindowOuterSize",
|
|
205
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
206
|
206
|
firstPartyDomain: "example.net",
|
207
|
207
|
thirdPartyDomain: "example.com",
|
208
|
208
|
},
|
209
|
209
|
],
|
210
|
210
|
expects: {
|
211
|
|
- windowOuter: {
|
|
211
|
+ screenAvailRect: {
|
212
|
212
|
top: false,
|
213
|
213
|
firstParty: false,
|
214
|
214
|
thirdParty: false,
|
... |
... |
@@ -221,13 +221,13 @@ const TEST_CASES = [ |
221
|
221
|
},
|
222
|
222
|
},
|
223
|
223
|
// Test multiple entries that enable HW concurrency in the first-party context
|
224
|
|
- // and WindowOuter in the third-party context.
|
|
224
|
+ // and ScreenAvailRect in the third-party context.
|
225
|
225
|
{
|
226
|
226
|
entires: [
|
227
|
227
|
{
|
228
|
228
|
id: "1",
|
229
|
229
|
last_modified: 1000000000000001,
|
230
|
|
- overrides: "+WindowOuterSize",
|
|
230
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
231
|
231
|
firstPartyDomain: "example.com",
|
232
|
232
|
},
|
233
|
233
|
{
|
... |
... |
@@ -239,7 +239,7 @@ const TEST_CASES = [ |
239
|
239
|
},
|
240
|
240
|
],
|
241
|
241
|
expects: {
|
242
|
|
- windowOuter: {
|
|
242
|
+ screenAvailRect: {
|
243
|
243
|
top: true,
|
244
|
244
|
firstParty: true,
|
245
|
245
|
thirdParty: false,
|
... |
... |
@@ -335,22 +335,22 @@ async function openAndSetupTestPageForPopup() { |
335
|
335
|
}
|
336
|
336
|
|
337
|
337
|
async function verifyResultInTab(tab, firstPartyBC, thirdPartyBC, expected) {
|
338
|
|
- let testWindowOuter = enabled => {
|
|
338
|
+ let testScreenAvailRect = enabled => {
|
339
|
339
|
if (enabled) {
|
340
|
340
|
ok(
|
341
|
|
- content.wrappedJSObject.outerHeight ==
|
342
|
|
- content.wrappedJSObject.innerHeight &&
|
343
|
|
- content.wrappedJSObject.outerWidth ==
|
344
|
|
- content.wrappedJSObject.innerWidth,
|
345
|
|
- "Fingerprinting target WindowOuterSize is enabled for WindowOuterSize."
|
|
341
|
+ content.wrappedJSObject.screen.availHeight ==
|
|
342
|
+ content.wrappedJSObject.screen.height &&
|
|
343
|
+ content.wrappedJSObject.screen.availWidth ==
|
|
344
|
+ content.wrappedJSObject.screen.width,
|
|
345
|
+ "Fingerprinting target ScreenAvailRect is enabled for ScreenAvailRect."
|
346
|
346
|
);
|
347
|
347
|
} else {
|
348
|
348
|
ok(
|
349
|
|
- content.wrappedJSObject.outerHeight !=
|
350
|
|
- content.wrappedJSObject.innerHeight ||
|
351
|
|
- content.wrappedJSObject.outerWidth !=
|
352
|
|
- content.wrappedJSObject.innerWidth,
|
353
|
|
- "Fingerprinting target WindowOuterSize is not enabled for WindowOuterSize."
|
|
349
|
+ content.wrappedJSObject.screen.availHeight !=
|
|
350
|
+ content.wrappedJSObject.screen.height ||
|
|
351
|
+ content.wrappedJSObject.screen.availWidth !=
|
|
352
|
+ content.wrappedJSObject.screen.width,
|
|
353
|
+ "Fingerprinting target ScreenAvailRect is not enabled for ScreenAvailRect."
|
354
|
354
|
);
|
355
|
355
|
}
|
356
|
356
|
};
|
... |
... |
@@ -370,8 +370,8 @@ async function verifyResultInTab(tab, firstPartyBC, thirdPartyBC, expected) { |
370
|
370
|
);
|
371
|
371
|
await SpecialPowers.spawn(
|
372
|
372
|
tab.linkedBrowser,
|
373
|
|
- [expected.windowOuter.top],
|
374
|
|
- testWindowOuter
|
|
373
|
+ [expected.screenAvailRect.top],
|
|
374
|
+ testScreenAvailRect
|
375
|
375
|
);
|
376
|
376
|
let expectHWConcurrencyTop = expected.hwConcurrency.top
|
377
|
377
|
? SPOOFED_HW_CONCURRENCY
|
... |
... |
@@ -401,8 +401,8 @@ async function verifyResultInTab(tab, firstPartyBC, thirdPartyBC, expected) { |
401
|
401
|
);
|
402
|
402
|
await SpecialPowers.spawn(
|
403
|
403
|
firstPartyBC,
|
404
|
|
- [expected.windowOuter.firstParty],
|
405
|
|
- testWindowOuter
|
|
404
|
+ [expected.screenAvailRect.firstParty],
|
|
405
|
+ testScreenAvailRect
|
406
|
406
|
);
|
407
|
407
|
let expectHWConcurrencyFirstParty = expected.hwConcurrency.firstParty
|
408
|
408
|
? SPOOFED_HW_CONCURRENCY
|
... |
... |
@@ -432,8 +432,8 @@ async function verifyResultInTab(tab, firstPartyBC, thirdPartyBC, expected) { |
432
|
432
|
);
|
433
|
433
|
await SpecialPowers.spawn(
|
434
|
434
|
thirdPartyBC,
|
435
|
|
- [expected.windowOuter.thirdParty],
|
436
|
|
- testWindowOuter
|
|
435
|
+ [expected.screenAvailRect.thirdParty],
|
|
436
|
+ testScreenAvailRect
|
437
|
437
|
);
|
438
|
438
|
let expectHWConcurrencyThirdParty = expected.hwConcurrency.thirdParty
|
439
|
439
|
? SPOOFED_HW_CONCURRENCY
|
... |
... |
@@ -517,7 +517,7 @@ add_task(async function test_popup_inheritance() { |
517
|
517
|
{
|
518
|
518
|
id: "1",
|
519
|
519
|
last_modified: 1000000000000001,
|
520
|
|
- overrides: "+WindowOuterSize",
|
|
520
|
+ overrides: "+ScreenRect,+ScreenAvailRect",
|
521
|
521
|
firstPartyDomain: "example.com",
|
522
|
522
|
thirdPartyDomain: "example.org",
|
523
|
523
|
},
|
... |
... |
@@ -532,22 +532,22 @@ add_task(async function test_popup_inheritance() { |
532
|
532
|
// Ensure the third-party iframe has the correct overrides.
|
533
|
533
|
await SpecialPowers.spawn(thirdPartyFrameBC, [], _ => {
|
534
|
534
|
ok(
|
535
|
|
- content.wrappedJSObject.outerHeight ==
|
536
|
|
- content.wrappedJSObject.innerHeight &&
|
537
|
|
- content.wrappedJSObject.outerWidth ==
|
538
|
|
- content.wrappedJSObject.innerWidth,
|
539
|
|
- "Fingerprinting target WindowOuterSize is enabled for third-party iframe."
|
|
535
|
+ content.wrappedJSObject.screen.availHeight ==
|
|
536
|
+ content.wrappedJSObject.screen.height &&
|
|
537
|
+ content.wrappedJSObject.screen.availWidth ==
|
|
538
|
+ content.wrappedJSObject.screen.width,
|
|
539
|
+ "Fingerprinting target ScreenAvailRect is enabled for third-party iframe."
|
540
|
540
|
);
|
541
|
541
|
});
|
542
|
542
|
|
543
|
543
|
// Verify the popup inherits overrides from the opener.
|
544
|
544
|
await SpecialPowers.spawn(popupBC, [], _ => {
|
545
|
545
|
ok(
|
546
|
|
- content.wrappedJSObject.outerHeight ==
|
547
|
|
- content.wrappedJSObject.innerHeight &&
|
548
|
|
- content.wrappedJSObject.outerWidth ==
|
549
|
|
- content.wrappedJSObject.innerWidth,
|
550
|
|
- "Fingerprinting target WindowOuterSize is enabled for the pop-up."
|
|
546
|
+ content.wrappedJSObject.screen.availHeight ==
|
|
547
|
+ content.wrappedJSObject.screen.height &&
|
|
548
|
+ content.wrappedJSObject.screen.availWidth ==
|
|
549
|
+ content.wrappedJSObject.screen.width,
|
|
550
|
+ "Fingerprinting target ScreenAvailRect is enabled for the pop-up."
|
551
|
551
|
);
|
552
|
552
|
|
553
|
553
|
content.close();
|
|