Fabricate a unique name for anonymous schema types. b=199555, r=rayw@netscape.com, sr=jst@netscape.com

git-svn-id: svn://10.0.0.236/trunk@141347 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
harishd%netscape.com
2003-04-18 00:11:34 +00:00
parent 33352c4d02
commit af528987ef
4 changed files with 40 additions and 10 deletions

View File

@@ -443,15 +443,27 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
nsAutoString ns;
nsCOMPtr<nsIGenericInterfaceInfo> newInfo;
nsID tempID;
PRBool haveUniqueID = PR_FALSE;
rv = aComplexType->GetName(name);
if (NS_FAILED(rv)) {
return rv;
}
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
if (name.IsEmpty()) {
// Fabricate a unique name for anonymous type.
// Bug 199555
::NewUniqueID(&tempID);
nsXPIDLCString idStr;
idStr += tempID.ToString();
name.AssignWithConversion(idStr);
haveUniqueID = PR_TRUE;
}
else {
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
}
}
BuildInterfaceName(qualifier, name, ns, qualifiedName);
@@ -465,7 +477,8 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
// Need to create the interface.
::NewUniqueID(&tempID);
if (!haveUniqueID)
::NewUniqueID(&tempID);
rv = aSet->CreateAndAppendInterface(qualifiedName.get(), tempID,
iidx.Get(IIDX::IDX_nsISupports),
XPT_ID_SCRIPTABLE,

View File

@@ -492,7 +492,9 @@ EncodeSimpleValue(nsISOAPEncoding * aEncoding,
rc = aSchemaType->GetTargetNamespace(typeNS);
if (NS_FAILED(rc))
return rc;
needType = !(typeName.Equals(kAnyTypeSchemaType) && typeNS.Equals(nsSOAPUtils::kXSURI));
needType = (!typeName.IsEmpty() &&
!(typeName.Equals(kAnyTypeSchemaType) &&
typeNS.Equals(nsSOAPUtils::kXSURI)));
}
nsAutoString name; // First choose the appropriate name and namespace for the element.
nsAutoString ns;

View File

@@ -443,15 +443,27 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
nsAutoString ns;
nsCOMPtr<nsIGenericInterfaceInfo> newInfo;
nsID tempID;
PRBool haveUniqueID = PR_FALSE;
rv = aComplexType->GetName(name);
if (NS_FAILED(rv)) {
return rv;
}
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
if (name.IsEmpty()) {
// Fabricate a unique name for anonymous type.
// Bug 199555
::NewUniqueID(&tempID);
nsXPIDLCString idStr;
idStr += tempID.ToString();
name.AssignWithConversion(idStr);
haveUniqueID = PR_TRUE;
}
else {
rv = aComplexType->GetTargetNamespace(ns);
if (NS_FAILED(rv)) {
return rv;
}
}
BuildInterfaceName(qualifier, name, ns, qualifiedName);
@@ -465,7 +477,8 @@ FindOrConstructInterface(nsIInterfaceInfoSuperManager* iism,
// Need to create the interface.
::NewUniqueID(&tempID);
if (!haveUniqueID)
::NewUniqueID(&tempID);
rv = aSet->CreateAndAppendInterface(qualifiedName.get(), tempID,
iidx.Get(IIDX::IDX_nsISupports),
XPT_ID_SCRIPTABLE,

View File

@@ -492,7 +492,9 @@ EncodeSimpleValue(nsISOAPEncoding * aEncoding,
rc = aSchemaType->GetTargetNamespace(typeNS);
if (NS_FAILED(rc))
return rc;
needType = !(typeName.Equals(kAnyTypeSchemaType) && typeNS.Equals(nsSOAPUtils::kXSURI));
needType = (!typeName.IsEmpty() &&
!(typeName.Equals(kAnyTypeSchemaType) &&
typeNS.Equals(nsSOAPUtils::kXSURI)));
}
nsAutoString name; // First choose the appropriate name and namespace for the element.
nsAutoString ns;