diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js')
-rw-r--r-- | browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js b/browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js new file mode 100644 index 0000000000..f549c71bf0 --- /dev/null +++ b/browser/components/resistfingerprinting/test/browser/browser_bug1369357_site_specific_zoom_level.js @@ -0,0 +1,77 @@ +"use strict"; + +const PATH_NET = TEST_PATH + "file_dummy.html"; +const PATH_ORG = PATH_NET.replace("example.net", "example.org"); + +add_task(async function () { + let tab1, tab1Zoom, tab2, tab2Zoom, tab3, tab3Zoom; + + tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); + await FullZoom.enlarge(); + tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser); + + tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); + tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser); + + is( + tab2Zoom, + tab1Zoom, + "privacy.resistFingerprinting is false, site-specific zoom level should be enabled" + ); + + await SpecialPowers.pushPrefEnv({ + set: [["privacy.resistFingerprinting", true]], + }); + + tab3 = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); + tab3Zoom = ZoomManager.getZoomForBrowser(tab3.linkedBrowser); + + isnot( + tab3Zoom, + tab1Zoom, + "privacy.resistFingerprinting is true, site-specific zoom level should be disabled" + ); + + await FullZoom.reset(); + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + BrowserTestUtils.removeTab(tab3); + + await SpecialPowers.popPrefEnv(); +}); + +add_task(async function exempt_domain() { + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); + await FullZoom.enlarge(); + const netZoomOriginal = ZoomManager.getZoomForBrowser(tab.linkedBrowser); + is(netZoomOriginal, 1.1, "Initial zoom is 110%"); + await BrowserTestUtils.removeTab(tab); + + tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_ORG); + await FullZoom.enlarge(); + const orgZoomOriginal = ZoomManager.getZoomForBrowser(tab.linkedBrowser); + is(orgZoomOriginal, 1.1, "Initial zoom is 110%"); + await BrowserTestUtils.removeTab(tab); + + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.resistFingerprinting.exemptedDomains", "example.net"], + ["privacy.resistFingerprinting", true], + ], + }); + + tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_NET); + const netZoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser); + is(netZoom, 1.1, "exempted example.net tab should have kept zoom level"); + await FullZoom.reset(); + await BrowserTestUtils.removeTab(tab); + + tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PATH_ORG); + const orgZoom = ZoomManager.getZoomForBrowser(tab.linkedBrowser); + is(orgZoom, 1.0, "example.org tab has its zoom reset to default 100%"); + await FullZoom.reset(); + await BrowserTestUtils.removeTab(tab); + + await SpecialPowers.popPrefEnv(); +}); |