Index: lib/filterComposer.js |
diff --git a/lib/filterComposer.js b/lib/filterComposer.js |
index ad6a434377614251f1c0c0b80d3b782b7f94daea..965488771a05300393ed6dcff2182bf8de302032 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 57 sometimes sets the status for a window to "complete" |
Wladimir Palant
2017/11/23 11:49:00
Nit: Please drop the version number, we don't know
kzar
2017/11/23 12:31:53
Done.
|
+ // 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); |
kzar
2017/11/21 15:39:20
Initially I retried every 100ms, but then I found
|
}); |
}; |
if (window.tabs[0].status != "complete") |