Oops, I've found that I mistakenly replaced the call to getServiceByContractID with getService when trying to get nsIPref - and that's was the problem. Now I'm able to get/set preferences including proxy server, the only question left is: how can I access the preferences which are set by user when running standalone Firefox?

Thanks,

Artem

Artem Ananiev wrote:

I have read some recent posts about profile management, but haven't found an answer to my question.

I'm still working on embedding Firefox into Java application using JavaXPCOM/Xulrunner. I want my application to work correctly with proxy server. First thing I tried was to load a profile, but the call to

  (nsIProfile)serviceManager.getServiceByContractID(
    "@mozilla.org/profile/manager;1",
     nsIProfile.NS_IRPROFILE_IID)

threw an exception (I beleive it is the value of NS_PROFILE_CONTRACTID). As I understand it is caused by the fact that Firefox is compiled with single profile support.

Then I thought that if there is a single profile used by Firefox, then it is loaded automatically. It seems that it isn't: if I load "about:config" I can see that all the proxy settings are off, while proxy server is defined if I run standalone Firefox.

At last, I tried to set proxy server manually, by using nsIPref service. Again, I've got NS_ERROR_FACTORY_NOT_REGISTERED for a call to

  (nsIPref)serviceManager.getServiceByContractID(
    "@mozilla.org/preferences;1",
    nsIPref.NS_IPREF_IID);

How can I specify proxy server in my application then?

Thanks,

Artem

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to