Jimmy Chen wrote:
>
> In xpcom/sample/xpconnect-sample.html, there are two lines
> that I don't understand, can someone tell me what they are:
>
> 1. netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
> - what's it doing ?
> - what's this "netscape" object ?
> - where is it created ?
This is how one accesses the JavaScript security system in order
to tell it you'd like to do a restricted activity. This is how it
has worked since Netscape 4.0. The naming scheme is based on its
original implementation in Java accessed from JS using
liveconnect. There are lots of docs on the web...
http://google/search?q=netscape.security.PrivilegeManager
The "UniversalXPConnect" part is a mozilla specific target that
tells the system that what you want to do is use xpconnect stuff.
You'll discover that for web content the security system may well
disallow this.
>
> 2. var sample =
> Components.classes["@mozilla.org/sample;1"].createInstance();
> - What's this "Components" object ?
> - where is it created ?
http://mozilla.org/scriptable/components_object.html
John.
>
> many thanks,
> Jimmy