mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 12:06:31 +02:00
parent
ab42c76a44
commit
eb6494eca5
3 changed files with 30 additions and 4 deletions
|
@ -16,16 +16,27 @@
|
|||
}
|
||||
return window.location.host;
|
||||
}
|
||||
const persistentRnd = Object.create(null);
|
||||
exports.persistent = {
|
||||
getRng: function(length, window){
|
||||
const getPersistentRnd = (function(){
|
||||
const {process} = require("sdk/remote/child");
|
||||
process.port.on("canvasBlocker-set-domain-rnd", function(process, {domain, rnd}){
|
||||
persistentRnd[domain] = new Uint8Array(rnd);
|
||||
});
|
||||
|
||||
const persistentRnd = Object.create(null);
|
||||
return function getPersistentRnd(window){
|
||||
var domain = getDomain(window);
|
||||
if (!persistentRnd[domain]){
|
||||
// create the (sub-)domains random numbers if not existing
|
||||
persistentRnd[domain] = new Uint8Array(128);
|
||||
window.crypto.getRandomValues(persistentRnd[domain]);
|
||||
process.port.emit("canvasBlocker-new-domain-rnd", {domain, rnd: persistentRnd[domain]});
|
||||
}
|
||||
var bitSet = persistentRnd[domain];
|
||||
return persistentRnd[domain];
|
||||
}
|
||||
}());
|
||||
exports.persistent = {
|
||||
getRng: function(length, window){
|
||||
var bitSet = getPersistentRnd(window);
|
||||
|
||||
return function(value, i){
|
||||
// use the last 7 bits from the value for the index of the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue