Seems that there are at least 3 different contexts in which JS runs:
- The page script(s)
- The content script(s)
- The background aka service-worker script(s)
Popups can too run JS. What context is this JS running in? Is it its own context? Are there docs explaining the available contexts and key the key features of each? Wasn't able to find an overview or other useful information in the Core Concepts section of the chrome dev docs.