mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 03:56:26 +02:00
Added clear interval
Also ensures that the persistent data is loaded correctly in ESR. Fixes #139 and #143
This commit is contained in:
parent
ec1c5ae7d8
commit
3cb1974b18
14 changed files with 283 additions and 43 deletions
|
@ -12,6 +12,8 @@
|
|||
window.scope.randomSupplies = {};
|
||||
scope = window.scope.randomSupplies;
|
||||
}
|
||||
|
||||
const settings = require("./settings");
|
||||
|
||||
function getDomain(window){
|
||||
if (!window.location.href || window.location.href === "about:blank"){
|
||||
|
@ -26,6 +28,26 @@
|
|||
}
|
||||
|
||||
var persistentRnd = Object.create(null);
|
||||
settings.onloaded(function(){
|
||||
try {
|
||||
let storedData = JSON.parse(settings.persistentRndStorage);
|
||||
for (var domain in storedData){
|
||||
var value = storedData[domain];
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
value.length === 128 &&
|
||||
value.every(function(value){
|
||||
return typeof value === "number" && value >= 0 && value < 256;
|
||||
})
|
||||
){
|
||||
persistentRnd[domain] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
// JSON is not valid -> ignore it
|
||||
}
|
||||
});
|
||||
const getPersistentRnd = (function(){
|
||||
|
||||
browser.runtime.onMessage.addListener(function(data){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue