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

Issue 29338275: Issue 3499 - Create a clean messaging API for internal use (Closed)

Created:
March 15, 2016, 10:57 a.m. by Wladimir Palant
Modified:
April 18, 2016, 10:32 a.m.
Visibility:
Public.

Description

Issue 3499 - Create a clean messaging API for internal use Repository: hg.adblockplus.org/adblockplus

Patch Set 1 #

Total comments: 10

Patch Set 2 : Fixed copyright year #

Total comments: 38

Patch Set 3 : Allow duplicate callbacks, introduce isPromise() function, minor changes #

Patch Set 4 : Don't store all responses unnecessarily #

Unified diffs Side-by-side diffs Delta from patch set Stats (+329 lines, -1 line) Patch
M lib/child/bootstrap.js View 1 chunk +1 line, -1 line 0 comments Download
A lib/messaging.js View 1 2 3 1 chunk +328 lines, -0 lines 0 comments Download

Messages

Total messages: 16
Wladimir Palant
March 15, 2016, 10:57 a.m. (2016-03-15 10:57:25 UTC) #1
Erik
On 2016/03/15 10:57:25, Wladimir Palant wrote: So much of the event related code is implemented ...
March 15, 2016, 8:27 p.m. (2016-03-15 20:27:54 UTC) #2
Erik
On 2016/03/15 10:57:25, Wladimir Palant wrote: The overall approach looks good to me!
March 15, 2016, 8:38 p.m. (2016-03-15 20:38:06 UTC) #3
Erik
https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode69 lib/messaging.js:69: function getSender(origin) I'm not quire sure when this would ...
March 15, 2016, 10:56 p.m. (2016-03-15 22:56:36 UTC) #4
Wladimir Palant
On 2016/03/15 20:27:54, Erik wrote: > So much of the event related code is implemented ...
March 16, 2016, 9:45 a.m. (2016-03-16 09:45:16 UTC) #5
Sebastian Noack
https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode3 lib/messaging.js:3: * Copyright (C) 2006-2015 Eyeo GmbH It's 2016. https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode31 ...
March 16, 2016, 10:44 a.m. (2016-03-16 10:44:13 UTC) #6
Wladimir Palant
https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode3 lib/messaging.js:3: * Copyright (C) 2006-2015 Eyeo GmbH On 2016/03/16 10:44:13, ...
March 16, 2016, 11:04 a.m. (2016-03-16 11:04:50 UTC) #7
Sebastian Noack
https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode251 lib/messaging.js:251: callbacks.splice(index, 1); If a listener is temporarily added we ...
March 16, 2016, 11:53 a.m. (2016-03-16 11:53:32 UTC) #8
Wladimir Palant
https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338276/lib/messaging.js#newcode251 lib/messaging.js:251: callbacks.splice(index, 1); On 2016/03/16 11:53:32, Sebastian Noack wrote: > ...
March 16, 2016, 1:12 p.m. (2016-03-16 13:12:54 UTC) #9
Erik
On 2016/03/15 10:57:25, Wladimir Palant wrote: LGTM, I only mentioned some minor things.
March 17, 2016, 5:01 a.m. (2016-03-17 05:01:52 UTC) #10
Erik
https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#newcode58 lib/messaging.js:58: if (typeof response == "undefined") nit `==` -> `===` ...
March 17, 2016, 5:02 a.m. (2016-03-17 05:02:05 UTC) #11
Thomas Greiner
https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#newcode49 lib/messaging.js:49: return response; Detail: What's the reason for not using ...
March 17, 2016, 12:09 p.m. (2016-03-17 12:09:26 UTC) #12
Wladimir Palant
https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#newcode49 lib/messaging.js:49: return response; On 2016/03/17 12:09:26, Thomas Greiner wrote: > ...
March 21, 2016, 3:31 p.m. (2016-03-21 15:31:34 UTC) #13
Thomas Greiner
https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#newcode182 lib/messaging.js:182: responses.push(payload); On 2016/03/21 15:31:31, Wladimir Palant wrote: > On ...
March 21, 2016, 6:43 p.m. (2016-03-21 18:43:23 UTC) #14
Wladimir Palant
https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js File lib/messaging.js (right): https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#newcode182 lib/messaging.js:182: responses.push(payload); On 2016/03/21 18:43:22, Thomas Greiner wrote: > So ...
March 21, 2016, 8:42 p.m. (2016-03-21 20:42:35 UTC) #15
Thomas Greiner
March 22, 2016, 11:15 a.m. (2016-03-22 11:15:08 UTC) #16
LGTM

https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js
File lib/messaging.js (right):

https://codereview.adblockplus.org/29338275/diff/29338401/lib/messaging.js#ne...
lib/messaging.js:196: callbacks = callbacks.slice();
On 2016/03/21 20:42:34, Wladimir Palant wrote:
> On 2016/03/21 18:43:22, Thomas Greiner wrote:
> > Of course, in theory it could happen because it's not a "private" variable.
> > However, that'd require other code to access `_callbacks` from outside which
> > it's not supposed to do.
> 
> No, it would merely have to call port.off(arguments.callee). This would modify
> the list of callbacks right under our feet.

Ah, right. Nevermind then.

Powered by Google App Engine
This is Rietveld