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

Unified Diff: lib/filterComposer.js

Issue 29636640: Issue 6183 - Reduce "Receiving end does not exist" exceptions (Closed)
Patch Set: Send the message, but ignore failures Created Dec. 20, 2017, 3:39 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 | « no previous file | 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 3759ca58e9875ccaa175310f6bd9dab52285b7dd..e55a4fc6e19d4993d4a1c8c737ae1e5a6e4859a0 100644
--- a/lib/filterComposer.js
+++ b/lib/filterComposer.js
@@ -321,7 +321,13 @@ port.on("composer.quoteCSS", (message, sender) =>
ext.pages.onLoading.addListener(page =>
{
- // A newly opened tab that is still loading has its URL set to about:blank
- if (/^https?:/.test(page.url.protocol))
- page.sendMessage({type: "composer.content.finished"});
+ // When tabs start loading we send them a message to ensure that the state
+ // of the "block element" tool is reset. This is necessary since Firefox will
+ // sometimes cache the state of a tab when the user navigates back / forward,
+ // which includes the state of the "block element" tool.
+ // Since sending this message will often fail (e.g. for new tabs which have
+ // just been opened) we catch and ignore any exception thrown.
+ browser.tabs.sendMessage(
+ page.id, {type: "composer.content.finished"}
+ ).catch(() => {});
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld