Index: lib/filterComposer.js |
diff --git a/lib/filterComposer.js b/lib/filterComposer.js |
index fe6d51eb9b0bb32f0fc574dced0c2b81a39a3352..d16a0b826730a600bd94e8634c9b5211675c4b21 100644 |
--- a/lib/filterComposer.js |
+++ b/lib/filterComposer.js |
@@ -238,20 +238,26 @@ port.on("composer.openDialog", (message, sender) => |
let doInit = () => |
{ |
doInitAttempt += 1; |
- if (doInitAttempt > 3) |
+ if (doInitAttempt > 30) |
kzar
2017/12/07 13:28:33
With other versions of Firefox e.g. 57 I found tha
|
return; |
browser.tabs.sendMessage(popupPageId, { |
type: "composer.dialog.init", |
sender: sender.page.id, |
filters: message.filters |
+ }).then(response => |
+ { |
+ // Sometimes sendMessage incorrectly reports a success on Firefox, so |
+ // we must check the response too. |
+ if (typeof response == "undefined") |
Wladimir Palant
2017/12/12 12:14:52
Nit: why not `if (!response)`?
kzar
2017/12/12 12:33:14
Done.
|
+ throw new Error(); |
}).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); |
+ setTimeout(doInit, 100); |
}); |
}; |
if (window.tabs[0].status != "complete") |