JavaScript Restrictor
Browser extension that improves privacy and security
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.

See also
https://lukaszolejnik.com/battery

The API is still supported in browsers derived from Chromium. The wrapper mimics Firefox behaviour.

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.