mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
Persistent rng is no longer shared between containers
(different cookieStoreId) Fixes #350
This commit is contained in:
parent
97e08d874a
commit
621106ffbf
@ -85,6 +85,11 @@
|
||||
notice("my tab id is", data.tabId);
|
||||
tabId = data.tabId;
|
||||
}
|
||||
if (data.hasOwnProperty("cookieStoreId")){
|
||||
notice("my tab cookie store id is", data.cookieStoreId);
|
||||
const {persistent: persistentRnd} = require("./randomSupplies");
|
||||
persistentRnd.setCookieStoreId(data.cookieStoreId);
|
||||
}
|
||||
const persistentRndName = "persistent" + (extension.inIncognitoContext? "Incognito": "") + "Rnd";
|
||||
if (data.hasOwnProperty(persistentRndName)){
|
||||
const persistentRndValue = data[persistentRndName];
|
||||
|
@ -57,9 +57,11 @@
|
||||
return;
|
||||
}
|
||||
verbose("send back the tab id", port.sender.tab.id);
|
||||
verbose("send back the tab cookie store id", port.sender.tab.cookieStoreId);
|
||||
verbose("send back the persistent random seeds", persistentRndStorage.persistentRnd);
|
||||
port.postMessage({
|
||||
tabId: port.sender.tab.id,
|
||||
cookieStoreId: port.sender.tab.cookieStoreId,
|
||||
persistentRnd: persistentRndStorage.persistentRnd,
|
||||
persistentIncognitoRnd: persistentRndStorage.persistentIncognitoRnd
|
||||
});
|
||||
|
@ -81,6 +81,7 @@
|
||||
}
|
||||
|
||||
var persistentRnd = Object.create(null);
|
||||
let cookieStoreId = "";
|
||||
settings.onloaded(function(){
|
||||
try {
|
||||
let storedData = JSON.parse(
|
||||
@ -120,7 +121,7 @@
|
||||
});
|
||||
|
||||
return function getPersistentRnd(window){
|
||||
var domain = getDomain(window);
|
||||
var domain = cookieStoreId + getDomain(window);
|
||||
if (!persistentRnd[domain]){
|
||||
// create the (sub-)domains random numbers if not existing
|
||||
persistentRnd[domain] = new Uint8Array(128);
|
||||
@ -142,6 +143,17 @@
|
||||
scope.persistent.setDomainRnd = function(domain, rnd){
|
||||
persistentRnd[domain] = new Uint8Array(rnd);
|
||||
};
|
||||
scope.persistent.setCookieStoreId = function(newCookieStoreId){
|
||||
if (
|
||||
typeof newCookieStoreId === "string" &&
|
||||
newCookieStoreId !== "firefox-default"
|
||||
){
|
||||
cookieStoreId = (
|
||||
newCookieStoreId !== "" &&
|
||||
newCookieStoreId !== "firefox-default"
|
||||
)? newCookieStoreId + "@": "";
|
||||
}
|
||||
};
|
||||
scope.persistent.getRng = function(length, window){
|
||||
var bitSet = new Uint32Array(getPersistentRnd(window).buffer);
|
||||
var bitSetLength = bitSet.length;
|
||||
|
@ -85,7 +85,8 @@
|
||||
"tabs",
|
||||
"activeTab",
|
||||
"webRequest",
|
||||
"webRequestBlocking"
|
||||
"webRequestBlocking",
|
||||
"cookies"
|
||||
],
|
||||
|
||||
"applications": {
|
||||
|
@ -4,6 +4,7 @@ Version 0.5.10:
|
||||
|
||||
new features:
|
||||
- added date and time to the settings export file
|
||||
- persistent rng is no longer shared between containers (different cookieStoreId)
|
||||
|
||||
fixes:
|
||||
- setter for innerHTML broke pages
|
||||
|
Loading…
x
Reference in New Issue
Block a user