MetaMask / MetaMask/extension-port-stream

unchecked chrome.runtime.lastError

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
24
Forks
10
PR merge metrics
No merged PRs in 30d

Description

https://github.com/MetaMask/extension-port-stream/blob/6e32c73a5c7b66ede01fad9d8dc83e9991eed49f/src/index.ts#L14-L15

```
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
```
needs to be handled in this way per https://stackoverflow.com/a/56787332
```js
chrome.runtime.sendMessage('ping', response => {
if(chrome.runtime.lastError) {
// handle error
} else {
// handle response
}
}
```
looks like firefox also puts the error on the port obj
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port

also looks like the error is handled more normally for some promise based apis, but likely not relevant to our usage of port
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/lastError

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting src/index.ts at lines 14-15, then compare the port usage with the linked WebExtension runtime.lastError and Port documentation. The issue is done when the connection error is handled so it no longer produces an unchecked runtime.lastError warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.