From a7d232cb15daf313349bb1dd3c40f0d802df4f60 Mon Sep 17 00:00:00 2001 From: David Parks Date: Thu, 17 Feb 2022 01:33:01 +0000 Subject: [PATCH] Bug 1720353: Make navigator test expect plugins when resistFingerprinting is not set r=preferences-reviewers,Gijs resistFingerprinting used to be set for the whole test but was changed to consider cases where it is unset. In those cases, pluginsLength and mimeTypesLength tests were only passing because there were no plugins installed and, later, no plugins were permitted. We now hardcode some fixed PDF entries so the test has to consider that. Differential Revision: https://phabricator.services.mozilla.com/D138497 --- .../test/browser/browser_navigator.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/browser/components/resistfingerprinting/test/browser/browser_navigator.js b/browser/components/resistfingerprinting/test/browser/browser_navigator.js index 508a67122a94..821db8b8db4e 100644 --- a/browser/components/resistfingerprinting/test/browser/browser_navigator.js +++ b/browser/components/resistfingerprinting/test/browser/browser_navigator.js @@ -195,8 +195,16 @@ async function testNavigator() { expectedResults.userAgentNavigator, `Checking ${testDesc} navigator.userAgent.` ); - is(result.mimeTypesLength, 0, "Navigator.mimeTypes has a length of 0."); - is(result.pluginsLength, 0, "Navigator.plugins has a length of 0."); + is( + result.mimeTypesLength, + expectedResults.mimeTypesLength, + `Navigator.mimeTypes has a length of ${expectedResults.mimeTypesLength}.` + ); + is( + result.pluginsLength, + expectedResults.pluginsLength, + `Navigator.plugins has a length of ${expectedResults.pluginsLength}.` + ); is( result.oscpu, expectedResults.oscpu, @@ -336,8 +344,10 @@ add_task(async function setupDefaultUserAgent() { testDesc: "default", appVersion: DEFAULT_APPVERSION[AppConstants.platform], hardwareConcurrency: navigator.hardwareConcurrency, + mimeTypesLength: 2, oscpu: DEFAULT_OSCPU[AppConstants.platform], platform: DEFAULT_PLATFORM[AppConstants.platform], + pluginsLength: 5, userAgentNavigator: defaultUserAgent, userAgentHeader: defaultUserAgent, }; @@ -368,8 +378,10 @@ add_task(async function setupResistFingerprinting() { testDesc: "spoofed", appVersion: SPOOFED_APPVERSION[AppConstants.platform], hardwareConcurrency: SPOOFED_HW_CONCURRENCY, + mimeTypesLength: 0, oscpu: SPOOFED_OSCPU[AppConstants.platform], platform: SPOOFED_PLATFORM[AppConstants.platform], + pluginsLength: 0, userAgentNavigator: spoofedUserAgentNavigator, userAgentHeader: spoofedUserAgentHeader, }; @@ -428,8 +440,10 @@ if (AppConstants.platform != "android") { testDesc: "forceVersion100", appVersion: DEFAULT_APPVERSION[AppConstants.platform], hardwareConcurrency: navigator.hardwareConcurrency, + mimeTypesLength: 2, oscpu: DEFAULT_OSCPU[AppConstants.platform], platform: DEFAULT_PLATFORM[AppConstants.platform], + pluginsLength: 5, userAgentNavigator: VERSION_100_UA, userAgentHeader: VERSION_100_UA, }; @@ -468,8 +482,10 @@ if (AppConstants.platform != "android") { testDesc: "FirefoxVersionExperimentTest", appVersion: DEFAULT_APPVERSION[AppConstants.platform], hardwareConcurrency: navigator.hardwareConcurrency, + mimeTypesLength: 2, oscpu: DEFAULT_OSCPU[AppConstants.platform], platform: DEFAULT_PLATFORM[AppConstants.platform], + pluginsLength: 5, userAgentNavigator: VERSION_100_UA, userAgentHeader: VERSION_100_UA, };