Index: lib/filterComposer.js |
diff --git a/lib/filterComposer.js b/lib/filterComposer.js |
index ad6a434377614251f1c0c0b80d3b782b7f94daea..304aac40647e3144042119453262a2d5ed807d0e 100644 |
--- a/lib/filterComposer.js |
+++ b/lib/filterComposer.js |
@@ -226,12 +226,24 @@ port.on("composer.openDialog", (message, sender) => |
{ |
let popupPageId = window.tabs[0].id; |
+ let doInitAttempt = 0; |
let doInit = () => |
{ |
+ doInitAttempt += 1; |
+ if (doInitAttempt > 3) |
+ return; |
+ |
browser.tabs.sendMessage(popupPageId, { |
type: "composer.dialog.init", |
sender: sender.page.id, |
filters: message.filters |
+ }).catch(e => |
+ { |
+ // Firefox sometimes sets the status for a window to "complete" before |
+ // it is ready to receive messages[1]. As a workaround we'll try again a |
+ // few times with a second delay. |
+ // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1418655 |
+ setTimeout(doInit, 1000); |
}); |
}; |
if (window.tabs[0].status != "complete") |