I'm reading the Firefox source code and I would like to know how to create some global functions.
I can't find where the window object is created or how to define some global objects to be accessed by scripts.
I would like to know where to begin or at least where the window object is defined and created, thanks!
The window
object is mostly defined in nsGlobalWindow.cpp. The public methods/properties belong to nsIDOMWindow, nsIDOMJSWindow, nsIDOMEventTarget, nsIDOMStorageIndexedDB and some other interfaces (look for NS_INTERFACE_MAP_ENTRY
macros but not all of them refer to public interfaces).
In addition, as any DOM object it can have expando properties (properties set by script). Some of these expando properties are set automatically when the DOM wrapper is created (nsWindowSH class). In particular, components implementing nsIDOMGlobalPropertyInitializer can set properties at that stage, or components listening to content-document-global-created notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With