MetaMask / metamask-snaps-beta

Fork of MetaMask that supports plugins! Read the Wiki!
https://github.com/MetaMask/metamask-snaps-beta/wiki
MIT License
144 stars 57 forks source link

self is not defined #153

Closed shanejonas closed 4 years ago

shanejonas commented 4 years ago

Describe the bug I have a nested dependency that relies on isomorphic-fetch, which i'm unable to load inside SES due to self not being defined.

To Reproduce Steps to reproduce the behavior:

  1. Use snaps-cli to init a new project
  2. Add const supported = "URLSearchParams" in self; to the code
  3. See error

Expected behavior As defined in the spec, self should exist and be the window object.

The window, frames, and self attributes' getters must return this Window object's relevant Realm.[[GlobalEnv]]'s EnvironmentRecord's [[GlobalThisValue]].

Source: https://html.spec.whatwg.org/multipage/window-object.html#dom-self

Screenshots image image

Browser details (please complete the following information):

Additional context https://github.com/github/fetch/issues/657#issuecomment-440248241