Bug
1688040 - part10.2: Return existing ExtensionPort instance based on the ExtensionPortDescriptor portId. r=baku
The extensions expect that ExtensionPort instances they get in the calls to the
port event listeners to always be the same, and to be also strictly equal to the
object port got from browser.runtime.connect or browser.runtime.onConnect:
```
const port = browser.runtime.connect();
port.onDisconnect.addListener(disconnectedPort => {
// port === disconnectedPort => true
});
```
This patch does add an extension port lookup map in the ExtensionBrowser
class and a new ExtensionBrowser::GetPort method which is responsible of
providing the expected behavior (returning an existing istance if one is
found in the lookup map).
Differential Revision: https://phabricator.services.mozilla.com/
D107554