jmp wrote:
 Gurus,

 I wrote an XPCOM component (in c++) that at some point loads an XML
 document using nsIDOMXMLDocument interface.

 When this XPCOM component is instanciated from a XUL dialog, it beahaves as 
expected...

 If I write some javascript and try to get the same thing from xpcshell, it fails
 lamentably.

 I have tracked this down to the following call, where it fails
 in the call to JS_GetScriptPrincipals().

The "shouldn't happen" case DO HAPPEN !!!!


It seems to be a limitation, a bug really, of xpcshell that it doesn't compile scripts with principals. Cc'ing timeless in case he's run into this one, and setting followup-to: m.jseng. Please feel free to file a bug against XPConnect.

/be



I have tried with build from Mozilla 1.4.2 and from mozilla 1.7.2. Same behavior!!!!

 has anyone here any ideas ????

 nsresult nsScriptSecurityManager::GetScriptPrincipal(JSContext *cx,
                                             JSScript *script,
                                             nsIPrincipal **result)
 {
     if (!script)
     {
         *result = nsnull;
         return NS_OK;
     }
     JSPrincipals *jsp = JS_GetScriptPrincipals(cx, script);
     if (!jsp) {
         // Script didn't have principals -- shouldn't happen.
         return NS_ERROR_FAILURE;
     }
     nsJSPrincipals *nsJSPrin = NS_STATIC_CAST(nsJSPrincipals *, jsp);
     *result = nsJSPrin->nsIPrincipalPtr;
     if (!*result)
         return NS_ERROR_FAILURE;
     NS_ADDREF(*result);
     return NS_OK;

 }

 Thanks

 JM


_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to