code review, fixes #383

This commit is contained in:
Raymond Hill 2014-11-29 01:00:45 -02:00
parent d68f1624df
commit a087190847
1 changed files with 1 additions and 3 deletions

View File

@ -251,7 +251,7 @@ vAPI.messaging.onPortMessage = function(request, port) {
if ( request.requestId !== undefined ) {
callback = function(response) {
// https://github.com/gorhill/uBlock/issues/383
if ( port.disconnected === true ) {
if ( vAPI.messaging.ports.hasOwnProperty(port.name) === false ) {
return;
}
port.postMessage({
@ -292,8 +292,6 @@ vAPI.messaging.onPortDisconnect = function(port) {
port.onDisconnect.removeListener(vAPI.messaging.onPortDisconnect);
port.onMessage.removeListener(vAPI.messaging.onPortMessage);
delete vAPI.messaging.ports[port.name];
// https://github.com/gorhill/uBlock/issues/383
port.disconnected = true;
};
/******************************************************************************/