Skip to content

Commit

Permalink
Add privacy.resistFingerprinting.delegateCanvasProtection to allow po…
Browse files Browse the repository at this point in the history
…wer users to delegate fingerprinting protection for canvas to extensions; without a properly configured extension, this disables RFP for the canvas entirely.

Signed-off-by: Matt Parnell <[email protected]>
  • Loading branch information
ilikenwf committed May 14, 2020
1 parent 0d27c9d commit 1caf710
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dom/canvas/CanvasUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ bool IsImageExtractionAllowed(Document* aDocument, JSContext* aCx,

// At this point, permission is unknown
// (nsIPermissionManager::UNKNOWN_ACTION).

// Check if the user has explicitly disabled all
// or delegated all other checks and fingerprinting resistence
// to an extension (or nothing) such as canvasblocker
bool isDelegateCanvasProtection =
StaticPrefs::
privacy_resistFingerprinting_delegateCanvasProtection() &&
!EventStateManager::IsHandlingUserInput();

if (isDelegateCanvasProtection) {
return true;
}

// Check if the request is in response to user input
bool isAutoBlockCanvas =
Expand Down
6 changes: 6 additions & 0 deletions modules/libpref/init/StaticPrefList.h
Original file line number Diff line number Diff line change
Expand Up @@ -2568,6 +2568,12 @@ VARCACHE_PREF(
RelaxedAtomicBool, false
)

VARCACHE_PREF(
"privacy.resistFingerprinting.delegateCanvasProtection",
privacy_resistFingerprinting_delegateCanvasProtection,
RelaxedAtomicBool, false
)

VARCACHE_PREF(
"privacy.storagePrincipal.enabledForTrackers",
privacy_storagePrincipal_enabledForTrackers,
Expand Down
3 changes: 3 additions & 0 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,9 @@ sticky_pref("privacy.resistFingerprinting.block_mozAddonManager", false);
// If you do set it, to work around some broken website, please file a bug with
// information so we can understand why it is needed.
pref("privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", true);
// In the event the end user wants to use RFP but wishes to fully enable the canvas
// or delegate it's protection an extension, this option allows for it.
pref("privacy.resistFingerprinting.delegateCanvasProtection", false);
// The log level for browser console messages logged in RFPHelper.jsm
// Change to 'All' and restart to see the messages
pref("privacy.resistFingerprinting.jsmloglevel", "Warn");
Expand Down

0 comments on commit 1caf710

Please sign in to comment.