1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 03:05:22 +02:00
This commit is contained in:
Raymond Hill 2014-11-24 13:40:05 -02:00
parent 2ae09084e0
commit e822616b06

View File

@ -21,6 +21,8 @@
// For non background pages
/* global self, chrome, vAPI */
/******************************************************************************/
(function() {
@ -39,11 +41,15 @@ var messagingConnector = function(response) {
return;
}
var channels = vAPI.messaging.channels;
var channel, listener;
if ( response.broadcast === true ) {
for ( channel in vAPI.messaging.channels ) {
listener = vAPI.messaging.channels[channel].listener;
for ( channel in channels ) {
if ( channels.hasOwnProperty(channel) === false ) {
continue;
}
listener = channels[channel].listener;
if ( typeof listener === 'function' ) {
listener(response.msg);
}
@ -58,7 +64,7 @@ var messagingConnector = function(response) {
}
if ( !listener ) {
channel = vAPI.messaging.channels[response.portName];
channel = channels[response.portName];
listener = channel && channel.listener;
}