1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

code review

This commit is contained in:
gorhill 2014-09-14 18:23:12 -04:00
parent fa88ba77fd
commit 1e464ccb4a

View File

@ -201,8 +201,7 @@ var onDisconnect = function(port) {
listener(msg, port.sender, nullFunc);
// Cleanup port if no longer in use.
port = nameToPortMap[port.name];
if ( port ) {
if ( nameToPortMap.hasOwnProperty(port.name) ) {
delete nameToPortMap[port.name];
port.onMessage.removeListener(onMessage);
port.onDisconnect.removeListener(onDisconnect);