summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/content.js5
-rw-r--r--src/lib/Messages.js6
2 files changed, 8 insertions, 3 deletions
diff --git a/src/content/content.js b/src/content/content.js
index 302ee8a..3709bd1 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -50,6 +50,11 @@ var notifyPage = async () => {
try {
if (!("canScript" in ns)) {
let childPolicy = await Messages.send("fetchChildPolicy", {url: document.URL});
+ if (!childPolicy) {
+ debug(`No answer to fetchChildPolicy message. Still initializing?`);
+ setTimeout(notifyPage, 300);
+ return;
+ }
ns.config.CURRENT = childPolicy.CURRENT;
ns.setup(childPolicy.DEFAULT, childPolicy.MARKER);
return;
diff --git a/src/lib/Messages.js b/src/lib/Messages.js
index 50639ef..b8977cf 100644
--- a/src/lib/Messages.js
+++ b/src/lib/Messages.js
@@ -13,13 +13,13 @@
}
if (answers.length) {
return await (
- answers.length === 1 ? answers.pop(): Promise.all(answers)
+ answers.length === 1 ? answers.pop(): Promise.all(answers)
);
}
- console.log("Answering %s", _messageName);
+ console.debug("Warning: no handler for message %s", _messageName);
return undefined;
};
-
+
var Messages = {
addHandler(handler) {
let originalSize = handlers.size;