No document object in background.js
- Dominant language
- TypeScript
- Stars
- 268
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use the metamask provider from a background script in a chrome extension, but background scripts have no document object so I'm being thrown a "document is not defined" error. This is due to this line:
https://github.com/MetaMask/providers/blob/87f33cf9bb5eb78e6224e7dac3a779016b2235c2/src/MetaMaskInpageProvider.ts#L119
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with src/MetaMaskInpageProvider.ts around line 119, the location identified as accessing document, and reproduce the provider initialization in a Chrome extension background script. Trace the initialization path and determine how it should behave without a document; done means the reported document-is-not-defined error no longer occurs in that context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100