mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01: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:
parent
e5e38e148e
commit
a4a92fc2f9
21
lib/frame.js
21
lib/frame.js
@ -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){
|
||||
|
@ -82,7 +82,13 @@
|
||||
browser.runtime.onConnect.addListener(function(port){
|
||||
notice("got port", port);
|
||||
verbose("send back the tab id", port.sender.tab.id);
|
||||
port.postMessage({tabId: port.sender.tab.id});
|
||||
verbose("send back the persistend random seeds", persistentRnd);
|
||||
verbose("send back the settings", settings);
|
||||
port.postMessage({
|
||||
tabId: port.sender.tab.id,
|
||||
persistentRnd: persistentRnd,
|
||||
settings: settings
|
||||
});
|
||||
var url = new URL(port.sender.url);
|
||||
port.onMessage.addListener(function(data){
|
||||
browser.storage.local.get("showNotifications").then(function(data){
|
||||
|
Loading…
x
Reference in New Issue
Block a user