mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Do not fail if navigator is not available
This commit is contained in:
parent
cee0f75293
commit
e549267085
1 changed files with 15 additions and 6 deletions
|
@ -66,15 +66,24 @@ iframeAPI.forEachMethod(async function(windowToUse, name){
|
||||||
const navigator = windowToUse.navigator;
|
const navigator = windowToUse.navigator;
|
||||||
const values = {};
|
const values = {};
|
||||||
const keys = Object.keys(navigator.__proto__);
|
const keys = Object.keys(navigator.__proto__);
|
||||||
|
let hasPropertyError = false;
|
||||||
keys.forEach(function(property){
|
keys.forEach(function(property){
|
||||||
|
try {
|
||||||
const value = navigator[property];
|
const value = navigator[property];
|
||||||
if ((typeof value) === "string"){
|
if ((typeof value) === "string"){
|
||||||
values[property] = value;
|
values[property] = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (error){
|
||||||
|
hasPropertyError = true;
|
||||||
|
console.warn(name, error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
if (!hasPropertyError){
|
||||||
const storage = await navigator.storage.estimate();
|
const storage = await navigator.storage.estimate();
|
||||||
values.storage_quota = storage.quota.toString(10);
|
values.storage_quota = storage.quota.toString(10);
|
||||||
keys.push("storage_quota");
|
keys.push("storage_quota");
|
||||||
|
}
|
||||||
console.log(name, values);
|
console.log(name, values);
|
||||||
processNavigatorObject(values, keys, name);
|
processNavigatorObject(values, keys, name);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue