Re: How to allow 'UniversalXPConnect' privilege dynamically
guido <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xpfe |
|---|---|
| Message-ID | <[email protected]> |
> On 10/26/2011 11:58 AM, guido wrote:
>> Hi All,
>>
>> I'm working on a XUL application that displays remote xul pages from a
>> server.
>>
>> In order to avoid prompting a warning alert to the user,
>> I'm giving UniversalXPConnect privilege to the default server by setting
>> the following prefs on the client-side application:
> remote XUL is disabled in the latest firefox releases, but there is a
> plugin that enables to whitelist a server.
> i have such an application myself, but we have totake intoaccount that
> one day or another, they are going to remove the remote XUL from the
> codebase....
>
> jef
Hi Jef,
thanks for your reply.
I' aware about that plugin for whitelisting a server. I'll try to browse
that code again.
Can anyone else provide an example of using the interface nsIPrincipal?
Many thanks,
Guido.
>>
>> user_pref("capability.principal.codebase.p1.granted",
>> "UniversalXPConnect");
>> user_pref("capability.principal.codebase.p1.id",
>> "http://defaultServer.com");
>> user_pref("capability.principal.codebase.p1.subjectName", "");
>>
>> This is done at installation time by the installer and it works just
>> fine.
>>
>> Now I also want to write a configuration tool (that it's again a XUL
>> application) to edit the server URL. The user is asked to enter the new
>> URL in a form and
>> I want to give UniversalXPConnect privilege to this server as well.
>>
>> Here comes the issue.
>> I didn't find a way to allow the privilege and the user is prompted with
>> the warning dialog the first time he tries to access the new server
>>
>> Things I tried :
>>
>> 1) Using the nsIPrincipal interface but I didn't find much documentation
>> about it.
>> Can you provide an example of using it?
>>
>> 2) Editing the prefs file from my script (by using nsIPrefBranch) and
>> adding the following lines
>>
>> user_pref("capability.principal.codebase.p2.granted",
>> "UniversalXPConnect");
>> user_pref("capability.principal.codebase.p2.id",
>> "http://newServer.com");
>> user_pref("capability.principal.codebase.p2.subjectName", "");
>>
>> but the "id" preference gets never written. Do you know why?
>>
>>
>> Any idea how can this be solved?
>>
>> Many thanks,
>>
>> Guido.
>>
>
> _______________________________________________
> dev-tech-xul mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-xul