Commit ba786d66 authored by Tom Ritter's avatar Tom Ritter Committed by clairehurst
Browse files

Bug 1999126: Hide the value of the pdfjs pref from being disabled when RFP is enabled r=timhuang

parent 502e19f4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -331,6 +331,13 @@ add_task(async () => {
  await simpleRFPTest(uri, testNavigator, expectedResults);
});

add_task(async () => {
  expectedResults = structuredClone(allSpoofed);
  await simpleRFPTest(uri, testNavigator, expectedResults, {}, [
    ["pdfjs.disabled", true],
  ]);
});

// 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)
// so we can check that the HTTP header is as expected.

+5 −1
Original line number Diff line number Diff line
@@ -510,7 +510,11 @@ nsPluginArray* Navigator::GetPlugins(ErrorResult& aRv) {
  return mPlugins;
}

bool Navigator::PdfViewerEnabled() { return !StaticPrefs::pdfjs_disabled(); }
bool Navigator::PdfViewerEnabled() {
  return !StaticPrefs::pdfjs_disabled() ||
         nsContentUtils::ShouldResistFingerprinting(GetDocShell(),
                                                    RFPTarget::PdfjsSpoof);
}

Permissions* Navigator::GetPermissions(ErrorResult& aRv) {
  if (!mWindow) {
+5 −1
Original line number Diff line number Diff line
@@ -79,7 +79,11 @@ void nsMimeTypeArray::GetSupportedNames(nsTArray<nsString>& retval) {
  }
}

bool nsMimeTypeArray::ForceNoPlugins() { return StaticPrefs::pdfjs_disabled(); }
bool nsMimeTypeArray::ForceNoPlugins() {
  return StaticPrefs::pdfjs_disabled() &&
         !nsContentUtils::ShouldResistFingerprinting(
             mWindow ? mWindow->GetDocShell() : nullptr, RFPTarget::PdfjsSpoof);
}

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsMimeType, mPluginElement)

+5 −1
Original line number Diff line number Diff line
@@ -97,7 +97,11 @@ void nsPluginArray::GetSupportedNames(nsTArray<nsString>& aRetval) {
  }
}

bool nsPluginArray::ForceNoPlugins() { return StaticPrefs::pdfjs_disabled(); }
bool nsPluginArray::ForceNoPlugins() {
  return StaticPrefs::pdfjs_disabled() &&
         !nsContentUtils::ShouldResistFingerprinting(
             mWindow ? mWindow->GetDocShell() : nullptr, RFPTarget::PdfjsSpoof);
}

NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPluginArray)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginArray)
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ ITEM_VALUE(NavigatorHWConcurrency, 16)
ITEM_VALUE(NavigatorOscpu,              17)
ITEM_VALUE(NavigatorPlatform,           18)
ITEM_VALUE(NavigatorUserAgent,          19)
ITEM_VALUE(PointerId,                   20)
// If the user disables PDFJS via a pref, we do not expose that to the web
ITEM_VALUE(PdfjsSpoof,                  20)
ITEM_VALUE(StreamVideoFacingMode,       21)
ITEM_VALUE(JSDateTimeUTC,               22)
ITEM_VALUE(JSMathFdlibm,                23)