Hello.

I'm trying interact with embedded Mozilla's javascript using C++ code
(create function, create property, invoke function, get/set property).
To be able to do this I need a global JSObject and JSContext of the
running thread. I get the the instances of these types as following:

nsIDOMWindow *domWindow = NS_REINTERPRET_CAST(nsIDOMWindow*,
jdomWindow);
nsCOMPtr<nsIScriptGlobalObject>
scriptObj(do_QueryInterface(domWindow));
nsCOMPtr<nsIScriptContext> scriptContext(scriptObj->GetContext());
JSContext* cx = NS_REINTERPRET_CAST(JSContext*, scriptContext-
>GetNativeContext());
JSObject* scriptWindow = reinterpret_cast<JSObject*>(scriptObj-
>GetGlobalJSObject());

My application is a plugin to another application (main application)
which actually embeds Mozilla. So, I can't do anything requiring
initializing stage. I just have nsIWebBrowser instance only. I'm not
able neither modify main application nor modify mozilla's installation
(the main application should work with any installed mozilla or
xulrunner which it found in system). So, using non-frozen interfaces
may cause a crash and I need to provide a binary for every version of
mozilla. Is there any way to get the data I needed using frozen API
only? Or is there any quite different way interacting with JS from
embedding app?

--
Alexander Mitin

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to