Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is the "window" object defined or created in firefox source code

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!

like image 994
user1108486 Avatar asked Nov 05 '22 09:11

user1108486


1 Answers

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.

like image 95
Wladimir Palant Avatar answered Nov 15 '22 09:11

Wladimir Palant