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: Rebased, addressed Wladimir's feedback Created Nov. 23, 2017, 12:29 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.js ('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..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")
« composer.js ('K') | « composer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld