Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 288
Yosi Avatar asked Nov 14 '22 14:11

Yosi


1 Answers

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.

like image 130
abraham Avatar answered Jan 11 '23 05:01

abraham