Where is the "windowed" object defined or created in firefox source code

I am reading the source code for Firefox, and I would like to know how to create some global functions.

I cannot find where the window object is being created, or how to identify some global objects that the scripts will access.

I would like to know where to start, or at least where the window object is defined and created, thanks!

+5
source share
3 answers

window nsGlobalWindow.cpp. / nsIDOMWindow, nsIDOMJSWindow, nsIDOMEventTarget, nsIDOMStorageIndexedDB ( NS_INTERFACE_MAP_ENTRY, ).

, DOM, expando (, script). expando DOM (nsWindowSH ). , , nsIDOMGlobalPropertyInitializer, , --.

+2

window - .

, , , window


, ( ):

var myVar = 123;

alert(myVar); // alerts 123
alert(window.myVar); // ALSO alerts 123
0

Am I really getting it wrong? Are you writing something in JavaScript?

If so, you can add windows to the object by simply declaring a variable in the global scope.

window.myvar = 123123;

Indeed, if you did not wrap your code in closure , you can simply do:

var myvar = "some value";
0
source

All Articles