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: Created Dec. 7, 2017, 1:17 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..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")
« no previous file with comments | « composer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld