Bug 1352305 - Part2: Add a test case for making sure dialog windows will not be enforced to rounded sizes when fingerprinting resistance is enabled. r?ehsan
A browser chrome test which ensures the dialog windows will not be enforced to
be rounded sizes when fingerprinting resistance is enabled.
MozReview-Commit-ID: LQG13FMANav
--- a/browser/components/resistfingerprinting/test/browser/browser.ini
+++ b/browser/components/resistfingerprinting/test/browser/browser.ini
@@ -1,13 +1,14 @@
[DEFAULT]
tags = resistfingerprinting
support-files =
file_dummy.html
head.js
+[browser_roundedWindow_dialogWindow.js]
[browser_roundedWindow_newWindow.js]
[browser_roundedWindow_open_max.js]
[browser_roundedWindow_open_mid.js]
[browser_roundedWindow_open_min.js]
[browser_roundedWindow_windowSetting_max.js]
[browser_roundedWindow_windowSetting_mid.js]
[browser_roundedWindow_windowSetting_min.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_dialogWindow.js
@@ -0,0 +1,40 @@
+/**
+ * Bug 1352305 - A test case for dialog windows that it should not be rounded
+ * even after fingerprinting resistance is enabled.
+ */
+
+async function test_dialog_window() {
+ let diagWin;
+
+ await new Promise(resolve => {
+ // Open a dialog window which is not rounded size.
+ diagWin = window.openDialog("about:blank", null,
+ "innerWidth=250,innerHeight=350");
+
+ diagWin.addEventListener("load", function() {
+ resolve();
+ }, {once: true});
+ });
+
+ is(diagWin.innerWidth, 250, "The dialog window doesn't have a rounded size.");
+ is(diagWin.innerHeight, 350, "The dialog window doesn't have a rounded size.");
+
+ await BrowserTestUtils.closeWindow(diagWin);
+}
+
+add_task(async function setup() {
+ await SpecialPowers.pushPrefEnv({"set":
+ [["privacy.resistFingerprinting", true]]
+ });
+});
+
+add_task(test_dialog_window);
+
+add_task(async function test_dialog_window_without_resistFingerprinting() {
+ // Test dialog windows with 'privacy.resistFingerprinting' is false.
+ await SpecialPowers.pushPrefEnv({"set":
+ [["privacy.resistFingerprinting", false]]
+ });
+
+ await test_dialog_window();
+});