GetInterface can now return an nsIDOMWindow (to its 'main content', or browser window, as expected for implementations of nsIWebBrowserChrome. bug 88229 r=jst,rpotts

This commit is contained in:
danm%netscape.com 2001-11-16 02:14:04 +00:00
Родитель a606bb32e6
Коммит 84bafb9079
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -91,13 +91,16 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP nsWebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr) NS_IMETHODIMP nsWebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr)
{ {
NS_ENSURE_ARG_POINTER(aInstancePtr); NS_ENSURE_ARG_POINTER(aInstancePtr);
*aInstancePtr = 0;
/* WindowCreator wants the main content shell when it asks a chrome window /* WindowCreator wants the main content shell when it asks a chrome window
for this interface. */ for this interface. */
if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) { if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) {
nsIDOMWindow *contentWin; if (mBrowserWindow && mBrowserWindow->mWebBrowser) {
mBrowserWindow->mWebBrowser->GetContentDOMWindow(&contentWin); nsIDOMWindow *contentWin;
*aInstancePtr = contentWin; mBrowserWindow->mWebBrowser->GetContentDOMWindow(&contentWin);
*aInstancePtr = contentWin;
}
return NS_OK; return NS_OK;
} }
return QueryInterface(aIID, aInstancePtr); return QueryInterface(aIID, aInstancePtr);