1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Ping back after the port opening to the background script now also returns the settings and the persistentRnd data.

This commit is contained in:
kkapsner 2017-09-23 23:37:46 +02:00
parent e5e38e148e
commit a4a92fc2f9
2 changed files with 27 additions and 2 deletions

View file

@ -7,9 +7,11 @@
const {intercept} = require("./intercept.js");
const {ask} = require("./askForPermission.js");
const lists = require("./lists.js");
const {check: originalCheck, checkStack: originalCheckStack} = require("./check.js");
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
const logging = require("./logging");
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = logging;
setLogPrefix("frame script");
// Variable to "unload" the script
@ -49,6 +51,23 @@
notice("my tab id is", data.tabId);
tabId = data.tabId;
}
if (data.hasOwnProperty("persistentRnd")){
notice("got persistent random data", data.persistentRnd);
const {persistent: persistentRnd} = require("./randomSupplies.js");
Object.keys(data.persistentRnd).forEach(function(domain){
verbose("random data for", domain, data.persistentRnd[domain]);
persistentRnd.setDomainRnd(domain, data.persistentRnd[domain]);
});
}
if (settings.isStillDefault && data.hasOwnProperty("settings")){
notice("got settings from background script");
Object.keys(data.settings).forEach(function(key){
settings[key] = data.settings[key];
});
settings.isStillDefault = false;
logging.clearQueue();
lists.updateAll();
}
});
var notifications = [];
function notify(data){