From d95b27915fa86e8d3f0ed21bce006b79d18d69c5 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 18 Apr 2020 09:45:07 -0400 Subject: [PATCH] Bring fingerprint2.js scriptlet up to date Related issue: - https://github.com/uBlockOrigin/uAssets/pull/4961 --- assets/resources/scriptlets.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index babdd1230..29973d8e8 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -1156,11 +1156,17 @@ // https://github.com/uBlockOrigin/uAssets/issues/2912 /// fingerprint2.js (function() { - let fp2 = function(){}; + let browserId = ''; + for ( let i = 0; i < 8; i++ ) { + browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4); + } + const fp2 = function(){}; + fp2.get = function(opts, cb) { + if ( !cb ) { cb = opts; } + setTimeout(( ) => { cb(browserId, []); }, 1); + }; fp2.prototype = { - get: function(cb) { - setTimeout(function() { cb('', []); }, 1); - } + get: fp2.get }; window.Fingerprint2 = fp2; })();