summaryrefslogtreecommitdiff
path: root/src/content/content.js
diff options
context:
space:
mode:
authorhackademix2018-09-05 15:51:43 +0200
committerhackademix2018-09-05 15:51:43 +0200
commit97d4c22669087a2fcfae8861f94c946b898920f2 (patch)
treed7b56c72cd9b017165b8272515ad627ed244b0fb /src/content/content.js
parentec0d7b4aff0a383a7c611e9fd18e5813f7fbfad6 (diff)
downloadnoscript-97d4c22669087a2fcfae8861f94c946b898920f2.tar.gz
noscript-97d4c22669087a2fcfae8861f94c946b898920f2.tar.xz
noscript-97d4c22669087a2fcfae8861f94c946b898920f2.zip
Work-around for a potential race condition in message handling on extension updates.
Diffstat (limited to 'src/content/content.js')
-rw-r--r--src/content/content.js5
1 files changed, 5 insertions, 0 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;