On Mar 8, 9:23 pm, Boris Zbarsky <bzbar...@mit.edu> wrote:
> On 3/8/11 11:00 AM, Darth Coder wrote:
>
> > The app was originally written to work with the Firefox 2.0 code base
> > and it used to work fine. Now the code has to be moved to Mozilla
> > 1.9.2.12. The client app is essentially a web browser container (using
> > embedded Gecko) into which a special HTML page is loaded and when the
> > page is fully loaded (captured via the nsIWebProgressListener), a JS
> > Function contained within the page is explicitly called from the
> > Native C++ code. The code is written such that it obtains the
> > JSContext and JSGlobalObject from the html page's dom (nsIDocument
> > object) and then calls the JS_CallFunctionName method with the name of
> > the JS function to execute.
>
> But you don't push the relevant JSContext on the xpconnect stack?  That
> would cause your assertion failures for sure.
>
> > I am not sure if this is no longer the right way to achieve this, if
> > this is not right, please let me know the proper way to achieve this.
>
> If you're not pushing the right JSContext on the stack, then you were
> never doing it the "right" way.  It's just that now we added asserts for
> the security fail that results....
>
> You probably want to look at what nsJSContext::CallEventHandler does
> before the JS_CallFunctionValue call it makes.
>
> -Boris

After stepping through the code, I have confirmed that the XPConnect
stack is the issue. The relevant JSContext is not on the stack top and
hence the Assert fails. So what exactly is the proper way to achieve
this. i.e If I have a nsIWebBrowser object in my C++ code with me and
I have a HTML page loaded, How can I call a JS Function (by name) that
is present in that HTML page.
_______________________________________________
dev-embedding mailing list
dev-embedding@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to