| Index: ext/common.js |
| =================================================================== |
| --- a/ext/common.js |
| +++ b/ext/common.js |
| @@ -45,16 +45,25 @@ |
| return frames; |
| } |
| var EventTarget = global.ext._EventTarget = function(port, windowID) |
| { |
| this._port = port; |
| this._windowID = windowID; |
| + this.addListener((payload, sender, resolve) => |
| + { |
| + if (payload.type) |
| + { |
| + let result = this._port._dispatch(payload.type, payload, sender); |
| + if (typeof result != "undefined") |
| + resolve(result); |
| + } |
| + }); |
| }; |
| EventTarget.prototype = { |
| addListener: function(listener) |
| { |
| var wrapper = (message, sender) => |
| { |
| if (this._windowID && this._windowID != message.targetID) |
| return undefined; |