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

Issue 29715759: Issue 6440 - Use long-lived connections to listen to extension events (Closed)

Created:
March 6, 2018, 6:35 p.m. by Thomas Greiner
Modified:
March 14, 2018, 9:44 a.m.
Reviewers:
a.giammarchi, saroyanm
Visibility:
Public.

Description

This review contains the following changes: - UI pages now have to register listeners using `browser.runtime.connect()` instead of `browser.runtime.sendMessage()` - Background page will respond using `postMessage()` on the port instead of using `sendMessage()` on the page - Only pass on first argument we receive from `FilterNotifier` listener (none of the UI pages use any of the other ones) Later on we could also receive all other messages via that very same port that's introduced in this review.

Patch Set 1 #

Total comments: 3

Patch Set 2 : Use less generic name for only listener argument we care about #

Total comments: 6

Patch Set 3 : Fixed linting errors #

Patch Set 4 : Added message passing mock for ports #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+168 lines, -114 lines) Patch
M ext/background.js View 1 2 3 2 chunks +27 lines, -49 lines 0 comments Download
M ext/common.js View 1 2 3 1 chunk +38 lines, -0 lines 4 comments Download
M ext/content.js View 1 2 3 2 chunks +18 lines, -1 line 0 comments Download
M firstRun.js View 1 chunk +5 lines, -2 lines 0 comments Download
M js/desktop-options.js View 2 chunks +7 lines, -5 lines 0 comments Download
M messageResponder.js View 1 2 9 chunks +67 lines, -53 lines 0 comments Download
M mobile-options.js View 1 chunk +6 lines, -4 lines 0 comments Download

Messages

Total messages: 14
Thomas Greiner
This is pretty much just the bare minimum that's required to make the UI responsive ...
March 6, 2018, 6:59 p.m. (2018-03-06 18:59:39 UTC) #1
a.giammarchi
https://codereview.adblockplus.org/29715759/diff/29715760/messageResponder.js File messageResponder.js (right): https://codereview.adblockplus.org/29715759/diff/29715760/messageResponder.js#newcode134 messageResponder.js:134: sendMessage(type, action, args[0]); I understand you want to keep ...
March 7, 2018, 8:14 a.m. (2018-03-07 08:14:29 UTC) #2
Thomas Greiner
https://codereview.adblockplus.org/29715759/diff/29715760/messageResponder.js File messageResponder.js (right): https://codereview.adblockplus.org/29715759/diff/29715760/messageResponder.js#newcode134 messageResponder.js:134: sendMessage(type, action, args[0]); On 2018/03/07 08:14:29, a.giammarchi wrote: > ...
March 7, 2018, 2:05 p.m. (2018-03-07 14:05:31 UTC) #3
saroyanm
Just a couple of comments. https://codereview.adblockplus.org/29715759/diff/29716579/firstRun.js File firstRun.js (right): https://codereview.adblockplus.org/29715759/diff/29716579/firstRun.js#newcode73 firstRun.js:73: let port = browser.runtime.connect({name: ...
March 7, 2018, 5:49 p.m. (2018-03-07 17:49:45 UTC) #4
Thomas Greiner
https://codereview.adblockplus.org/29715759/diff/29716579/firstRun.js File firstRun.js (right): https://codereview.adblockplus.org/29715759/diff/29716579/firstRun.js#newcode73 firstRun.js:73: let port = browser.runtime.connect({name: "ui"}); On 2018/03/07 17:49:44, saroyanm ...
March 7, 2018, 7:19 p.m. (2018-03-07 19:19:39 UTC) #5
a.giammarchi
not sure what Manvel thinks but this now LGTM
March 12, 2018, 12:36 p.m. (2018-03-12 12:36:44 UTC) #6
saroyanm
Looks good to me as well: LGTM https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js File ext/common.js (right): https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js#newcode78 ext/common.js:78: class Port ...
March 12, 2018, 1:08 p.m. (2018-03-12 13:08:28 UTC) #7
a.giammarchi
https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js File ext/common.js (right): https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js#newcode78 ext/common.js:78: class Port On 2018/03/12 13:08:28, saroyanm wrote: > I ...
March 12, 2018, 1:17 p.m. (2018-03-12 13:17:31 UTC) #8
Thomas Greiner
https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js File ext/common.js (right): https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js#newcode78 ext/common.js:78: class Port On 2018/03/12 13:17:31, a.giammarchi wrote: > On ...
March 13, 2018, 6:24 p.m. (2018-03-13 18:24:46 UTC) #9
a.giammarchi
https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js File ext/common.js (right): https://codereview.adblockplus.org/29715759/diff/29716652/ext/common.js#newcode78 ext/common.js:78: class Port On 2018/03/13 18:24:45, Thomas Greiner wrote: > ...
March 14, 2018, 7:51 a.m. (2018-03-14 07:51:03 UTC) #10
Thomas Greiner
On 2018/03/14 07:51:03, a.giammarchi wrote: > AFAIK Opera 36 already supports Classes, but it's good ...
March 14, 2018, 9:27 a.m. (2018-03-14 09:27:31 UTC) #11
a.giammarchi
On 2018/03/14 09:27:31, Thomas Greiner wrote: > On 2018/03/14 07:51:03, a.giammarchi wrote: > > AFAIK ...
March 14, 2018, 9:36 a.m. (2018-03-14 09:36:30 UTC) #12
a.giammarchi
On 2018/03/14 09:36:30, a.giammarchi wrote: > On 2018/03/14 09:27:31, Thomas Greiner wrote: > > On ...
March 14, 2018, 9:37 a.m. (2018-03-14 09:37:02 UTC) #13
a.giammarchi
March 14, 2018, 9:44 a.m. (2018-03-14 09:44:16 UTC) #14
Message was sent while issue was closed.
FYI: I've filed a PR to MDN =>
https://github.com/mdn/browser-compat-data/pull/1366

It's also not the first time we base assumptions over MDN but unfortunately MDN
is like any other documentation: it's not always updated and sometimes not fully
reliable. We should always check for real when it's possible (same goes for
caniuse)

Powered by Google App Engine
This is Rietveld