Each browsing context has a separate JavaScript environment.
According to the W3C's HTML5 spec on Web APIs:
Whenever a new Window
object is created, it must also create a script settings object...
When the script settings object is created, for each language supported by the user agent, create an appropriate execution environment as defined by the relevant specification.
This requires that every browsing context (i.e., every page in a tab, frame, etc.) have a separate realization of the JavaScript environment. This means that every single page must have a different object for each page (thereby failing a ==
check) for environmental objects, constructors, and other functions.