mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
c6cf48c489
commit
1d8bf95926
@ -12,7 +12,7 @@
|
|||||||
scope = require.register("./modifiedNavigatorAPI", {});
|
scope = require.register("./modifiedNavigatorAPI", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const {checkerWrapper, setGetterProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
|
const {checkerWrapper, setProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
|
||||||
const extension = require("./extension");
|
const extension = require("./extension");
|
||||||
const navigator = require("./navigator");
|
const navigator = require("./navigator");
|
||||||
|
|
||||||
@ -55,7 +55,40 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
setGetterProperties(scope.changedGetters, {
|
scope.changedFunctions = {
|
||||||
|
estimate: {
|
||||||
|
objectGetters: [function(window){return window.StorageManager && window.StorageManager.prototype;}],
|
||||||
|
fakeGenerator: function(checker){
|
||||||
|
const quota = 10 * 1024 * 1024 * 1024;
|
||||||
|
return function estimate(){
|
||||||
|
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||||
|
const {notify, original, window} = check;
|
||||||
|
const This = this;
|
||||||
|
return new window.Promise(async function(resolve, reject){
|
||||||
|
try {
|
||||||
|
const originalValue = await original.call(This, ...args);
|
||||||
|
if (originalValue.quota !== quota){
|
||||||
|
originalValue.usage = Math.min(
|
||||||
|
quota,
|
||||||
|
Math.max(0, quota - (originalValue.quota - originalValue.usage))
|
||||||
|
);
|
||||||
|
originalValue.quota = quota;
|
||||||
|
|
||||||
|
notify("fakedNavigatorReadout");
|
||||||
|
}
|
||||||
|
resolve(originalValue);
|
||||||
|
}
|
||||||
|
catch (error){
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
setProperties(scope.changedFunctions, scope.changedGetters, {
|
||||||
type: "readout",
|
type: "readout",
|
||||||
getStatus: getStatusByFlag("protectNavigator"),
|
getStatus: getStatusByFlag("protectNavigator"),
|
||||||
api: "navigator"
|
api: "navigator"
|
||||||
|
@ -146,6 +146,7 @@
|
|||||||
"appName @ navigator",
|
"appName @ navigator",
|
||||||
"appVersion @ navigator",
|
"appVersion @ navigator",
|
||||||
"buildID @ navigator",
|
"buildID @ navigator",
|
||||||
|
"estimate @ navigator",
|
||||||
"oscpu @ navigator",
|
"oscpu @ navigator",
|
||||||
"platform @ navigator",
|
"platform @ navigator",
|
||||||
"product @ navigator",
|
"product @ navigator",
|
||||||
|
@ -5,6 +5,7 @@ Version 1.10:
|
|||||||
new features:
|
new features:
|
||||||
- added setting showPresetsOnInstallation to be able to not show the presets page upon installation
|
- added setting showPresetsOnInstallation to be able to not show the presets page upon installation
|
||||||
- display version in page and browser action
|
- display version in page and browser action
|
||||||
|
- added protection for navigator.storage.estimate()
|
||||||
|
|
||||||
fixes:
|
fixes:
|
||||||
- always protect about:blank
|
- always protect about:blank
|
||||||
|
Loading…
x
Reference in New Issue
Block a user