JavaScript Restrictor
Browser extension that improves privacy and security
wrappingS-H-C.js File Reference

This file contains wrappers for Canvas-related calls. More...

Variables

var helping_code = `var approach = args[0]
 
var wrappers
 

Detailed Description

This file contains wrappers for Canvas-related calls.

See also
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
Author
Copyright (C) 2019 Libor Polcak
Copyright (C) 2021 Matus Svancar
License:
SPDX-License-Identifier: GPL-3.0-or-later
License:
SPDX-License-Identifier: MPL-2.0

This file contains wrappers for calls related to the Canvas API, about which you can read more at MDN:

The goal is to prevent fingerprinting by modifying the values that can be read from the canvas. So the visual content of wrapped canvases as displayed on the screen is the same as intended.

The modified content can be either an empty image or a fake image that is modified according to session and domain keys to be different than the original albeit very similar (i.e. the approach inspired by the algorithms created by Brave Software available here.

Note that both approaches are detectable by a fingerprinter that checks if a predetermined image inserted to the canvas is the same as the read one, see here for an example, Nevertheless, the aim of the wrappers is to limit the finerprintability.

Also note that a determined fingerprinter can reveal the modifications and consequently uncover the original image. This can be avoided with the approach that completely clears the data stored in the canvas. Use the modifications based on session and domain keys if you want to provide an image that is similar to the original or if you want to produce a fake image that is not obviously spoofed to a naked eye. Otherwise, use the clearing approach.

Variable Documentation

◆ helping_code

String helping_code = `var approach = args[0]

Selects if the canvas should be cleared (1) or a fake image should be created based on session and domain keys (0).

◆ wrappers

var wrappers