mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Added container specific navigator settings
This commit is contained in:
parent
01b63b356c
commit
cc8ca147b0
8 changed files with 265 additions and 51 deletions
|
@ -13,8 +13,34 @@
|
|||
}
|
||||
|
||||
const {checkerWrapper, setGetterProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
|
||||
const logging = require("./logging");
|
||||
const navigator = require("./navigator");
|
||||
|
||||
let cookieStoreId = false;
|
||||
scope.setCookieStoreId = function(newCookieStoreId){
|
||||
if (typeof newCookieStoreId === "string"){
|
||||
cookieStoreId = (
|
||||
newCookieStoreId !== "" &&
|
||||
newCookieStoreId !== "firefox-default"
|
||||
)? newCookieStoreId: "";
|
||||
}
|
||||
};
|
||||
function getCookieStoreId(){
|
||||
while (cookieStoreId === false){
|
||||
logging.message("Starting synchronous request to wait for cookie store id.");
|
||||
try {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "https://[::]", false);
|
||||
xhr.send();
|
||||
xhr = null;
|
||||
}
|
||||
catch (error){
|
||||
logging.verbose("Error in XHR:", error);
|
||||
}
|
||||
}
|
||||
return cookieStoreId;
|
||||
}
|
||||
|
||||
scope.changedGetters = navigator.allProperties.map(function(property){
|
||||
return {
|
||||
objectGetters: [function(window){return window.Navigator && window.Navigator.prototype;}],
|
||||
|
@ -25,7 +51,7 @@
|
|||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {notify, original} = check;
|
||||
const originalValue = original.call(this, ...args);
|
||||
const returnValue = navigator.getNavigatorValue(property);
|
||||
const returnValue = navigator.getNavigatorValue(property, getCookieStoreId);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedNavigatorReadout");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue