Re: Issues with linking Mozilla release binaries to an application debug target

Benjamin Smedberg <[email protected]>
Newsgroups gmane.comp.mozilla.devel.embedding
Message-ID <[email protected]>
On 3/8/2011 7:57 AM, Darth Coder wrote:
> I am trying to embed Mozilla 1.9.2.12 into an MFC application. With
> the release target everything is working fine, but the thing is that I
> want to use the release binaries (with debugging info) for the both
> the debug as well. For debug I am building the release using the
> following .mozconfig file
>
> MOZ_MAPINFO=1
> export MOZ_DEBUG_SYMBOLS=1
> ac_add_options --enable-application=browser
> ac_add_options --disable-debug
> ac_add_options --disable-optimize
> ac_add_options --disable-tests
> ac_add_options --enable-debugger-info-modules=yes
> ac_add_options --enable-jemalloc
>
> I can successfully build the debug target of my app using the release
> binaries built this way. But when I load a page, obtain corresponding
> nsIDocument object and try to call a method like
> GetScriptGlobalObject(), the call instead goes to the method declared
> immediately below it i.e SetScriptGlobalObject() and the app crashes
> inside this method. From what I can understand, the method pointers in
> the vptr table seem to be messed up due to some reason and incorrect
> methods are getting called. Does anyone have any info on what the
> reason might be for this and how to fix it?
There is very likely a method in one of the interfaces (nsIDocument or 
one of its parents) which is #ifdef DEBUG. You are compiling Mozilla 
*without* DEBUG, but perhaps you are compiling your code with DEBUG? 
They need to match.

> Second Issue:
>
> I am building a debug version of the same mozilla code base and
> linking with the debug target of my app. In this case too the app
> builds fine, but when I try to execute a JS function from the HTML
> document using the JS_CallFunctionName JSAPI, I am getting an assert
>
> cx == topJSContext, "wrong context on XPCJSContextStack!" from
> xpcquickstubs.cpp:xpc_qsAssertContextOK()
You should pretty much never be using raw JSAPI in this case. XPConnect 
(the XPCOM<->JS bridge) keeps track of the security principles on the 
stack for all calls, and you are making a call that XPConnect doesn't 
know about. Whatever you are doing, you should probably be doing it in a 
JS component/module, and not in binary code and JSAPI.

--BDS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.