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

Unified Diff: mobile-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') | « messageResponder.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mobile-options.js
===================================================================
--- a/mobile-options.js
+++ b/mobile-options.js
@@ -411,19 +411,21 @@
}
}
}
- ext.onMessage.addListener(onMessage);
- browser.runtime.sendMessage({
+ let port = browser.runtime.connect({name: "ui"});
+ port.onMessage.addListener(onMessage);
+
+ port.postMessage({
type: "app.listen",
filter: ["addSubscription", "showPageOptions"]
});
- browser.runtime.sendMessage({
+ port.postMessage({
type: "filters.listen",
filter: ["added", "removed"]
});
- browser.runtime.sendMessage({
+ port.postMessage({
type: "subscriptions.listen",
filter: ["added", "disabled", "removed", "title"]
});
« ext/common.js ('K') | « messageResponder.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld