Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterComposer.js

Issue 29613777: Issue 5817 - Retry sending suggested filters to block element dialog (Closed)
Patch Set: Created Nov. 21, 2017, 3:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« composer.html ('K') | « composer.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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")
« composer.html ('K') | « composer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld