mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
partial backout in an attempt to fix orange.
This commit is contained in:
parent
8a6c4d235f
commit
9d626da131
@ -46,6 +46,7 @@
|
||||
#include "nsMemory.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "nsID.h"
|
||||
#include "prmem.h" // For PF_Free, 'cause nsID::ToString sucks like that
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsNetCID.h"
|
||||
@ -104,10 +105,10 @@ nsNullPrincipal::Init()
|
||||
rv = uuidgen->GenerateUUIDInPlace(&id);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char chars[NSID_LENGTH];
|
||||
id.ToProvidedString(chars);
|
||||
char* chars = id.ToString();
|
||||
NS_ENSURE_TRUE(chars, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRUint32 suffixLen = NSID_LENGTH - 1;
|
||||
PRUint32 suffixLen = strlen(chars);
|
||||
PRUint32 prefixLen = NS_ARRAY_LENGTH(NS_NULLPRINCIPAL_PREFIX) - 1;
|
||||
|
||||
// Use an nsCString so we only do the allocation once here and then share
|
||||
@ -117,6 +118,8 @@ nsNullPrincipal::Init()
|
||||
|
||||
str.Append(NS_NULLPRINCIPAL_PREFIX);
|
||||
str.Append(chars);
|
||||
|
||||
PR_Free(chars);
|
||||
|
||||
if (str.Length() != prefixLen + suffixLen) {
|
||||
NS_WARNING("Out of memory allocating null-principal URI");
|
||||
|
@ -3072,8 +3072,8 @@ nsScriptSecurityManager::CanCreateInstance(JSContext *cx,
|
||||
{
|
||||
//-- Access denied, report an error
|
||||
nsCAutoString errorMsg("Permission denied to create instance of class. CID=");
|
||||
char cidStr[NSID_LENGTH];
|
||||
aCID.ToProvidedString(cidStr);
|
||||
nsXPIDLCString cidStr;
|
||||
cidStr += aCID.ToString();
|
||||
errorMsg.Append(cidStr);
|
||||
SetPendingException(cx, errorMsg.get());
|
||||
|
||||
@ -3103,8 +3103,8 @@ nsScriptSecurityManager::CanGetService(JSContext *cx,
|
||||
{
|
||||
//-- Access denied, report an error
|
||||
nsCAutoString errorMsg("Permission denied to get service. CID=");
|
||||
char cidStr[NSID_LENGTH];
|
||||
aCID.ToProvidedString(cidStr);
|
||||
nsXPIDLCString cidStr;
|
||||
cidStr += aCID.ToString();
|
||||
errorMsg.Append(cidStr);
|
||||
SetPendingException(cx, errorMsg.get());
|
||||
|
||||
|
@ -1349,8 +1349,8 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls)
|
||||
|
||||
if (iinfo) {
|
||||
// obtain an IID.
|
||||
const nsIID* iid = nsnull;
|
||||
iinfo->GetIIDShared(&iid);
|
||||
nsIID* iid = nsnull;
|
||||
iinfo->GetInterfaceIID(&iid);
|
||||
|
||||
if (iid) {
|
||||
// We found a valid iid. Add it to our table.
|
||||
@ -1362,8 +1362,11 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls)
|
||||
nsCOMPtr<nsIInterfaceInfo> parentInfo;
|
||||
// if it has a parent, add it to the table
|
||||
while (NS_SUCCEEDED(iinfo->GetParent(getter_AddRefs(parentInfo))) && parentInfo) {
|
||||
// free the nsMemory::Clone()ed iid
|
||||
nsMemory::Free(iid);
|
||||
|
||||
// get the iid
|
||||
parentInfo->GetIIDShared(&iid);
|
||||
parentInfo->GetInterfaceIID(&iid);
|
||||
|
||||
// don't add nsISupports to the table
|
||||
if (!iid || iid->Equals(NS_GET_IID(nsISupports)))
|
||||
@ -1377,6 +1380,10 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls)
|
||||
iinfo = parentInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// free the nsMemory::Clone()ed iid
|
||||
if (iid)
|
||||
nsMemory::Free(iid);
|
||||
}
|
||||
|
||||
token = nsCRT::strtok( newStr, ", ", &newStr );
|
||||
|
@ -1706,21 +1706,24 @@ nsDOMClassInfo::RegisterClassProtos(PRInt32 aClassInfoID)
|
||||
iim->GetInfoForIID(primary_iid, getter_AddRefs(if_info));
|
||||
|
||||
while (if_info) {
|
||||
const nsIID *iid = nsnull;
|
||||
nsIID *iid = nsnull;
|
||||
|
||||
if_info->GetIIDShared(&iid);
|
||||
if_info->GetInterfaceIID(&iid);
|
||||
NS_ENSURE_TRUE(iid, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (iid->Equals(NS_GET_IID(nsISupports))) {
|
||||
nsMemory::Free(iid);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
const char *name = nsnull;
|
||||
if_info->GetNameShared(&name);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_UNEXPECTED);
|
||||
nsXPIDLCString name;
|
||||
if_info->GetName(getter_Copies(name));
|
||||
|
||||
nameSpaceManager->RegisterClassProto(CutPrefix(name), iid, &found_old);
|
||||
|
||||
nsMemory::Free(iid);
|
||||
|
||||
if (first) {
|
||||
first = PR_FALSE;
|
||||
} else if (found_old) {
|
||||
@ -5327,9 +5330,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||
primary_iid = ci_data->mProtoChainInterface;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterfaceInfo> if_info;
|
||||
nsCOMPtr<nsIInterfaceInfo> parent;
|
||||
const char *class_parent_name = nsnull;
|
||||
nsXPIDLCString class_parent_name;
|
||||
|
||||
if (!primary_iid->Equals(NS_GET_IID(nsISupports))) {
|
||||
rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
|
||||
@ -5355,18 +5356,20 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
|
||||
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsCOMPtr<nsIInterfaceInfo> if_info;
|
||||
iim->GetInfoForIID(primary_iid, getter_AddRefs(if_info));
|
||||
NS_ENSURE_TRUE(if_info, NS_ERROR_UNEXPECTED);
|
||||
|
||||
const nsIID *iid = nsnull;
|
||||
nsCOMPtr<nsIInterfaceInfo> parent;
|
||||
nsIID *iid = nsnull;
|
||||
|
||||
if (ci_data && !ci_data->mHasClassInterface) {
|
||||
if_info->GetIIDShared(&iid);
|
||||
if_info->GetInterfaceIID(&iid);
|
||||
} else {
|
||||
if_info->GetParent(getter_AddRefs(parent));
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
parent->GetIIDShared(&iid);
|
||||
parent->GetInterfaceIID(&iid);
|
||||
}
|
||||
|
||||
if (iid) {
|
||||
@ -5376,7 +5379,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||
// interface is the interface that should be
|
||||
// constructor.prototype.__proto__.
|
||||
|
||||
if_info->GetNameShared(&class_parent_name);
|
||||
if_info->GetName(getter_Copies(class_parent_name));
|
||||
} else {
|
||||
// If the class does have a class interface (or there's no
|
||||
// real class for this name) then the parent of the
|
||||
@ -5385,9 +5388,11 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||
|
||||
NS_ASSERTION(parent, "Whoa, this is bad, null parent here!");
|
||||
|
||||
parent->GetNameShared(&class_parent_name);
|
||||
parent->GetName(getter_Copies(class_parent_name));
|
||||
}
|
||||
}
|
||||
|
||||
nsMemory::Free(iid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
|
||||
|
||||
PRBool found_old;
|
||||
nsCOMPtr<nsIInterfaceInfo> if_info;
|
||||
const char *if_name = nsnull;
|
||||
nsXPIDLCString if_name;
|
||||
const nsIID *iid;
|
||||
|
||||
for ( ; domInterfaces->IsDone() == NS_ENUMERATOR_FALSE; domInterfaces->Next()) {
|
||||
@ -319,9 +319,9 @@ nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIInterfaceInfo> if_info(do_QueryInterface(entry));
|
||||
if_info->GetNameShared(&if_name);
|
||||
if_info->GetName(getter_Copies(if_name));
|
||||
if_info->GetIIDShared(&iid);
|
||||
rv = RegisterInterface(if_name + sizeof(NS_DOM_INTERFACE_PREFIX) - 1,
|
||||
rv = RegisterInterface(if_name.get() + sizeof(NS_DOM_INTERFACE_PREFIX) - 1,
|
||||
iid, &found_old);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1137,13 +1137,15 @@ FinalizeParams(JNIEnv *env, const nsXPTParamInfo &aParamInfo, PRUint8 aType,
|
||||
// Create the string from nsID
|
||||
jstring str = nsnull;
|
||||
if (iid) {
|
||||
char iid_str[NSID_LENGTH];
|
||||
iid->ToProvidedString(iid_str);
|
||||
str = env->NewStringUTF(iid_str);
|
||||
if (!str) {
|
||||
char* iid_str = iid->ToString();
|
||||
if (iid_str) {
|
||||
str = env->NewStringUTF(iid_str);
|
||||
}
|
||||
if (!iid_str || !str) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
PR_Free(iid_str);
|
||||
}
|
||||
|
||||
if (aParamInfo.IsRetval() && !aIsArrayElement) {
|
||||
|
@ -866,13 +866,15 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
jobject str = nsnull;
|
||||
if (iid) {
|
||||
char iid_str[NSID_LENGTH];
|
||||
iid->ToProvidedString(iid_str);
|
||||
str = env->NewStringUTF(iid_str);
|
||||
if (!str) {
|
||||
char* iid_str = iid->ToString();
|
||||
if (iid_str) {
|
||||
str = env->NewStringUTF(iid_str);
|
||||
}
|
||||
if (!iid_str || !str) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
PR_Free(iid_str);
|
||||
}
|
||||
|
||||
if (!aParamInfo.IsOut()) { // 'in'
|
||||
@ -1708,4 +1710,4 @@ nsJavaXPTCStub::GetNewOrUsed(JNIEnv* env, jobject aJavaObject,
|
||||
*aResult = stub;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
@ -416,8 +416,10 @@ public:
|
||||
static const char kIIDDecl2[] = " =\n \"";
|
||||
static const char kIIDDecl3[] = "\";\n\n";
|
||||
|
||||
nsIID* iid;
|
||||
aIInfo->GetIIDShared(&iid);
|
||||
nsIID* iid = nsnull;
|
||||
aIInfo->GetInterfaceIID(&iid);
|
||||
if (!iid)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// create iid field name
|
||||
nsCAutoString iid_name;
|
||||
@ -433,8 +435,9 @@ public:
|
||||
ToUpperCase(iid_name);
|
||||
|
||||
// get iid string
|
||||
char iid_str[NSID_LENGTH];
|
||||
iid->ToProvidedString(iid_str);
|
||||
char* iid_str = iid->ToString();
|
||||
if (!iid_str)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUint32 count;
|
||||
nsresult rv = out->Write(kIIDDecl1, sizeof(kIIDDecl1) - 1, &count);
|
||||
@ -449,6 +452,8 @@ public:
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// cleanup
|
||||
PR_Free(iid_str);
|
||||
nsMemory::Free(iid);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,12 @@ static PyObject *PyGetIID(PyObject *self, PyObject *args)
|
||||
nsIID *iid_ret;
|
||||
nsresult r;
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
r = pI->GetIIDShared(&iid_ret);
|
||||
r = pI->GetInterfaceIID(&iid_ret);
|
||||
Py_END_ALLOW_THREADS;
|
||||
if ( NS_FAILED(r) )
|
||||
return PyXPCOM_BuildPyException(r);
|
||||
PyObject *ret = Py_nsIID::PyObjectFromIID(*iid_ret);
|
||||
nsMemory::Free(iid_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,7 @@ nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
if(iface)
|
||||
{
|
||||
nsIID const *iid;
|
||||
char idstr[NSID_LENGTH];
|
||||
char* idstr;
|
||||
JSString* jsstr;
|
||||
PRBool scriptable;
|
||||
|
||||
@ -632,10 +632,11 @@ nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative *wrapper,
|
||||
continue;
|
||||
}
|
||||
|
||||
if(NS_SUCCEEDED(iface->GetIIDShared(&iid)))
|
||||
if(NS_SUCCEEDED(iface->GetIIDShared(&iid)) &&
|
||||
nsnull != (idstr = iid->ToString()))
|
||||
{
|
||||
iid->ToProvidedString(idstr);
|
||||
jsstr = JS_NewStringCopyZ(cx, idstr);
|
||||
nsMemory::Free(idstr);
|
||||
if (jsstr &&
|
||||
JS_ValueToId(cx, STRING_TO_JSVAL(jsstr), idp))
|
||||
{
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
|
||||
const PRInt32 nsNavBookmarks::kFindBookmarksIndex_ID = 0;
|
||||
@ -278,9 +279,10 @@ nsNavBookmarks::Init()
|
||||
nsID GUID;
|
||||
rv = uuidgen->GenerateUUIDInPlace(&GUID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
char GUIDChars[NSID_LENGTH];
|
||||
GUID.ToProvidedString(GUIDChars);
|
||||
CopyASCIItoUTF16(GUIDChars, mGUIDBase);
|
||||
char* GUIDChars = GUID.ToString();
|
||||
NS_ENSURE_TRUE(GUIDChars, NS_ERROR_OUT_OF_MEMORY);
|
||||
mGUIDBase.Assign(NS_ConvertASCIItoUTF16(GUIDChars));
|
||||
PR_Free(GUIDChars);
|
||||
|
||||
rv = InitRoots();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1737,10 +1739,9 @@ nsNavBookmarks::GetItemGUID(PRInt64 aItemId, nsAString &aGUID)
|
||||
return rv;
|
||||
|
||||
nsAutoString tmp;
|
||||
tmp.Assign(mGUIDBase);
|
||||
tmp.AppendInt(mItemCount++);
|
||||
aGUID.SetCapacity(NSID_LENGTH - 1 + tmp.Length());
|
||||
aGUID.Assign(mGUIDBase);
|
||||
aGUID.Append(tmp);
|
||||
aGUID.Assign(tmp);
|
||||
|
||||
return SetItemGUID(aItemId, aGUID);
|
||||
}
|
||||
|
@ -96,8 +96,9 @@ xpti_InterfaceWriter(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
xptiInterfaceEntry* entry = ((xptiHashEntry*)hdr)->value;
|
||||
PRFileDesc* fd = (PRFileDesc*) arg;
|
||||
|
||||
char iidStr[NSID_LENGTH];
|
||||
entry->GetTheIID()->ToProvidedString(iidStr);
|
||||
char* iidStr = entry->GetTheIID()->ToString();
|
||||
if(!iidStr)
|
||||
return PL_DHASH_STOP;
|
||||
|
||||
const xptiTypelib& typelib = entry->GetTypelibRecord();
|
||||
|
||||
@ -110,6 +111,8 @@ xpti_InterfaceWriter(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
typelib.GetZipItemIndex() : -1),
|
||||
(int) entry->GetScriptableFlag());
|
||||
|
||||
nsCRT::free(iidStr);
|
||||
|
||||
return success ? PL_DHASH_NEXT : PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user