1998-07-22 00:27:59 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1998-05-23 03:38:40 +04:00
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
1999-01-15 02:27:36 +03:00
|
|
|
#include "nsStubContext.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
#include "net.h"
|
|
|
|
#include "mktrace.h"
|
|
|
|
#include "structs.h"
|
|
|
|
#include "ctxtfunc.h"
|
1998-05-28 03:04:11 +04:00
|
|
|
#include "xp_list.h"
|
1998-07-22 00:27:59 +04:00
|
|
|
#include "plstr.h"
|
1999-01-15 02:27:36 +03:00
|
|
|
#include "fe_proto.h" // Needed for prototype of FE_Alert().
|
|
|
|
#include "proto.h" // Needed for prototype of XP_FindContextOfType().
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-06-04 09:09:32 +04:00
|
|
|
#include "nsString.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
#include "nsIStreamListener.h"
|
1998-07-22 00:27:59 +04:00
|
|
|
#include "nsINetSupport.h"
|
1998-05-23 03:38:40 +04:00
|
|
|
#include "nsNetStream.h"
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
|
|
|
|
void free_stub_context(MWContext *window_id);
|
|
|
|
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Beginning of MWContext Evil!!! */
|
|
|
|
/* ------------------------------- */
|
|
|
|
/* */
|
|
|
|
/* Define a dummy MWContext where all of the upcalls are stubbed out. */
|
|
|
|
/* */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
|
|
PRIVATE int
|
|
|
|
stub_noop(int x, ...)
|
|
|
|
{
|
|
|
|
#ifdef XP_MAC
|
|
|
|
#pragma unused (x)
|
|
|
|
#endif
|
|
|
|
/* DebugBreak(); */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
static nsIStreamListener *getStreamListener(URL_Struct *URL_s)
|
1998-05-23 03:38:40 +04:00
|
|
|
{
|
1998-07-22 00:27:59 +04:00
|
|
|
nsIStreamListener *res = NULL;
|
|
|
|
|
1998-07-25 04:32:32 +04:00
|
|
|
if (URL_s && URL_s->fe_data) {
|
1998-05-23 03:38:40 +04:00
|
|
|
/*
|
|
|
|
* Retrieve the nsConnectionInfo object from the fe_data field
|
|
|
|
* of the URL_Struct...
|
|
|
|
*/
|
1998-07-22 00:27:59 +04:00
|
|
|
nsConnectionInfo *pConn = (nsConnectionInfo *)URL_s->fe_data;
|
|
|
|
if (pConn) {
|
|
|
|
res = pConn->pConsumer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IF_ADDREF(res);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
|
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
static nsINetSupport *getNetSupport(URL_Struct *URL_s)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *netSupport = nsnull;
|
|
|
|
|
|
|
|
/* Access the nsConnectionInfo object off of the URL Struct fe_data */
|
|
|
|
if ((nsnull != URL_s) && (nsnull != URL_s->fe_data)) {
|
|
|
|
nsConnectionInfo *pConn = (nsConnectionInfo *)URL_s->fe_data;
|
|
|
|
|
|
|
|
/* Now get the nsIURL held by the nsConnectionInfo... */
|
|
|
|
if ((nsnull != pConn) && (nsnull != pConn->pURL)) {
|
|
|
|
nsISupports *container;
|
|
|
|
|
|
|
|
/* The nsINetSupport interface will be implemented by the container */
|
1998-12-16 08:40:20 +03:00
|
|
|
nsresult err = pConn->pURL->GetContainer(&container);
|
1999-02-25 19:43:17 +03:00
|
|
|
if (NS_SUCCEEDED(err) && (nsnull != container)) {
|
1998-11-03 11:01:29 +03:00
|
|
|
container->QueryInterface(kINetSupportIID, (void **) &netSupport);
|
|
|
|
NS_RELEASE(container);
|
|
|
|
}
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
|
|
|
return netSupport;
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-07-22 00:27:59 +04:00
|
|
|
void stub_Alert(MWContext *context,
|
|
|
|
const char *msg)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *ins;
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
if (nsnull != (ins = getNetSupport(context->modular_data))) {
|
|
|
|
nsAutoString str(msg);
|
|
|
|
|
|
|
|
ins->Alert(str);
|
|
|
|
NS_RELEASE(ins);;
|
|
|
|
}
|
|
|
|
/* No nsINetSupport interface... */
|
|
|
|
else {
|
1998-11-18 07:35:47 +03:00
|
|
|
printf("%cAlert: %s", '\007', msg);
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
1998-06-04 09:09:32 +04:00
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
extern "C" void FE_Alert(MWContext *context, const char *msg)
|
|
|
|
{
|
|
|
|
stub_Alert(context, msg);
|
|
|
|
}
|
|
|
|
|
1998-09-06 00:13:34 +04:00
|
|
|
#if defined (WIN32)
|
|
|
|
extern "C" char * FE_GetProgramDirectory(char *buffer, int length) {
|
|
|
|
printf("XXX: returning c:\\temp\\ for the FE_GetProgramDirectory!\n");
|
|
|
|
strcpy(buffer, "c:\\temp\\");
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
#elif defined (XP_UNIX)
|
1998-09-12 09:55:51 +04:00
|
|
|
extern "C" char * fe_GetProgramDirectory(char *buffer, int length) {
|
1998-09-06 00:13:34 +04:00
|
|
|
printf("XXX: returning /tmp for the fe_GetProgramDirectory!\n");
|
|
|
|
strcpy(buffer, "/tmp/");
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-07-22 00:27:59 +04:00
|
|
|
XP_Bool stub_Confirm(MWContext *context,
|
|
|
|
const char *msg)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *ins;
|
|
|
|
XP_Bool bResult = FALSE;
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
if (nsnull != (ins = getNetSupport(context->modular_data))) {
|
|
|
|
nsAutoString str(msg);
|
|
|
|
|
|
|
|
bResult = ins->Confirm(str);
|
|
|
|
NS_RELEASE(ins);
|
|
|
|
}
|
|
|
|
/* No nsINetSupport interface... */
|
|
|
|
else {
|
1998-11-18 07:35:47 +03:00
|
|
|
printf("%cConfirm: %s (y/n)? ", '\007', msg);
|
|
|
|
char c;
|
|
|
|
for (;;) {
|
|
|
|
c = getchar();
|
|
|
|
if (tolower(c) == 'y') {
|
|
|
|
bResult = TRUE;
|
|
|
|
}
|
|
|
|
if (tolower(c) == 'n') {
|
|
|
|
bResult = FALSE;
|
|
|
|
}
|
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
|
|
|
return bResult;
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-07-22 00:27:59 +04:00
|
|
|
char *stub_Prompt(MWContext *context,
|
|
|
|
const char *msg,
|
|
|
|
const char *def)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *ins;
|
|
|
|
char *result = nsnull;
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
if (nsnull != (ins = getNetSupport(context->modular_data))) {
|
|
|
|
nsAutoString str(msg);
|
|
|
|
nsAutoString defStr(def);
|
|
|
|
nsAutoString res;
|
|
|
|
|
|
|
|
if (ins->Prompt(msg, defStr, res)) {
|
|
|
|
NS_RELEASE(ins);
|
|
|
|
result = res.ToNewCString();
|
|
|
|
}
|
|
|
|
NS_RELEASE(ins);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* No nsINetSupport interface... */
|
|
|
|
else {
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
printf("%s\n", msg);
|
1998-11-28 20:16:47 +03:00
|
|
|
printf("%cPrompt (default=%s): ", '\007', def);
|
1999-01-01 05:47:52 +03:00
|
|
|
fgets(buf, sizeof buf, stdin);
|
1998-11-03 11:01:29 +03:00
|
|
|
if (PL_strlen(buf)) {
|
|
|
|
result = PL_strdup(buf);
|
1998-11-28 20:16:47 +03:00
|
|
|
} else {
|
|
|
|
result = PL_strdup(def);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
return result;
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE XP_Bool
|
|
|
|
stub_PromptUsernameAndPassword(MWContext *context,
|
|
|
|
const char *msg,
|
|
|
|
char **username,
|
|
|
|
char **password)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *ins;
|
|
|
|
XP_Bool bResult = FALSE;
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
if (nsnull != (ins = getNetSupport(context->modular_data))) {
|
|
|
|
nsAutoString str(msg);
|
1998-11-28 20:16:47 +03:00
|
|
|
nsAutoString userStr(*username);
|
|
|
|
nsAutoString pwdStr(*password);
|
1998-11-03 11:01:29 +03:00
|
|
|
|
|
|
|
if (ins->PromptUserAndPassword(msg, userStr, pwdStr)) {
|
|
|
|
*username = userStr.ToNewCString();
|
|
|
|
*password = pwdStr.ToNewCString();
|
|
|
|
bResult = TRUE;
|
|
|
|
}
|
|
|
|
NS_RELEASE(ins);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* No nsINetSupport interface... */
|
|
|
|
else {
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
printf("%s\n", msg);
|
1998-11-28 20:16:47 +03:00
|
|
|
printf("%cUser (default=%s): ", '\007', *username);
|
1999-01-01 05:47:52 +03:00
|
|
|
fgets(buf, sizeof buf, stdin);
|
1998-11-28 20:16:47 +03:00
|
|
|
if (strlen(buf)) {
|
|
|
|
*username = PL_strdup(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("%cPassword (default=%s): ", '\007', *password);
|
1999-01-01 05:47:52 +03:00
|
|
|
fgets(buf, sizeof buf, stdin);
|
1998-11-28 20:16:47 +03:00
|
|
|
if (strlen(buf)) {
|
|
|
|
*password = PL_strdup(buf);
|
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
|
|
|
|
if (**username) {
|
|
|
|
bResult = TRUE;
|
1998-07-22 00:27:59 +04:00
|
|
|
} else {
|
1998-11-03 11:01:29 +03:00
|
|
|
PR_FREEIF(*username);
|
|
|
|
PR_FREEIF(*password);
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
return bResult;
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-07-22 00:27:59 +04:00
|
|
|
char *stub_PromptPassword(MWContext *context,
|
|
|
|
const char *msg)
|
|
|
|
{
|
1998-11-03 11:01:29 +03:00
|
|
|
nsINetSupport *ins;
|
|
|
|
char *result = nsnull;
|
|
|
|
|
|
|
|
if (nsnull != (ins = getNetSupport(context->modular_data))) {
|
|
|
|
nsAutoString str(msg);
|
|
|
|
nsAutoString res;
|
|
|
|
|
|
|
|
if (ins->PromptPassword(msg, res)) {
|
|
|
|
result = res.ToNewCString();
|
|
|
|
}
|
|
|
|
NS_RELEASE(ins);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* No nsINetSupport interface... */
|
|
|
|
else {
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
printf("%s\n", msg);
|
1998-11-18 07:35:47 +03:00
|
|
|
printf("%cPassword: ", '\007');
|
1999-01-01 05:47:52 +03:00
|
|
|
fgets(buf, sizeof buf, stdin);
|
1998-11-03 11:01:29 +03:00
|
|
|
if (PL_strlen(buf)) {
|
|
|
|
result = PL_strdup(buf);
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
1998-11-03 11:01:29 +03:00
|
|
|
}
|
1998-07-22 00:27:59 +04:00
|
|
|
|
1998-11-03 11:01:29 +03:00
|
|
|
return result;
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE void stub_GraphProgressInit(MWContext *context,
|
|
|
|
URL_Struct *URL_s,
|
|
|
|
int32 content_length)
|
|
|
|
{
|
|
|
|
nsIStreamListener *pListener;
|
|
|
|
|
|
|
|
if (URL_s->load_background)
|
|
|
|
return;
|
|
|
|
|
1998-07-25 00:53:38 +04:00
|
|
|
if (nsnull != (pListener = getStreamListener(URL_s))) {
|
1998-07-22 00:27:59 +04:00
|
|
|
nsConnectionInfo *pConn = (nsConnectionInfo *) URL_s->fe_data;
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_ASSERTION(content_length >= 0, "negative content_length");
|
|
|
|
pListener->OnProgress(pConn->pURL, 0, (PRUint32)content_length);
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_RELEASE(pListener);
|
1998-07-22 00:27:59 +04:00
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PRIVATE void stub_GraphProgress(MWContext *context,
|
|
|
|
URL_Struct *URL_s,
|
|
|
|
int32 bytes_received,
|
|
|
|
int32 bytes_since_last_time,
|
|
|
|
int32 content_length)
|
|
|
|
{
|
1998-07-22 00:27:59 +04:00
|
|
|
nsIStreamListener *pListener;
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
if (URL_s->load_background)
|
|
|
|
return;
|
1998-06-04 09:09:32 +04:00
|
|
|
|
1998-07-25 00:53:38 +04:00
|
|
|
if (nsnull != (pListener = getStreamListener(URL_s))) {
|
1998-07-22 00:27:59 +04:00
|
|
|
nsConnectionInfo *pConn = (nsConnectionInfo *) URL_s->fe_data;
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_ASSERTION(bytes_received >= 0, "negative bytes_received");
|
|
|
|
NS_ASSERTION(content_length >= 0, "negative content_length");
|
|
|
|
pListener->OnProgress(pConn->pURL, (PRUint32)bytes_received,
|
|
|
|
(PRUint32)content_length);
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_RELEASE(pListener);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIVATE void stub_GraphProgressDestroy(MWContext *context,
|
|
|
|
URL_Struct *URL_s,
|
|
|
|
int32 content_length,
|
|
|
|
int32 total_bytes_read)
|
|
|
|
{
|
1998-06-03 00:17:17 +04:00
|
|
|
/*
|
|
|
|
* XXX: Currently this function never calls OnProgress(...) because
|
|
|
|
* netlib calls FE_GraphProgressDestroy(...) after closing the
|
|
|
|
* stream... So, OnStopBinding(...) has already been called and
|
|
|
|
* the nsConnectionInfo->pConsumer has been released and NULLed...
|
|
|
|
*/
|
1998-07-22 00:27:59 +04:00
|
|
|
nsIStreamListener *pListener;
|
1998-06-04 09:09:32 +04:00
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
if (URL_s->load_background)
|
|
|
|
return;
|
|
|
|
|
1998-07-25 00:53:38 +04:00
|
|
|
if (nsnull != (pListener = getStreamListener(URL_s))) {
|
1998-07-22 00:27:59 +04:00
|
|
|
nsConnectionInfo *pConn = (nsConnectionInfo *) URL_s->fe_data;
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_ASSERTION(total_bytes_read >= 0, "negative total_bytes_read");
|
|
|
|
NS_ASSERTION(content_length >= 0, "negative content_length");
|
|
|
|
pListener->OnProgress(pConn->pURL, (PRUint32)total_bytes_read,
|
|
|
|
(PRUint32)content_length);
|
1998-11-20 07:28:06 +03:00
|
|
|
// XXX The comment above no longer applies, and this function does
|
|
|
|
// get called...
|
|
|
|
NS_RELEASE(pListener);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
PRIVATE void stub_Progress(MWContext *context, const char *msg)
|
|
|
|
{
|
|
|
|
nsIStreamListener *pListener;
|
|
|
|
|
1998-07-25 00:53:38 +04:00
|
|
|
if (nsnull != (pListener = getStreamListener(context->modular_data))) {
|
1998-07-22 00:27:59 +04:00
|
|
|
nsConnectionInfo *pConn =
|
|
|
|
(nsConnectionInfo *) context->modular_data->fe_data;
|
|
|
|
nsAutoString status(msg);
|
1998-07-24 14:02:50 +04:00
|
|
|
pListener->OnStatus(pConn->pURL, status);
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_RELEASE(pListener);
|
1998-07-22 00:27:59 +04:00
|
|
|
} else {
|
|
|
|
printf("%s\n", msg);
|
|
|
|
}
|
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-07-22 04:16:00 +04:00
|
|
|
PRIVATE void stub_AllConnectionsComplete(MWContext *context)
|
|
|
|
{
|
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
#define MAKE_FE_TYPES_PREFIX(func) func##_t
|
|
|
|
#define MAKE_FE_FUNCS_TYPES
|
|
|
|
#include "mk_cx_fn.h"
|
|
|
|
#undef MAKE_FE_FUNCS_TYPES
|
|
|
|
|
|
|
|
#define stub_CreateNewDocWindow (CreateNewDocWindow_t)stub_noop
|
|
|
|
#define stub_LayoutNewDocument (LayoutNewDocument_t)stub_noop
|
|
|
|
#define stub_SetDocTitle (SetDocTitle_t)stub_noop
|
|
|
|
#define stub_FinishedLayout (FinishedLayout_t)stub_noop
|
|
|
|
#define stub_TranslateISOText (TranslateISOText_t)stub_noop
|
|
|
|
#define stub_GetTextInfo (GetTextInfo_t)stub_noop
|
|
|
|
#define stub_MeasureText (MeasureText_t)stub_noop
|
|
|
|
#define stub_GetEmbedSize (GetEmbedSize_t)stub_noop
|
|
|
|
#define stub_GetJavaAppSize (GetJavaAppSize_t)stub_noop
|
|
|
|
#define stub_GetFormElementInfo (GetFormElementInfo_t)stub_noop
|
|
|
|
#define stub_GetFormElementValue (GetFormElementValue_t)stub_noop
|
|
|
|
#define stub_ResetFormElement (ResetFormElement_t)stub_noop
|
|
|
|
#define stub_SetFormElementToggle (SetFormElementToggle_t)stub_noop
|
|
|
|
#define stub_FreeFormElement (FreeFormElement_t)stub_noop
|
|
|
|
#define stub_FreeImageElement (FreeImageElement_t)stub_noop
|
|
|
|
#define stub_FreeEmbedElement (FreeEmbedElement_t)stub_noop
|
1998-07-23 22:31:05 +04:00
|
|
|
#define stub_FreeBuiltinElement (FreeBuiltinElement_t)stub_noop
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_FreeJavaAppElement (FreeJavaAppElement_t)stub_noop
|
|
|
|
#define stub_CreateEmbedWindow (CreateEmbedWindow_t)stub_noop
|
|
|
|
#define stub_SaveEmbedWindow (SaveEmbedWindow_t)stub_noop
|
|
|
|
#define stub_RestoreEmbedWindow (RestoreEmbedWindow_t)stub_noop
|
|
|
|
#define stub_DestroyEmbedWindow (DestroyEmbedWindow_t)stub_noop
|
|
|
|
#define stub_HideJavaAppElement (HideJavaAppElement_t)stub_noop
|
|
|
|
#define stub_FreeEdgeElement (FreeEdgeElement_t)stub_noop
|
|
|
|
#define stub_FormTextIsSubmit (FormTextIsSubmit_t)stub_noop
|
|
|
|
#define stub_DisplaySubtext (DisplaySubtext_t)stub_noop
|
|
|
|
#define stub_DisplayText (DisplayText_t)stub_noop
|
|
|
|
#define stub_DisplayImage (DisplayImage_t)stub_noop
|
|
|
|
#define stub_DisplayEmbed (DisplayEmbed_t)stub_noop
|
1998-07-23 22:31:05 +04:00
|
|
|
#define stub_DisplayBuiltin (DisplayBuiltin_t)stub_noop
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_DisplayJavaApp (DisplayJavaApp_t)stub_noop
|
|
|
|
#define stub_DisplaySubImage (DisplaySubImage_t)stub_noop
|
|
|
|
#define stub_DisplayEdge (DisplayEdge_t)stub_noop
|
|
|
|
#define stub_DisplayTable (DisplayTable_t)stub_noop
|
|
|
|
#define stub_DisplayCell (DisplayCell_t)stub_noop
|
|
|
|
#define stub_InvalidateEntireTableOrCell (InvalidateEntireTableOrCell_t)stub_noop
|
|
|
|
#define stub_DisplayAddRowOrColBorder (DisplayAddRowOrColBorder_t)stub_noop
|
|
|
|
#define stub_DisplaySubDoc (DisplaySubDoc_t)stub_noop
|
|
|
|
#define stub_DisplayLineFeed (DisplayLineFeed_t)stub_noop
|
|
|
|
#define stub_DisplayHR (DisplayHR_t)stub_noop
|
|
|
|
#define stub_DisplayBullet (DisplayBullet_t)stub_noop
|
|
|
|
#define stub_DisplayFormElement (DisplayFormElement_t)stub_noop
|
|
|
|
#define stub_DisplayBorder (DisplayBorder_t)stub_noop
|
|
|
|
#define stub_UpdateEnableStates (UpdateEnableStates_t)stub_noop
|
|
|
|
#define stub_DisplayFeedback (DisplayFeedback_t)stub_noop
|
|
|
|
#define stub_ClearView (ClearView_t)stub_noop
|
|
|
|
#define stub_SetDocDimension (SetDocDimension_t)stub_noop
|
|
|
|
#define stub_SetDocPosition (SetDocPosition_t)stub_noop
|
|
|
|
#define stub_GetDocPosition (GetDocPosition_t)stub_noop
|
|
|
|
#define stub_BeginPreSection (BeginPreSection_t)stub_noop
|
|
|
|
#define stub_EndPreSection (EndPreSection_t)stub_noop
|
|
|
|
#define stub_SetProgressBarPercent (SetProgressBarPercent_t)stub_noop
|
|
|
|
#define stub_SetBackgroundColor (SetBackgroundColor_t)stub_noop
|
1998-07-22 00:27:59 +04:00
|
|
|
#define stub_Progress (Progress_t)stub_Progress
|
|
|
|
#define stub_Alert (Alert_t)stub_Alert
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_SetCallNetlibAllTheTime (SetCallNetlibAllTheTime_t)stub_noop
|
|
|
|
#define stub_ClearCallNetlibAllTheTime (ClearCallNetlibAllTheTime_t)stub_noop
|
|
|
|
#define stub_GraphProgressInit (GraphProgressInit_t)stub_GraphProgressInit
|
|
|
|
#define stub_GraphProgressDestroy (GraphProgressDestroy_t)stub_GraphProgressDestroy
|
|
|
|
#define stub_GraphProgress (GraphProgress_t)stub_GraphProgress
|
|
|
|
#define stub_UseFancyFTP (UseFancyFTP_t)stub_noop
|
|
|
|
#define stub_UseFancyNewsgroupListing (UseFancyNewsgroupListing_t)stub_noop
|
|
|
|
#define stub_FileSortMethod (FileSortMethod_t)stub_noop
|
|
|
|
#define stub_ShowAllNewsArticles (ShowAllNewsArticles_t)stub_noop
|
1998-07-22 00:27:59 +04:00
|
|
|
#define stub_Confirm (Confirm_t)stub_Confirm
|
1998-08-13 04:07:09 +04:00
|
|
|
#define stub_CheckConfirm (CheckConfirm_t)stub_noop
|
|
|
|
#define stub_SelectDialog (SelectDialog_t)stub_noop
|
1998-07-22 00:27:59 +04:00
|
|
|
#define stub_Prompt (Prompt_t)stub_Prompt
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_PromptWithCaption (PromptWithCaption_t)stub_noop
|
1998-07-22 00:27:59 +04:00
|
|
|
#define stub_PromptUsernameAndPassword (PromptUsernameAndPassword_t)stub_PromptUsernameAndPassword
|
|
|
|
#define stub_PromptPassword (PromptPassword_t)stub_PromptPassword
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_EnableClicking (EnableClicking_t)stub_noop
|
1998-07-22 04:16:00 +04:00
|
|
|
#define stub_AllConnectionsComplete (AllConnectionsComplete_t)stub_AllConnectionsComplete
|
1998-05-23 03:38:40 +04:00
|
|
|
#define stub_ImageSize (ImageSize_t)stub_noop
|
|
|
|
#define stub_ImageData (ImageData_t)stub_noop
|
|
|
|
#define stub_ImageIcon (ImageIcon_t)stub_noop
|
|
|
|
#define stub_ImageOnScreen (ImageOnScreen_t)stub_noop
|
|
|
|
#define stub_SetColormap (SetColormap_t)stub_noop
|
|
|
|
#ifdef LAYERS
|
|
|
|
#define stub_EraseBackground (EraseBackground_t)stub_noop
|
|
|
|
#define stub_SetDrawable (SetDrawable_t)stub_noop
|
|
|
|
#define stub_GetTextFrame (GetTextFrame_t)stub_noop
|
|
|
|
#define stub_SetClipRegion (SetClipRegion_t)stub_noop
|
|
|
|
#define stub_SetOrigin (SetOrigin_t)stub_noop
|
|
|
|
#define stub_GetOrigin (GetOrigin_t)stub_noop
|
|
|
|
#define stub_GetTextFrame (GetTextFrame_t)stub_noop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define stub_GetDefaultBackgroundColor (GetDefaultBackgroundColor_t)stub_noop
|
|
|
|
#define stub_LoadFontResource (LoadFontResource_t)stub_noop
|
|
|
|
|
|
|
|
#define stub_DrawJavaApp (DrawJavaApp_t)stub_noop
|
|
|
|
#define stub_HandleClippingView (HandleClippingView_t)stub_noop
|
|
|
|
|
|
|
|
/* Just reuse the same set of context functions: */
|
|
|
|
ContextFuncs stub_context_funcs;
|
|
|
|
|
1998-05-28 03:04:11 +04:00
|
|
|
XP_List *stub_context_list = NULL;
|
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
MWContext *new_stub_context(URL_Struct *URL_s)
|
1998-05-23 03:38:40 +04:00
|
|
|
{
|
|
|
|
static int funcsInitialized = 0;
|
|
|
|
MWContext *context;
|
|
|
|
|
|
|
|
if (!funcsInitialized) {
|
|
|
|
#define MAKE_FE_FUNCS_PREFIX(f) stub_##f
|
|
|
|
#define MAKE_FE_FUNCS_ASSIGN stub_context_funcs.
|
|
|
|
#include "mk_cx_fn.h"
|
|
|
|
|
|
|
|
funcsInitialized = 1;
|
1998-05-28 03:04:11 +04:00
|
|
|
|
|
|
|
stub_context_list = XP_ListNew();
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
context = (MWContext *)calloc(sizeof(struct MWContext_), 1);
|
|
|
|
|
1998-05-28 03:04:11 +04:00
|
|
|
if (nsnull != context) {
|
1998-09-26 02:24:32 +04:00
|
|
|
context->funcs = &stub_context_funcs;
|
|
|
|
context->type = MWContextBrowser;
|
1998-07-22 00:27:59 +04:00
|
|
|
context->modular_data = URL_s;
|
1998-09-26 02:24:32 +04:00
|
|
|
context->ref_count = 0;
|
1998-05-28 03:04:11 +04:00
|
|
|
|
|
|
|
if (nsnull != stub_context_list) {
|
|
|
|
XP_ListAddObjectToEnd(stub_context_list, context);
|
|
|
|
}
|
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_stub_context(MWContext *window_id)
|
|
|
|
{
|
|
|
|
TRACEMSG(("Freeing stub context...\n"));
|
1998-05-28 03:04:11 +04:00
|
|
|
|
1998-07-22 00:27:59 +04:00
|
|
|
if (window_id) {
|
|
|
|
if (stub_context_list) {
|
|
|
|
PRBool result;
|
|
|
|
|
|
|
|
result = XP_ListRemoveObject(stub_context_list, window_id);
|
|
|
|
PR_ASSERT(PR_TRUE == result);
|
|
|
|
}
|
|
|
|
free(window_id);
|
1998-05-28 03:04:11 +04:00
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
1998-05-28 03:04:11 +04:00
|
|
|
|
|
|
|
extern "C" MWContext * XP_FindContextOfType (MWContext * context,
|
|
|
|
MWContextType type)
|
|
|
|
{
|
1999-03-05 07:40:14 +03:00
|
|
|
MWContext *window_id = 0;
|
1998-05-28 03:04:11 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the context that was passed in if it is the correct type
|
|
|
|
*/
|
|
|
|
if (nsnull != context) {
|
|
|
|
if (context->type == type) {
|
|
|
|
window_id = context;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Otherwise, the type MUST be a MWBrowserContext, since that is the
|
|
|
|
* only type of context that is created...
|
|
|
|
*
|
|
|
|
* Return the first stub context, since it is as good as any... :-)
|
|
|
|
*/
|
|
|
|
else if (MWContextBrowser == type) {
|
|
|
|
window_id = (MWContext *)XP_ListTopObject(stub_context_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return window_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* End of MWContext Evil!!! */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-05-23 03:38:40 +04:00
|
|
|
nsConnectionInfo *GetConnectionInfoFromStream(NET_StreamClass *stream)
|
|
|
|
{
|
|
|
|
URL_Struct *URL_s = (URL_Struct *)stream->data_object;
|
|
|
|
|
|
|
|
return (URL_s) ? (nsConnectionInfo *)URL_s->fe_data : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define a NET_StreamClass which pushes its data into an nsIStream
|
|
|
|
* and fires off notifications through the nsIStreamListener interface
|
|
|
|
*/
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-05-23 03:38:40 +04:00
|
|
|
void stub_complete(NET_StreamClass *stream)
|
|
|
|
{
|
|
|
|
URL_Struct *URL_s = (URL_Struct *)stream->data_object;
|
|
|
|
nsConnectionInfo *pConn = GetConnectionInfoFromStream(stream);
|
|
|
|
|
|
|
|
TRACEMSG(("+++ stream complete.\n"));
|
|
|
|
|
|
|
|
/* Close the stream and remove it from the ConnectionInfo... */
|
|
|
|
pConn->pNetStream->Close();
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_RELEASE(pConn->pNetStream);
|
1998-05-23 03:38:40 +04:00
|
|
|
|
1998-08-14 00:10:49 +04:00
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
/* Notify the Data Consumer that the Binding has completed... */
|
|
|
|
if (pConn->pConsumer) {
|
1998-06-04 09:09:32 +04:00
|
|
|
nsAutoString status;
|
1998-08-19 03:24:28 +04:00
|
|
|
pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_SUCCEEDED, status);
|
1998-11-05 08:37:02 +03:00
|
|
|
pConn->mStatus = nsConnectionSucceeded;
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Release the URL_Struct hanging off of the data_object */
|
|
|
|
stream->data_object = NULL;
|
|
|
|
NET_DropURLStruct(URL_s);
|
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-05-23 03:38:40 +04:00
|
|
|
void stub_abort(NET_StreamClass *stream, int status)
|
|
|
|
{
|
|
|
|
URL_Struct *URL_s = (URL_Struct *)stream->data_object;
|
|
|
|
nsConnectionInfo *pConn = GetConnectionInfoFromStream(stream);
|
|
|
|
|
|
|
|
TRACEMSG(("+++ stream abort. Status = %d\n", status));
|
|
|
|
|
|
|
|
/* Close the stream and remove it from the ConnectionInfo... */
|
|
|
|
pConn->pNetStream->Close();
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_RELEASE(pConn->pNetStream);
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
/* Notify the Data Consumer that the Binding has completed... */
|
|
|
|
/*
|
|
|
|
* XXX: Currently, there is no difference between complete and
|
|
|
|
* abort...
|
|
|
|
*/
|
|
|
|
if (pConn->pConsumer) {
|
1998-06-04 09:09:32 +04:00
|
|
|
nsAutoString status;
|
|
|
|
|
1998-07-16 02:38:01 +04:00
|
|
|
pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_ABORTED, status);
|
1998-11-05 08:37:02 +03:00
|
|
|
pConn->mStatus = nsConnectionAborted;
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Release the URL_Struct hanging off of the data_object */
|
|
|
|
stream->data_object = NULL;
|
|
|
|
NET_DropURLStruct(URL_s);
|
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-05-23 03:38:40 +04:00
|
|
|
int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length)
|
|
|
|
{
|
1998-12-16 08:40:20 +03:00
|
|
|
PRUint32 bytesWritten;
|
1998-07-24 00:43:08 +04:00
|
|
|
nsresult errorCode;
|
1998-05-23 03:38:40 +04:00
|
|
|
nsConnectionInfo *pConn = GetConnectionInfoFromStream(stream);
|
|
|
|
|
|
|
|
TRACEMSG(("+++ stream put_block. Length = %d\n", length));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX: Sometimes put_block(...) will be called without having
|
1998-05-28 03:04:11 +04:00
|
|
|
* called is_write_ready(...) first. One case is when a stream
|
1998-05-23 03:38:40 +04:00
|
|
|
* is interrupted... In this case, Netlib will call put_block(...)
|
|
|
|
* with the string "Transfer Interrupted!"
|
|
|
|
*/
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_ASSERTION(length >= 0, "negative length");
|
1999-03-06 01:53:56 +03:00
|
|
|
errorCode = pConn->pNetStream->Write(buffer, (PRUint32)length, &bytesWritten);
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
/* Abort the connection... */
|
1998-07-24 00:43:08 +04:00
|
|
|
if (NS_BASE_STREAM_EOF == errorCode) {
|
1998-05-23 03:38:40 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pConn->pConsumer && (0 < bytesWritten)) {
|
1998-07-24 00:43:08 +04:00
|
|
|
errorCode = pConn->pConsumer->OnDataAvailable(pConn->pURL, pConn->pNetStream, bytesWritten);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
1998-08-13 12:19:49 +04:00
|
|
|
/* Abort the connection if an error occurred... */
|
1998-12-16 08:40:20 +03:00
|
|
|
NS_ASSERTION(bytesWritten >= 0, "negative bytesWritten");
|
|
|
|
if (NS_FAILED(errorCode) || ((int32)bytesWritten != length)) {
|
1998-08-13 12:19:49 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 1;
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
1998-12-30 19:03:43 +03:00
|
|
|
PRIVATE
|
1998-05-23 03:38:40 +04:00
|
|
|
unsigned int stub_is_write_ready(NET_StreamClass *stream)
|
|
|
|
{
|
1998-12-16 08:40:20 +03:00
|
|
|
nsresult errorCode;
|
|
|
|
PRUint32 free_space = 0;
|
1998-05-23 03:38:40 +04:00
|
|
|
URL_Struct *URL_s = (URL_Struct *)stream->data_object;
|
|
|
|
nsConnectionInfo *pConn = GetConnectionInfoFromStream(stream);
|
|
|
|
|
1998-12-16 08:40:20 +03:00
|
|
|
errorCode = pConn->pNetStream->GetAvailableSpace(&free_space);
|
1998-05-23 03:38:40 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the InputStream has been closed... Return 1 byte available so
|
|
|
|
* Netlib will call put_block(...) one more time...
|
|
|
|
*/
|
1998-07-24 00:43:08 +04:00
|
|
|
if (NS_BASE_STREAM_EOF == errorCode) {
|
1998-05-23 03:38:40 +04:00
|
|
|
free_space = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACEMSG(("+++ stream is_write_ready. Returning %d\n", free_space));
|
1998-12-16 08:40:20 +03:00
|
|
|
return (int)free_space;
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
1999-01-15 02:27:36 +03:00
|
|
|
PUBLIC NET_StreamClass *
|
|
|
|
NET_NGLayoutConverter(FO_Present_Types format_out,
|
|
|
|
void *converter_obj,
|
|
|
|
URL_Struct *URL_s,
|
|
|
|
MWContext *context);
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
/*
|
|
|
|
*Find a converter routine to create a stream and return the stream struct
|
|
|
|
*/
|
|
|
|
PUBLIC NET_StreamClass *
|
1998-07-14 03:43:13 +04:00
|
|
|
NET_NGLayoutConverter(FO_Present_Types format_out,
|
|
|
|
void *converter_obj,
|
|
|
|
URL_Struct *URL_s,
|
|
|
|
MWContext *context)
|
1998-05-23 03:38:40 +04:00
|
|
|
{
|
|
|
|
NET_StreamClass *stream = NULL;
|
|
|
|
PRBool bSuccess = PR_TRUE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Only create a stream if an nsConnectionInfo object is
|
|
|
|
* available from the fe_data...
|
|
|
|
*/
|
|
|
|
if (NULL != URL_s->fe_data) {
|
|
|
|
stream = (NET_StreamClass *)calloc(sizeof(NET_StreamClass), 1);
|
|
|
|
|
|
|
|
if (NULL != stream) {
|
|
|
|
nsConnectionInfo *pConn;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the NET_StreamClass instance...
|
|
|
|
*/
|
|
|
|
stream->name = "Stub Stream";
|
|
|
|
stream->window_id = context;
|
|
|
|
|
|
|
|
stream->complete = stub_complete;
|
|
|
|
stream->abort = stub_abort;
|
|
|
|
stream->put_block = stub_put_block;
|
|
|
|
stream->is_write_ready = stub_is_write_ready;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Retrieve the nsConnectionInfo object from the fe_data field
|
|
|
|
* of the URL_Struct...
|
|
|
|
*/
|
|
|
|
pConn = (nsConnectionInfo *)URL_s->fe_data;
|
|
|
|
|
1998-11-05 08:37:02 +03:00
|
|
|
/* Mark the connection as active... */
|
|
|
|
pConn->mStatus = nsConnectionActive;
|
|
|
|
|
1998-05-23 03:38:40 +04:00
|
|
|
/*
|
|
|
|
* If the URL address has been rewritten by netlib then update
|
|
|
|
* the cached info in the URL object...
|
|
|
|
*/
|
|
|
|
if ((URL_s->address_modified) && (NULL != pConn->pURL)) {
|
1998-12-16 08:40:20 +03:00
|
|
|
pConn->pURL->SetSpec(URL_s->address);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create an Async stream unless a blocking stream is already
|
|
|
|
* available in the ConnectionInfo...
|
|
|
|
*/
|
|
|
|
if (NULL == pConn->pNetStream) {
|
|
|
|
pConn->pNetStream = new nsAsyncStream(8192);
|
|
|
|
if (NULL == pConn->pNetStream) {
|
|
|
|
free(stream);
|
|
|
|
return NULL;
|
|
|
|
}
|
1998-11-05 08:37:02 +03:00
|
|
|
NS_ADDREF(pConn->pNetStream);
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Hang the URL_Struct off of the NET_StreamClass */
|
|
|
|
NET_HoldURLStruct(URL_s);
|
|
|
|
stream->data_object = URL_s;
|
|
|
|
|
1998-06-02 00:53:01 +04:00
|
|
|
#ifdef NOISY
|
1998-05-23 03:38:40 +04:00
|
|
|
printf("+++ Created a stream for %s\n", URL_s->address);
|
1998-06-02 00:53:01 +04:00
|
|
|
#endif
|
1998-11-05 08:37:02 +03:00
|
|
|
/* Notify the data consumer that Binding is beginning...*/
|
|
|
|
if (nsnull != pConn->pConsumer) {
|
1998-07-03 10:15:06 +04:00
|
|
|
nsresult rv;
|
|
|
|
|
1998-07-16 02:38:01 +04:00
|
|
|
rv = pConn->pConsumer->OnStartBinding(pConn->pURL, URL_s->content_type);
|
1998-07-03 10:15:06 +04:00
|
|
|
/*
|
|
|
|
* If OnStartBinding fails, then tear down the NET_StreamClass
|
|
|
|
* and release all references...
|
|
|
|
*/
|
|
|
|
if (NS_OK != rv) {
|
|
|
|
NET_DropURLStruct(URL_s);
|
|
|
|
free(stream);
|
|
|
|
stream = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The NET_GetURL(...) exit_routine will clean up the
|
|
|
|
* nsConnectionInfo and associated objects.
|
|
|
|
*/
|
|
|
|
}
|
1998-05-23 03:38:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
1999-01-15 02:27:36 +03:00
|
|
|
} /* extern "C" */
|