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

Unified Diff: js/desktop-options.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') | « firstRun.js ('k') | messageResponder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: js/desktop-options.js
===================================================================
--- a/js/desktop-options.js
+++ b/js/desktop-options.js
@@ -1419,7 +1419,9 @@
}
}
-ext.onMessage.addListener((message) =>
+let port = browser.runtime.connect({name: "ui"});
+
+port.onMessage.addListener((message) =>
{
switch (message.type)
{
@@ -1450,21 +1452,21 @@
}
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "app.listen",
filter: ["addSubscription", "focusSection"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "filters.listen",
filter: ["added", "loaded", "removed"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "prefs.listen",
filter: ["notifications_ignoredcategories", "notifications_showui",
"show_devtools_panel", "shouldShowBlockElementMenu",
"ui_warn_tracking"]
});
-browser.runtime.sendMessage({
+port.postMessage({
type: "subscriptions.listen",
filter: ["added", "disabled", "homepage", "lastDownload", "removed",
"title", "downloadStatus", "downloading"]
« ext/common.js ('K') | « firstRun.js ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld