summaryrefslogtreecommitdiffstats
path: root/browser/components/resistfingerprinting/test/browser/browser_roundedWindow_dialogWindow.js
blob: 96ad858fb3c002203fad4e185b25529514cef657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
 * 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_setup(async function () {
  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();
});