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(() => {}); |
}); |