JavaScript Restrictor
Browser extension that improves privacy and security
Loading...
Searching...
No Matches
wrappingS-BATTERY-CR.js File Reference

Wrappers for Battery Status API. More...

Functions

function add_wrappers (wrappers)
 

Detailed Description

Wrappers for Battery Status API.

See also
https://www.w3.org/TR/battery-status/
Author
Copyright (C) 2021 Libor Polčák
License:
SPDX-License-Identifier: GPL-3.0-or-later

The navigator.getBattery() reports the state of the battery and can be misused to fingerprint users for a short term. The API was removed from Firefox, but is still supported in browsers derived from Chromium. The wrapper mimics Firefox behaviour.

See also
https://lukaszolejnik.com/battery
Bug:
Because we mimic Firefox behaviour, a Chromium derived browser becomes more easily fingerprintable. This can be fixed by properly wrapping BatteryManager.prototype getters and setters.

Function Documentation

◆ add_wrappers()

function add_wrappers ( wrappers  wrappers)

Adds a list of wrapping objects to the build_wrapping_code.

This function is called from each wrapper in its file.