On 8. Dec., 06:18 h., Boris Zbarsky <[email protected]> wrote: > On 12/7/09 9:15 AM, martin wrote: > > > it doesn't pass the 'if (rules)' condition and I wasn't able to find > > out what's wrong. > > You're calling this from C++, and presumably without JS on the stack, > and therefore end up failing the security check GetCSSRules does. Had > you checked the return value you would have known at least that you were > failing a security check... > > You may be able to work around this by pushing the document's JSContext > on the JS context stack, though if that context can be running script in > your situation and if that script is not same-origin with the stylesheet > (or heck, if the document is not same-origin with the stylesheet) you > won't get the rules. > > If this is Gecko 1.9.2 or later, you can probably use > pushContextPrincipal on the security manager to push a new jscontext and > the stylesheet's principal; that would guarantee things to work. > > -Boris
Hi Boris, Thank you for your answer. I have to tell that I'm not familiar with things like JSContext, nsIJSContextStack yet. I tried to push current JSContext on the stack, but no success. Could you please provide some advice more in detail please? I don't know how to retrieve document's JSContext. The Gecko version is lower then 1.9.2 unfortunately. What I'm trying to do is to retrieve all stylesheets, change it and set this new value. I just want to edit the document's CSS. If there's some better way to achieve this, please let me know. Probably I didn't choose the right way. Thank you! Martin _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
