add: missing primitives

This commit is contained in:
Andrei O 2022-03-28 21:26:22 +03:00
parent acf1d06f82
commit 58479281f0
No known key found for this signature in database
GPG Key ID: B961E5B68389457E

View File

@ -4,7 +4,7 @@ nav = nav.bind(function () {
return window.navigator; return window.navigator;
}); });
newNav = new nav(); newNav = new nav();
const alreadyProxifiedNav = { const primitivesNav = {
userAgent: window.navigator.userAgent, userAgent: window.navigator.userAgent,
appVersion: window.navigator.appVersion, appVersion: window.navigator.appVersion,
platform: window.navigator.platform, platform: window.navigator.platform,
@ -12,17 +12,23 @@ const alreadyProxifiedNav = {
userLanguage: window.navigator.userLanguage, userLanguage: window.navigator.userLanguage,
language: window.navigator.language, language: window.navigator.language,
cookieEnabled: true, cookieEnabled: true,
appCodeName: window.navigator.appCodeName,
appName: window.navigator.appName,
product: window.navigator.product,
geolocation: window.navigator.geolocation,
onLine: window.navigator.onLine,
}; };
for (let prop in window.navigator) { for (let prop in window.navigator) {
if (prop === 'brave') { if (prop === 'brave') {
continue; continue;
} }
newNav.prop = copyNavRef.prop; newNav.prop = copyNavRef.prop;
} }
for (let prop in alreadyProxifiedNav) { for (let prop in primitivesNav) {
alreadyProxifiedNav.hasOwnProperty(prop) && primitivesNav.hasOwnProperty(prop) &&
Object.defineProperty(newNav, prop, { Object.defineProperty(newNav, prop, {
value: alreadyProxifiedNav[prop], value: primitivesNav[prop],
writable: true, writable: true,
}); });
} }