Hi every one, I'm upgrading my app wich using gecko from 1.8 to 1.9. I found a really weird problem that I got an exception in nsDocShell::EnsureScriptEnvironment() funcion when I try to create a dom window to load script code.
Here is my code : *********************************************************************************************** XPCOM_CREATE_MEMBER_INSTANCE_BY_CONTRACT_ID "@mozilla.org/embedding/ browser/nsWebBrowser;1",NULL,NS_GET_IID( nsIWebBrowser ), myWebBrowser ); nsCOMPtr< nsIDocShellTreeItem > dsti( do_QueryInterface( myWebBrowser ) ); dsti->SetItemType( nsIDocShellTreeItem::typeContentWrapper ); nsCOMPtr< nsIWebBrowserPersist > webBrowserPersist( do_QueryInterface( myWebBrowser ) ); if ( webBrowserPersist == NULL ) return; XPCOM_CREATE_MEMBER_INSTANCE_BY_CONTRACT_ID( "@mozilla.org/editor/ editingsession;1", NULL, NS_GET_IID( nsIWebProgressListener ), mySessionListener ); webBrowserPersist->SetProgressListener( mySessionListener ); nsCOMPtr< nsIBaseWindow > baseWindow = do_QueryInterface( myWebBrowser ); nsCOMPtr<nsIWidget> mWindow; nsCOMPtr< nsIComponentManager > componentManager; result = NS_GetComponentManager( getter_AddRefs( componentManager ) ); result = componentManager->CreateInstance(kWindowCID, nsnull, kIWidgetIID, getter_AddRefs(mWindow)); nsWidgetInitData initData; initData.mWindowType = eWindowType_toplevel; initData.mBorderStyle = eBorderStyle_default; nsRect r(0, 0, 100, 100); mWindow->Create((nsIWidget*)NULL, r, HandleBrowserEvent, nsnull, nsnull, nsnull, &initData); mWindow->GetClientBounds(r); result = baseWindow->InitWindow( mWindow- >GetNativeData(NS_NATIVE_WIDGET), NULL, 0, 0, 64, 48 ); result = baseWindow->Create(); ... ************************************************************************ Call Stack: ------------------------------------------------------------------------------------------ xul.dll!nsDocShell::EnsureScriptEnvironment() Line 8994 xul.dll!nsDocShell::GetInterface(const nsID & aIID={...}, void * * aSink=0x0012ce24) Line 454 + 0x45 bytes xul.dll!nsWebShell::GetInterface(const nsID & aIID={...}, void * * aInstancePtr=0x0012ce24) Line 635 xul.dll!nsGetInterface::operator()(const nsID & aIID={...}, void * * aInstancePtr=0x0012ce24) Line 52 + 0x21 bytes xul.dll!nsCOMPtr<nsIDOMWindow>::assign_from_helper(const nsCOMPtr_helper & helper={...}, const nsID & aIID={...}) Line 1335 + 0x13 bytes xul.dll! nsCOMPtr<nsIDOMWindow>::nsCOMPtr<nsIDOMWindow>(const nsCOMPtr_helper & helper={...}) Line 695 xul.dll!nsWebBrowser::GetContentDOMWindow(nsIDOMWindow * * _retval=0x0012cf90) Line 412 xul.dll!nsWebBrowser::Create() Line 1207 + 0x2d bytes -------------------------------------------------------------------------------------------- The code worked fine in Gecko 1.8, and I noticed the following code was new in Gecko 1.9. and the browserChrome is nsnull which caused return NS_ERROR_NOT_AVAILABLE. Ln 8995 in nsDocShell.cpp EnsureScriptEnvironment () function nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner)); NS_ENSURE_TRUE(browserChrome, NS_ERROR_NOT_AVAILABLE); Could any one tell me what I did wrong in my code ? Thanks a lot. _______________________________________________ dev-embedding mailing list dev-embedding@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-embedding