Pier Angelo Vendrame pushed to branch tor-browser-140.5.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
d2aece5a
by Tom Ritter at 2025-11-24T09:42:57+01:00
5 changed files:
- browser/components/resistfingerprinting/test/browser/browser_navigator_iframes.js
- dom/base/Navigator.cpp
- dom/base/nsMimeTypeArray.cpp
- dom/base/nsPluginArray.cpp
- toolkit/components/resistfingerprinting/RFPTargets.inc
Changes:
| ... | ... | @@ -331,6 +331,13 @@ add_task(async () => { |
| 331 | 331 | await simpleRFPTest(uri, testNavigator, expectedResults);
|
| 332 | 332 | });
|
| 333 | 333 | |
| 334 | +add_task(async () => {
|
|
| 335 | + expectedResults = structuredClone(allSpoofed);
|
|
| 336 | + await simpleRFPTest(uri, testNavigator, expectedResults, {}, [
|
|
| 337 | + ["pdfjs.disabled", true],
|
|
| 338 | + ]);
|
|
| 339 | +});
|
|
| 340 | + |
|
| 334 | 341 | // In the below tests, we use the cross-origin domain as the base URI of a resource we fetch (on both the framer and framee)
|
| 335 | 342 | // so we can check that the HTTP header is as expected.
|
| 336 | 343 |
| ... | ... | @@ -510,7 +510,11 @@ nsPluginArray* Navigator::GetPlugins(ErrorResult& aRv) { |
| 510 | 510 | return mPlugins;
|
| 511 | 511 | }
|
| 512 | 512 | |
| 513 | -bool Navigator::PdfViewerEnabled() { return !StaticPrefs::pdfjs_disabled(); }
|
|
| 513 | +bool Navigator::PdfViewerEnabled() {
|
|
| 514 | + return !StaticPrefs::pdfjs_disabled() ||
|
|
| 515 | + nsContentUtils::ShouldResistFingerprinting(GetDocShell(),
|
|
| 516 | + RFPTarget::PdfjsSpoof);
|
|
| 517 | +}
|
|
| 514 | 518 | |
| 515 | 519 | Permissions* Navigator::GetPermissions(ErrorResult& aRv) {
|
| 516 | 520 | if (!mWindow) {
|
| ... | ... | @@ -79,7 +79,11 @@ void nsMimeTypeArray::GetSupportedNames(nsTArray<nsString>& retval) { |
| 79 | 79 | }
|
| 80 | 80 | }
|
| 81 | 81 | |
| 82 | -bool nsMimeTypeArray::ForceNoPlugins() { return StaticPrefs::pdfjs_disabled(); }
|
|
| 82 | +bool nsMimeTypeArray::ForceNoPlugins() {
|
|
| 83 | + return StaticPrefs::pdfjs_disabled() &&
|
|
| 84 | + !nsContentUtils::ShouldResistFingerprinting(
|
|
| 85 | + mWindow ? mWindow->GetDocShell() : nullptr, RFPTarget::PdfjsSpoof);
|
|
| 86 | +}
|
|
| 83 | 87 | |
| 84 | 88 | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mPluginElement)
|
| 85 | 89 |
| ... | ... | @@ -97,7 +97,11 @@ void nsPluginArray::GetSupportedNames(nsTArray<nsString>& aRetval) { |
| 97 | 97 | }
|
| 98 | 98 | }
|
| 99 | 99 | |
| 100 | -bool nsPluginArray::ForceNoPlugins() { return StaticPrefs::pdfjs_disabled(); }
|
|
| 100 | +bool nsPluginArray::ForceNoPlugins() {
|
|
| 101 | + return StaticPrefs::pdfjs_disabled() &&
|
|
| 102 | + !nsContentUtils::ShouldResistFingerprinting(
|
|
| 103 | + mWindow ? mWindow->GetDocShell() : nullptr, RFPTarget::PdfjsSpoof);
|
|
| 104 | +}
|
|
| 101 | 105 | |
| 102 | 106 | NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPluginArray)
|
| 103 | 107 | NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginArray)
|
| ... | ... | @@ -34,7 +34,8 @@ ITEM_VALUE(NavigatorHWConcurrency, 16) |
| 34 | 34 | ITEM_VALUE(NavigatorOscpu, 17)
|
| 35 | 35 | ITEM_VALUE(NavigatorPlatform, 18)
|
| 36 | 36 | ITEM_VALUE(NavigatorUserAgent, 19)
|
| 37 | -// We no longer use PointerId, it can renamed and reused
|
|
| 37 | +// If the user disables PDFJS via a pref, we do not expose that to the web
|
|
| 38 | +ITEM_VALUE(PdfjsSpoof, 20)
|
|
| 38 | 39 | ITEM_VALUE(StreamVideoFacingMode, 21)
|
| 39 | 40 | ITEM_VALUE(JSDateTimeUTC, 22)
|
| 40 | 41 | ITEM_VALUE(JSMathFdlibm, 23)
|