Remove Servo's wrapper around rand (#39979)

This wrapper was added in order to eliminate the number of file
descriptors used accessing `/dev/urandom`, but these days `osrandom` and
by proxy `rand` will try to use `getrandom` on Linux and similar system
APIs on other platforms [^1].

This is a trial balloon for removing the wrapper, since almost all
modern Linux systems have `getrandom`  (available since Linux
3.17).

[^1]: https://docs.rs/getrandom/0.3.4/getrandom/#supported-targets

Testing: Should not change observable behavior (only in random ways), so
should
be covered by WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2025-10-18 15:54:20 +02:00
committed by GitHub
parent bf42488da8
commit c776475b3b
25 changed files with 75 additions and 362 deletions

View File

@@ -16,8 +16,8 @@ use js::rust::HandleObject;
use mime::{self, Mime};
use net_traits::http_percent_encode;
use net_traits::request::Referrer;
use rand::random;
use rustc_hash::FxBuildHasher;
use servo_rand::random;
use style::attr::AttrValue;
use style::str::split_html_space_chars;
use stylo_atoms::Atom;