Yosi
Yosi

Reputation: 2966

Attempting to use disconnect port object


In my chrome extension sometimes I have an error of "Attempting to use disconnected port object", in file : chrome/RendererExtensionBindings, in line number 159.

I checked in the chrome API and in my code base the next functions:

  1. chrome.tabs.connect
  2. chrome.extension.connect
  3. chrome.extension.onConnect (and onConnect external)

Because I know that they are the only using the Port object.. I am using only three methods for communication in my code base:

  1. chrome.tabs.onRequest
  2. chrome.tabs.sendRequest
  3. iframe messaging (postMessage and 'message' event listener)

In addition I don't know in which scenario it happens.. do you have suggestions? maybe I am wrong and this message can pop from chrome.tabs.onRequest/ chrome.tabs.sendRequest?

Thanks in advance,
- Yosy

Upvotes: 5

Views: 5489

Answers (1)

abraham
abraham

Reputation: 47833

I think your issue is with the iframe messaging. More specifically you are trying to postMessage to an iframe/window/tab that no longer exists. Try using the Developer Tools scripts tab to pause on uncaught exceptions.

Upvotes: 1

Related Questions