nsCOMPtr<nsIDOMWindow> domw( do_GetInterface( aContext ) ); nsIDOMWindow *parent; domw->GetParent( &parent ); PtWidget_t *w = GetWebBrowser( parent ); PtMozillaWidget_t *moz = ( PtMozillaWidget_t * ) w;    nsCOMPtr<nsIWebProgressListener> listener; listener = NS_STATIC_CAST(nsIWebProgressListener *, listener); aLauncher->SetWebProgressListener( listener );    nsCOMPtr<nsIMIMEInfo> mimeInfo; aLauncher->GetMIMEInfo( getter_AddRefs(mimeInfo) ); char *mimeType; mimeInfo->GetMIMEType( &mimeType );  nsCOMPtr<nsIURI> aSourceUrl; PRInt64 dummy; nsCOMPtr<nsIFile> aFile; aLauncher->GetDownloadInfo( getter_AddRefs(aSourceUrl), &dummy, getter_AddRefs(aFile) );  char *url; nsCAutoString specString; aSourceUrl->GetSpec(specString); url	= (char *) specString.get();  PtCallbackInfo_t cbinfo; PtWebUnknownCallback_t cb;  memset( &cbinfo, 0, sizeof( cbinfo ) ); cbinfo.reason = Pt_CB_MOZ_UNKNOWN; cbinfo.cbdata = &cb; cb.action = WWW_ACTION_OK;   moz->EmbedRef->app_launcher = aLauncher; moz->EmbedRef->context = aContext;  strcpy( cb.content_type, mimeType ); strcpy( cb.url, url ); cb.content_length = strlen( cb.url ); PtInvokeCallbackList( moz->web_unknown_cb, (PtWidget_t *)moz, &cbinfo); return rv; }
nsCOMPtr<nsIDOMWindowInternal> parent( do_GetInterface( aContext ) ); if ( parent ) {  nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface( parent, &rv ); if ( NS_SUCCEEDED( rv ) && sgo ) { nsCOMPtr<nsIScriptContext> context; sgo->GetContext( getter_AddRefs( context ) ); if ( context ) {  JSContext *jsContext = (JSContext*)context->GetNativeContext(); if ( jsContext ) {  void *stackPtr; jsval *argv = JS_PushArguments( jsContext, &stackPtr, "sss%ip", "chrome: "_blank", "chrome,titlebar", (const nsIID*)(&NS_GET_IID(nsIHelperAppLauncher)), (nsISupports*)aLauncher ); if ( argv ) {  nsCOMPtr<nsIDOMWindowInternal> dialog; rv = parent->OpenDialog( jsContext, argv, 4, getter_AddRefs( dialog ) );  JS_PopArguments( jsContext, stackPtr ); } } } } } return rv; }
NS_IMETHODIMP nsUnknownContentTypeHandler::Show( nsIHelperAppLauncher *aLauncher, nsISupports *aContext ) {	nsresult rv = NS_OK;/* ATENTIE */ //printf("Show!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n");	/* try to get the PtMozillawidget_t* pointer form the aContext - use the fact the the WebBrowserContainer is		registering itself as nsIDocumentLoaderObserver ( SetDocLoaderObserver ) */	nsCOMPtr<nsIDOMWindow> domw( do_GetInterface( aContext ) );	nsIDOMWindow *parent;	domw->GetParent( &parent );	PtWidget_t *w = GetWebBrowser( parent );	PtMozillaWidget_t *moz = ( PtMozillaWidget_t * ) w;	/* go ahead and start the downloading process *///	nsCOMPtr<nsIWebProgressListener> listener = NS_CAST(nsIWebProgressListener *, moz->EmbedRef->mProgress );	nsCOMPtr<nsIWebProgressListener> listener;	listener = NS_STATIC_CAST(nsIWebProgressListener *, listener);	aLauncher->SetWebProgressListener( listener );//	moz->MyBrowser->WebBrowserContainer->mSkipOnState = 0; /* reinstate nsIWebProgressListener's CWebBrowserContainer::OnStateChange() */	/* get the mime type - need to provide it in the callback info */	nsCOMPtr<nsIMIMEInfo> mimeInfo;	aLauncher->GetMIMEInfo( getter_AddRefs(mimeInfo) );	char *mimeType;	mimeInfo->GetMIMEType( &mimeType );	nsCOMPtr<nsIURI> aSourceUrl;	PRInt64 dummy;	nsCOMPtr<nsIFile> aFile;	aLauncher->GetDownloadInfo( getter_AddRefs(aSourceUrl), &dummy, getter_AddRefs(aFile) );	char *url;	nsCAutoString specString;	aSourceUrl->GetSpec(specString);	url	= (char *) specString.get();	PtCallbackInfo_t cbinfo;	PtWebUnknownCallback_t cb;	memset( &cbinfo, 0, sizeof( cbinfo ) );	cbinfo.reason = Pt_CB_MOZ_UNKNOWN;	cbinfo.cbdata = &cb;	cb.action = WWW_ACTION_OK;	/* pass extra information to the mozilla widget, so that it will know what to do when Pt_ARG_MOZ_UNKNOWN_RESP comes */	moz->EmbedRef->app_launcher = aLauncher;	moz->EmbedRef->context = aContext;	strcpy( cb.content_type, mimeType );	strcpy( cb.url, url );	cb.content_length = strlen( cb.url );	PtInvokeCallbackList( moz->web_unknown_cb, (PtWidget_t *)moz, &cbinfo);	return rv;	}