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

Unified Diff: lib/filterComposer.js

Issue 29632569: Issue 6113 - Improve reliability of "block element" dialog (Closed)
Patch Set: Simplify response checking logic Created Dec. 12, 2017, 12:31 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
« no previous file with comments | « 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 fe6d51eb9b0bb32f0fc574dced0c2b81a39a3352..3759ca58e9875ccaa175310f6bd9dab52285b7dd 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)
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 (!response)
+ 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")
« no previous file with comments | « composer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld