Commit 245ed3e1 authored by Ben Lienhart's avatar Ben Lienhart
Browse files

Bug 1758367 - Implemented finer-grained RFP check in MediaDevices for cut-over of ShouldRFP. r=tjr

parent 494009e5
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -689,9 +689,17 @@ void MediaDevices::OnDeviceChange() {

  // Do not fire event to content script when
  // privacy.resistFingerprinting is true.
  if (nsContentUtils::ShouldResistFingerprinting()) {

  if (nsContentUtils::ShouldResistFingerprinting(
          "Guarding the more expensive RFP check with a simple one")) {
    nsCOMPtr<nsIGlobalObject> global = xpc::NativeGlobal(GetWrapper());
    nsCOMPtr<nsPIDOMWindowInner> owner = do_QueryInterface(global);

    Document* doc = owner->GetExtantDoc();
    if (nsContentUtils::ShouldResistFingerprinting(doc)) {
      return;
    }
  }

  mHaveUnprocessedDeviceListChange = true;
  MaybeResumeDeviceExposure();