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

Unified Diff: firstRun.js

Issue 29715759: Issue 6440 - Use long-lived connections to listen to extension events (Closed)
Patch Set: Added message passing mock for ports Created March 7, 2018, 7:10 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
« ext/common.js ('K') | « ext/content.js ('k') | js/desktop-options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firstRun.js
===================================================================
--- a/firstRun.js
+++ b/firstRun.js
@@ -70,14 +70,17 @@
updateSocialLinks();
- ext.onMessage.addListener((message) =>
+ let port = browser.runtime.connect({name: "ui"});
+
+ port.onMessage.addListener((message) =>
{
if (message.type == "subscriptions.respond")
{
updateSocialLinks();
}
});
- browser.runtime.sendMessage({
+
+ port.postMessage({
type: "subscriptions.listen",
filter: ["added", "removed", "updated", "disabled"]
});
« ext/common.js ('K') | « ext/content.js ('k') | js/desktop-options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld