code review, fixes #383

pull/2/head
Raymond Hill 10 years ago committed by gorhill
parent 6d5361cebc
commit c168d050f0

@ -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;
};
/******************************************************************************/

Loading…
Cancel
Save