Browse Source

code review, fixes #383

pull/2/head
Raymond Hill 10 years ago
committed by gorhill
parent
commit
c168d050f0
  1. 4
      platform/chromium/vapi-background.js

4
platform/chromium/vapi-background.js

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

Loading…
Cancel
Save