if( d->mLauncher ) d->mLauncher->Cancel();
if( d->mLauncher ) d->mLauncher->Cancel(NS_BINDING_ABORTED);
mozilla_modify( PtWidget_t *widget, PtArg_t const *argt, PtResourceRec_t const *mod ){	PtMozillaWidget_t *moz = (PtMozillaWidget_t *)widget;	nsIPref *pref = moz->EmbedRef->GetPrefs();	switch( argt->type )  	{		case Pt_ARG_MOZ_GET_URL:			MozLoadURL(moz, (char *)(argt->value));			break;		case Pt_ARG_MOZ_NAVIGATE_PAGE:			if (moz->EmbedRef)			{				if (argt->value == Pt_WEB_DIRECTION_FWD)					moz->EmbedRef->Forward();				else if (argt->value == Pt_WEB_DIRECTION_BACK)					moz->EmbedRef->Back();				else 				{					PhDim_t dim;					PtWidgetDim(widget, &dim);					dim.w = (argt->value * dim.w)/100;					dim.h = (argt->value * dim.h)/100;					if (argt->value == Pt_WEB_DIRECTION_UP)						moz->EmbedRef->ScrollUp(dim.h);					else if (argt->value ==	Pt_WEB_DIRECTION_DOWN)						moz->EmbedRef->ScrollDown(dim.h);					else if (argt->value ==	Pt_WEB_DIRECTION_LEFT)						moz->EmbedRef->ScrollLeft(dim.w);					else if (argt->value == Pt_WEB_DIRECTION_RIGHT)						moz->EmbedRef->ScrollRight(dim.w);				}			}			break;		case Pt_ARG_MOZ_STOP:			if (moz->EmbedRef)				moz->EmbedRef->Stop();			break;		case Pt_ARG_MOZ_RELOAD:			if (moz->EmbedRef)				moz->EmbedRef->Reload(0);			break;		case Pt_ARG_MOZ_PRINT: 			{			PpPrintContext_t *pc = ( PpPrintContext_t * ) argt->value;			moz->EmbedRef->Print(pc);			}		  break;		case Pt_ARG_MOZ_OPTION:			mozilla_set_pref(widget, (char*)argt->len, (char*)argt->value);			break;		case Pt_ARG_MOZ_ENCODING: {			char translation[1024];			strcpy( translation, (char*)argt->value );			fix_translation_string( translation ); 			pref->SetUnicharPref( "intl.charset.default", NS_ConvertASCIItoUCS2( translation ).get());			pref->SavePrefFile( nsnull );			}			break;		case Pt_ARG_MOZ_COMMAND: {			PtWebClient2Command_t *wdata = ( PtWebClient2Command_t * ) argt->len;			switch ((int)(argt->value)) 			{				case Pt_MOZ_COMMAND_CUT: {					moz->EmbedRef->Cut(wdata?wdata->ClipboardInfo.input_group:1);					}					break;				case Pt_MOZ_COMMAND_COPY: {					moz->EmbedRef->Copy(wdata?wdata->ClipboardInfo.input_group:1);					}					break;				case Pt_MOZ_COMMAND_PASTE: {					moz->EmbedRef->Paste(wdata?wdata->ClipboardInfo.input_group:1);					}					break;				case Pt_MOZ_COMMAND_SELECTALL: {					moz->EmbedRef->SelectAll();					}					break;				case Pt_MOZ_COMMAND_CLEAR: {					moz->EmbedRef->Clear();					}					break;				case Pt_MOZ_COMMAND_FIND: {					nsCOMPtr<nsIWebBrowserFind> finder( do_GetInterface( moz->EmbedRef->mWindow->mWebBrowser ) );					finder->SetSearchString( NS_ConvertASCIItoUCS2(wdata->FindInfo.string).get() );					finder->SetMatchCase( wdata->FindInfo.flags & Pt_WEB_FIND_MATCH_CASE );					finder->SetFindBackwards( wdata->FindInfo.flags & Pt_WEB_FIND_GO_BACKWARDS );					finder->SetWrapFind( wdata->FindInfo.flags & Pt_WEB_FIND_START_AT_TOP );					finder->SetEntireWord( wdata->FindInfo.flags & Pt_WEB_FIND_MATCH_WHOLE_WORDS );					PRBool didFind;					finder->FindNext( &didFind );					break;					}				case Pt_MOZ_COMMAND_SAVEAS: {					char *dirname = ( char * ) calloc( 1, strlen( wdata->SaveasInfo.filename + 7 ) );					if( dirname ) {						sprintf( dirname, "%s_files", wdata->SaveasInfo.filename );						moz->EmbedRef->SaveAs( wdata->SaveasInfo.filename, dirname );						free( dirname );						}					break;					}				}			}			break;		case Pt_ARG_MOZ_WEB_DATA_URL:#if 0//				moz->MyBrowser->WebBrowserContainer->OpenStream( moz->MyBrowser->WebBrowser, "file://", "text/html" );//				strcpy( moz->url, (char*)argt->value );#endif				break;		case Pt_ARG_MOZ_UNKNOWN_RESP: {			PtWebClient2UnknownData_t *unknown = ( PtWebClient2UnknownData_t * ) argt->value;			if( unknown->response == Pt_WEB_RESPONSE_CANCEL ) {				EmbedDownload *d = FindDownload( moz, unknown->download_ticket );				if( d ) {					if( d->mLauncher ) d->mLauncher->Cancel(); /* this will also call the EmbedDownload destructor */					else if( d->mPersist ) d->mPersist->CancelSave(); /* this will also call the EmbedDownload destructor */					else delete d; /* just in case neither d->mLauncher or d->mPersist was set */					}				}			}			break;		case Pt_ARG_MOZ_DOWNLOAD: 			{				MozSaveTarget( (char*)argt->value, moz );			}			break;		case Pt_ARG_MOZ_WEB_DATA: {#if 0				WWWRequest *req = ( WWWRequest * ) argt->value;				char *hdata;				int len;				if( strcmp( moz->url, req->DataHdr.url ) ) break;				hdata = (char*) argt->len;				len = req->DataHdr.length;				switch( req->DataHdr.type ) {					case Pt_WEB_DATA_HEADER:						if( !moz->MyBrowser->WebBrowserContainer->IsStreaming( ) ) break;						/* request the document body */						if( moz->web_data_req_cb ) {							PtCallbackInfo_t  cbinfo;							PtMozillaDataRequestCb_t cb;							memset( &cbinfo, 0, sizeof( cbinfo ) );							cbinfo.reason = Pt_CB_MOZ_WEB_DATA_REQ;							cbinfo.cbdata = &cb;							cb.type = Pt_WEB_DATA_BODY;							cb.length = 32768;							cb.url = moz->url;							PtInvokeCallbackList( moz->web_data_req_cb, (PtWidget_t *)moz, &cbinfo);							}						break;					case Pt_WEB_DATA_BODY: {						if( !moz->MyBrowser->WebBrowserContainer->IsStreaming( ) ) break;						if( len )							moz->MyBrowser->WebBrowserContainer->AppendToStream( hdata, len );						else moz->MyBrowser->WebBrowserContainer->CloseStream( );						/* request the next piece of the body */						PtCallbackInfo_t  cbinfo;						PtMozillaDataRequestCb_t cb;						memset( &cbinfo, 0, sizeof( cbinfo ) );						cbinfo.reason = Pt_CB_MOZ_WEB_DATA_REQ;						cbinfo.cbdata = &cb;						cb.type = len ? Pt_WEB_DATA_BODY : Pt_WEB_DATA_CLOSE;						cb.length = 32768;						cb.url = moz->url;						PtInvokeCallbackList( moz->web_data_req_cb, (PtWidget_t *)moz, &cbinfo);						}						break;					case Pt_WEB_DATA_CLOSE:						if( !moz->MyBrowser->WebBrowserContainer->IsStreaming( ) ) break;						moz->MyBrowser->WebBrowserContainer->CloseStream( );						break;					}#endif				}			break;		}	return;}