From 97d4c22669087a2fcfae8861f94c946b898920f2 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 5 Sep 2018 15:51:43 +0200 Subject: Work-around for a potential race condition in message handling on extension updates. --- src/content/content.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/content/content.js') 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; -- cgit v1.2.3