android – Getting a GeckoSession's tab id?-ThrowExceptions

Exception or error:

I am trying to create 2 GeckoSessions to represent two tabs.

I have a web extension with a background script. I want to send a separate message to each tab’s content script, but for that I need to know the tab id (I don’t want to send the messages to all tabs because each tab can have the same page loaded).

What would be the best way to get the tab id of each GeckoSession object?

How to solve:

A GeckoSession‘s tabId is not currently exposed to the GeckoView API. The normal way this would be done is opening a port directly from the content script calling connectNative, which triggers an onConnect on the MessageDelegate. You can then hold on onto the Port objects in Java and send messages directly to the content script, there’s an example here:

Leave a Reply

Your email address will not be published. Required fields are marked *