OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 var MessageEventTarget = function() | 57 var MessageEventTarget = function() |
58 { | 58 { |
59 WrappedEventTarget.call(this, (chrome.runtime || {}).onMessage || chrome.ext
ension.onRequest); | 59 WrappedEventTarget.call(this, (chrome.runtime || {}).onMessage || chrome.ext
ension.onRequest); |
60 }; | 60 }; |
61 MessageEventTarget.prototype = { | 61 MessageEventTarget.prototype = { |
62 __proto__: WrappedEventTarget.prototype, | 62 __proto__: WrappedEventTarget.prototype, |
63 _wrapListener: function(listener) { | 63 _wrapListener: function(listener) { |
64 return function(message, sender, sendResponse) | 64 return function(message, sender, sendResponse) |
65 { | 65 { |
66 listener(message, {tab: sender.tab && new Tab(sender.tab)}, sendResponse
); | 66 return listener(message, {tab: sender.tab && new Tab(sender.tab)}, sendR
esponse); |
67 }; | 67 }; |
68 } | 68 } |
69 }; | 69 }; |
70 | 70 |
71 | 71 |
72 /* API */ | 72 /* API */ |
73 | 73 |
74 ext = { | 74 ext = { |
75 backgroundPage: { | 75 backgroundPage: { |
76 sendMessage: (chrome.runtime || {}).sendMessage || chrome.extension.sendRe
quest, | 76 sendMessage: (chrome.runtime || {}).sendMessage || chrome.extension.sendRe
quest, |
77 getWindow: chrome.extension.getBackgroundPage | 77 getWindow: chrome.extension.getBackgroundPage |
78 }, | 78 }, |
79 getURL: chrome.extension.getURL, | 79 getURL: chrome.extension.getURL, |
80 onMessage: new MessageEventTarget(), | 80 onMessage: new MessageEventTarget(), |
81 i18n: chrome.i18n | 81 i18n: chrome.i18n |
82 }; | 82 }; |
83 })(); | 83 })(); |
OLD | NEW |