From 151c26da5ca176a35b1e1e9a72c0ca53a96c2379 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 28 Nov 2014 16:13:56 -0200 Subject: [PATCH] this fixes #380 --- platform/chromium/vapi-background.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index ce88e4964..890af5454 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -250,6 +250,10 @@ vAPI.messaging.onPortMessage = function(request, port) { var callback = vAPI.messaging.NOOPFUNC; if ( request.requestId !== undefined ) { callback = function(response) { + // https://github.com/gorhill/uBlock/issues/383 + if ( port.disconnected === true ) { + return; + } port.postMessage({ requestId: request.requestId, portName: request.portName, @@ -288,6 +292,8 @@ 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; }; /******************************************************************************/