mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
parent
ab42c76a44
commit
eb6494eca5
14
lib/main.js
14
lib/main.js
@ -38,6 +38,20 @@
|
|||||||
processes.port.emit("canvasBlocker-unload");
|
processes.port.emit("canvasBlocker-unload");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// persistent rng
|
||||||
|
const persistentRnd = Object.create(null);
|
||||||
|
processes.port.on("canvasBlocker-new-domain-rnd", function(process, data){
|
||||||
|
processes.port.emit("canvasBlocker-set-domain-rnd", data);
|
||||||
|
persistentRnd[data.domain] = data.rnd;
|
||||||
|
});
|
||||||
|
processes.on("attach", function(process){
|
||||||
|
if (process.isRemote){
|
||||||
|
for (var name in persistentRnd){
|
||||||
|
process.port.emit("canvasBlocker-set-domain-rnd", {domain: name, rnd: persistentRnd[name]});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// show release notes
|
// show release notes
|
||||||
var data = require("sdk/self").data;
|
var data = require("sdk/self").data;
|
||||||
preferences.on("showReleaseNotes", function(){
|
preferences.on("showReleaseNotes", function(){
|
||||||
|
@ -16,16 +16,27 @@
|
|||||||
}
|
}
|
||||||
return window.location.host;
|
return window.location.host;
|
||||||
}
|
}
|
||||||
const persistentRnd = Object.create(null);
|
const getPersistentRnd = (function(){
|
||||||
exports.persistent = {
|
const {process} = require("sdk/remote/child");
|
||||||
getRng: function(length, window){
|
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);
|
var domain = getDomain(window);
|
||||||
if (!persistentRnd[domain]){
|
if (!persistentRnd[domain]){
|
||||||
// create the (sub-)domains random numbers if not existing
|
// create the (sub-)domains random numbers if not existing
|
||||||
persistentRnd[domain] = new Uint8Array(128);
|
persistentRnd[domain] = new Uint8Array(128);
|
||||||
window.crypto.getRandomValues(persistentRnd[domain]);
|
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){
|
return function(value, i){
|
||||||
// use the last 7 bits from the value for the index of the
|
// use the last 7 bits from the value for the index of the
|
||||||
|
@ -12,6 +12,7 @@ Version 0.3.6:
|
|||||||
- removed error message when notification can not be closed
|
- removed error message when notification can not be closed
|
||||||
- about:blank pages are treated with respect to the opening page
|
- about:blank pages are treated with respect to the opening page
|
||||||
- removed memory leak
|
- removed memory leak
|
||||||
|
- persistent rnd same for all tabs/windows with e10s enabled
|
||||||
|
|
||||||
Version 0.3.5
|
Version 0.3.5
|
||||||
new features:
|
new features:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user