Bug 688012 - Fix alignment of arguments and tests relative to parens. r=mrbkap

xpcfix -puc `find | grep -P "cpp$|h$" | perl -pe 's/\n/ /'`

Some of these changes aren't quite ideal, but it's the best my tooling can do and I think it's very much a step in the right direction. This is necessary to do first, because doing if(foo) -> if (foo) changes the location of parentheses, which affects how other things should be aligned. So this has to be built into the tooling, and we might as well take care of the pre-existing issues first.
This commit is contained in:
Bobby Holley 2011-10-14 10:52:48 -07:00
Родитель 72f85f5a14
Коммит 6add62caad
29 изменённых файлов: 388 добавлений и 441 удалений

Просмотреть файл

@ -158,10 +158,10 @@ mozJSLoaderErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep)
PRUint32 column = rep->uctokenptr - rep->uclinebuf;
rv = errorObject->Init(reinterpret_cast<const PRUnichar*>
(rep->ucmessage),
(rep->ucmessage),
fileUni.get(),
reinterpret_cast<const PRUnichar*>
(rep->uclinebuf),
(rep->uclinebuf),
rep->lineno, column, rep->flags,
"component javascript");
if (NS_SUCCEEDED(rv)) {
@ -778,7 +778,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
mSystemPrincipal,
nsnull,
nsIXPConnect::
FLAG_SYSTEM_GLOBAL_OBJECT,
FLAG_SYSTEM_GLOBAL_OBJECT,
getter_AddRefs(holder));
NS_ENSURE_SUCCESS(rv, rv);
@ -869,7 +869,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// eagerly report the exception.
uint32 oldopts = JS_GetOptions(cx);
JS_SetOptions(cx, oldopts | JSOPTION_NO_SCRIPT_RVAL |
(exception ? JSOPTION_DONT_REPORT_UNCAUGHT : 0));
(exception ? JSOPTION_DONT_REPORT_UNCAUGHT : 0));
if (realFile) {
#ifdef HAVE_PR_MEMMAP
@ -919,9 +919,8 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
return NS_ERROR_FAILURE;
}
script = JS_CompileScriptForPrincipalsVersion(
cx, global, jsPrincipals, buf, fileSize32, nativePath.get(), 1,
JSVERSION_LATEST);
script = JS_CompileScriptForPrincipalsVersion(cx, global, jsPrincipals, buf, fileSize32, nativePath.get(), 1,
JSVERSION_LATEST);
PR_MemUnmap(buf, fileSize32);
@ -939,8 +938,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
return NS_ERROR_FILE_NOT_FOUND;
}
script = JS_CompileFileHandleForPrincipalsVersion(
cx, global, nativePath.get(), fileHandle, jsPrincipals, JSVERSION_LATEST);
script = JS_CompileFileHandleForPrincipalsVersion(cx, global, nativePath.get(), fileHandle, jsPrincipals, JSVERSION_LATEST);
/* JS will close the filehandle after compilation is complete. */
#endif /* HAVE_PR_MEMMAP */
@ -975,9 +973,8 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
buf[len] = '\0';
script = JS_CompileScriptForPrincipalsVersion(
cx, global, jsPrincipals, buf, bytesRead, nativePath.get(), 1,
JSVERSION_LATEST);
script = JS_CompileScriptForPrincipalsVersion(cx, global, jsPrincipals, buf, bytesRead, nativePath.get(), 1,
JSVERSION_LATEST);
}
// Propagate the exception, if one exists. Also, don't leave the stale
// exception on this context.
@ -1346,7 +1343,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
logBuffer.AppendLiteral(" ");
if (i == symbolCount - 1) {
LOG(("%s] from %s\n", logBuffer.get(),
PromiseFlatCString(aLocation).get()));
PromiseFlatCString(aLocation).get()));
}
#endif
}

Просмотреть файл

@ -155,9 +155,8 @@ mozJSSubScriptLoader::ReadScript(nsIURI *uri, JSContext *cx, JSObject *target_ob
if (charset) {
nsString script;
rv = nsScriptLoader::ConvertToUTF16(
nsnull, reinterpret_cast<const PRUint8*>(buf.get()), len,
nsDependentString(reinterpret_cast<PRUnichar*>(charset)), nsnull, script);
rv = nsScriptLoader::ConvertToUTF16(nsnull, reinterpret_cast<const PRUint8*>(buf.get()), len,
nsDependentString(reinterpret_cast<PRUnichar*>(charset)), nsnull, script);
if (NS_FAILED(rv)) {
JSPRINCIPALS_DROP(cx, jsPrincipals);

Просмотреть файл

@ -1944,7 +1944,7 @@ main(int argc, char **argv, char **envp)
systemprincipal,
nsnull,
nsIXPConnect::
FLAG_SYSTEM_GLOBAL_OBJECT,
FLAG_SYSTEM_GLOBAL_OBJECT,
getter_AddRefs(holder));
if (NS_FAILED(rv))
return 1;

Просмотреть файл

@ -232,8 +232,8 @@ XPCCallContext::SetName(jsid name)
if(mSet &&
mSet->FindMember(name, &mMember, &mInterface,
mWrapper->HasProto() ?
mWrapper->GetProto()->GetSet() :
nsnull,
mWrapper->GetProto()->GetSet() :
nsnull,
&mStaticMemberIsLocal))
{
if(mMember && !mMember->IsConstant())
@ -387,7 +387,7 @@ XPCCallContext::~XPCCallContext()
#endif
NS_ASSERTION(!mThreadData->GetJSContextStack() ||
!mThreadData->GetJSContextStack()->
DEBUG_StackHasJSContext(mJSContext),
DEBUG_StackHasJSContext(mJSContext),
"JSContext still in threadjscontextstack!");
JS_DestroyContext(mJSContext);

Просмотреть файл

@ -77,7 +77,7 @@ JSValIsInterfaceOfType(JSContext *cx, jsval v, REFNSIID iid)
if(!JSVAL_IS_PRIMITIVE(v) &&
nsnull != (xpc = nsXPConnect::GetXPConnect()) &&
NS_SUCCEEDED(xpc->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(v),
getter_AddRefs(wn))) && wn &&
getter_AddRefs(wn))) && wn &&
NS_SUCCEEDED(wn->Native()->QueryInterface(iid, (void**)&iface)) && iface)
{
NS_RELEASE(iface);
@ -148,7 +148,7 @@ nsXPCComponents_Interfaces::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -170,7 +170,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_Interfaces::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -203,8 +203,7 @@ nsXPCComponents_Interfaces::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_Interfaces::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_Interfaces::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -463,7 +462,7 @@ nsXPCComponents_InterfacesByID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -485,7 +484,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_InterfacesByID::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -518,8 +517,7 @@ nsXPCComponents_InterfacesByID::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_InterfacesByID::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_InterfacesByID::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -784,7 +782,7 @@ nsXPCComponents_Classes::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -805,7 +803,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_Classes::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -838,8 +836,7 @@ nsXPCComponents_Classes::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_Classes::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_Classes::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -1036,7 +1033,7 @@ nsXPCComponents_ClassesByID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -1057,7 +1054,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_ClassesByID::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -1090,8 +1087,7 @@ nsXPCComponents_ClassesByID::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_ClassesByID::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_ClassesByID::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -1307,7 +1303,7 @@ nsXPCComponents_Results::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -1328,7 +1324,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_Results::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -1361,8 +1357,7 @@ nsXPCComponents_Results::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_Results::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_Results::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -1536,7 +1531,7 @@ nsXPCComponents_ID::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -1557,7 +1552,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_ID::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -1590,8 +1585,7 @@ nsXPCComponents_ID::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_ID::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_ID::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -1677,8 +1671,7 @@ nsXPCComponents_ID::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
// Do the security check if necessary
nsIXPCSecurityManager* sm =
xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
if(sm && NS_FAILED(sm->CanCreateInstance(cx, nsJSID::GetCID())))
{
// the security manager vetoed. It should have set an exception.
@ -1764,7 +1757,7 @@ nsXPCComponents_Exception::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -1785,7 +1778,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_Exception::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -1818,8 +1811,7 @@ nsXPCComponents_Exception::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_Exception::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_Exception::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -1901,8 +1893,7 @@ nsXPCComponents_Exception::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
// Do the security check if necessary
nsIXPCSecurityManager* sm =
xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
if(sm && NS_FAILED(sm->CanCreateInstance(cx, nsXPCException::GetCID())))
{
// the security manager vetoed. It should have set an exception.
@ -1974,7 +1965,7 @@ nsXPCComponents_Exception::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
JSObject* newObj = nsnull;
if(NS_FAILED(xpc->WrapNative(cx, obj, e, NS_GET_IID(nsIXPCException),
getter_AddRefs(holder))) || !holder ||
getter_AddRefs(holder))) || !holder ||
NS_FAILED(holder->GetJSObject(&newObj)) || !newObj)
{
return ThrowAndFail(NS_ERROR_XPC_CANT_CREATE_WN, cx, _retval);
@ -2059,7 +2050,7 @@ nsXPCConstructor::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -2080,7 +2071,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCConstructor::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -2113,8 +2104,7 @@ nsXPCConstructor::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCConstructor::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCConstructor::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -2233,10 +2223,10 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
JSObject* iidObj;
if(NS_FAILED(xpc->WrapNative(cx, obj, mClassID, NS_GET_IID(nsIJSCID),
getter_AddRefs(cidHolder))) || !cidHolder ||
getter_AddRefs(cidHolder))) || !cidHolder ||
NS_FAILED(cidHolder->GetJSObject(&cidObj)) || !cidObj ||
NS_FAILED(xpc->WrapNative(cx, obj, mInterfaceID, NS_GET_IID(nsIJSIID),
getter_AddRefs(iidHolder))) || !iidHolder ||
getter_AddRefs(iidHolder))) || !iidHolder ||
NS_FAILED(iidHolder->GetJSObject(&iidObj)) || !iidObj)
{
return ThrowAndFail(NS_ERROR_XPC_CANT_CREATE_WN, cx, _retval);
@ -2325,7 +2315,7 @@ nsXPCComponents_Constructor::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -2346,7 +2336,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
nsXPCComponents_Constructor::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -2379,8 +2369,7 @@ nsXPCComponents_Constructor::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents_Constructor::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents_Constructor::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
@ -2474,8 +2463,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
// Do the security check if necessary
nsIXPCSecurityManager* sm =
xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
if(sm && NS_FAILED(sm->CanCreateInstance(cx, nsXPCConstructor::GetCID())))
{
// the security manager vetoed. It should have set an exception.
@ -2530,7 +2518,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
nsCOMPtr<nsIXPConnectWrappedNative> wn;
if(NS_FAILED(xpc->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(val),
getter_AddRefs(wn))) || !wn ||
getter_AddRefs(wn))) || !wn ||
!(cInterfaceID = do_QueryWrappedNative(wn)))
{
return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval);
@ -2544,8 +2532,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
if(info)
{
cInterfaceID =
dont_AddRef(
static_cast<nsIJSIID*>(nsJSIID::NewID(info)));
dont_AddRef(static_cast<nsIJSIID*>(nsJSIID::NewID(info)));
}
if(!cInterfaceID)
return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval);
@ -2584,7 +2571,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
nsCOMPtr<nsIXPConnectWrappedNative> wn;
if(NS_FAILED(xpc->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(val),
getter_AddRefs(wn))) || !wn ||
getter_AddRefs(wn))) || !wn ||
!(cClassID = do_QueryWrappedNative(wn)))
{
return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval);
@ -2601,7 +2588,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,
JSObject* newObj = nsnull;
if(NS_FAILED(xpc->WrapNative(cx, obj, ctor, NS_GET_IID(nsIXPCConstructor),
getter_AddRefs(holder2))) || !holder2 ||
getter_AddRefs(holder2))) || !holder2 ||
NS_FAILED(holder2->GetJSObject(&newObj)) || !newObj)
{
return ThrowAndFail(NS_ERROR_XPC_CANT_CREATE_WN, cx, _retval);
@ -2719,8 +2706,8 @@ nsXPCComponents_Utils::LookupMethod()
nsCOMPtr<nsISupports> callee;
cc->GetCallee(getter_AddRefs(callee));
if(!callee || callee.get() !=
static_cast<const nsISupports*>
(static_cast<const nsIXPCComponents_Utils*>(this)))
static_cast<const nsISupports*>
(static_cast<const nsIXPCComponents_Utils*>(this)))
return NS_ERROR_FAILURE;
#endif
@ -2834,11 +2821,9 @@ nsXPCComponents_Utils::ReportError()
// This function shall never fail! Silently eat any failure conditions.
nsresult rv;
nsCOMPtr<nsIConsoleService> console(
do_GetService(NS_CONSOLESERVICE_CONTRACTID));
nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
nsCOMPtr<nsIScriptError2> scripterr(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
nsCOMPtr<nsIScriptError2> scripterr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
if(!scripterr || !console || !xpc)
@ -2858,8 +2843,8 @@ nsXPCComponents_Utils::ReportError()
nsCOMPtr<nsISupports> callee;
cc->GetCallee(getter_AddRefs(callee));
if(!callee || callee.get() !=
static_cast<const nsISupports*>
(static_cast<const nsIXPCComponents_Utils*>(this))) {
static_cast<const nsISupports*>
(static_cast<const nsIXPCComponents_Utils*>(this))) {
NS_ERROR("reportError() must only be called from JS!");
return NS_ERROR_FAILURE;
}
@ -2899,10 +2884,10 @@ nsXPCComponents_Utils::ReportError()
PRUint32 column = err->uctokenptr - err->uclinebuf;
rv = scripterr->InitWithWindowID(reinterpret_cast<const PRUnichar*>
(err->ucmessage),
(err->ucmessage),
fileUni.get(),
reinterpret_cast<const PRUnichar*>
(err->uclinebuf),
(err->uclinebuf),
err->lineno,
column,
err->flags,
@ -3329,7 +3314,7 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative *wrappe
do_GetService(kScriptSecurityManagerContractID);
if (!secman ||
NS_FAILED(rv = secman->GetCodebasePrincipal(uri,
getter_AddRefs(principal))) ||
getter_AddRefs(principal))) ||
!principal) {
if (NS_SUCCEEDED(rv))
rv = NS_ERROR_FAILURE;
@ -3649,7 +3634,7 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
if (data && (stack = data->GetJSContextStack())) {
if (NS_FAILED(stack->Push(sandcx->GetJSContext()))) {
JS_ReportError(cx,
"Unable to initialize XPConnect with the sandbox context");
"Unable to initialize XPConnect with the sandbox context");
JSPRINCIPALS_DROP(cx, jsPrincipals);
return NS_ERROR_FAILURE;
}
@ -3680,7 +3665,7 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
JS_EvaluateUCScriptForPrincipals(sandcx->GetJSContext(), sandbox,
jsPrincipals,
reinterpret_cast<const jschar *>
(PromiseFlatString(source).get()),
(PromiseFlatString(source).get()),
source.Length(), filename, lineNo,
&v);
if (ok && returnStringOnly && !(JSVAL_IS_VOID(v))) {
@ -4104,7 +4089,7 @@ nsXPCComponents::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -4159,8 +4144,7 @@ nsXPCComponents::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
nsXPCComponents::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
nsXPCComponents::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;

Просмотреть файл

@ -105,9 +105,9 @@ XPCContext::DebugDump(PRInt16 depth)
}
XPC_LOG_ALWAYS(("mCallingLangType of %s",
mCallingLangType == LANG_UNKNOWN ? "LANG_UNKNOWN" :
mCallingLangType == LANG_JS ? "LANG_JS" :
"LANG_NATIVE"));
mCallingLangType == LANG_UNKNOWN ? "LANG_UNKNOWN" :
mCallingLangType == LANG_JS ? "LANG_JS" :
"LANG_NATIVE"));
XPC_LOG_OUTDENT();
#endif
}

Просмотреть файл

@ -275,7 +275,7 @@ XPCConvert::NativeData2JS(XPCLazyCallContext& lccx, jsval* d, const void* s,
bool b = *((bool*)s);
NS_WARN_IF_FALSE(b == 1 || b == 0,
"Passing a malformed bool through XPConnect");
"Passing a malformed bool through XPConnect");
*d = BOOLEAN_TO_JSVAL(!!b);
break;
}
@ -454,9 +454,9 @@ XPCConvert::NativeData2JS(XPCLazyCallContext& lccx, jsval* d, const void* s,
return JS_FALSE;
JSString* jsString = JS_NewExternalString(cx,
(jschar*)unicodeString,
cString->Length(),
sXPCOMUCStringFinalizerIndex);
(jschar*)unicodeString,
cString->Length(),
sXPCOMUCStringFinalizerIndex);
if(!jsString)
{
@ -1050,7 +1050,7 @@ XPCConvert::JSData2Native(XPCCallContext& ccx, void* d, jsval s,
}
PRUint32 length = JS_GetStringLength(str);
nsIAtom* atom = NS_NewAtom(nsDependentSubstring(chars,
chars + length));
chars + length));
if (!atom && pErr)
*pErr = NS_ERROR_OUT_OF_MEMORY;
*((nsISupports**)d) = atom;
@ -1607,7 +1607,7 @@ XPCConvert::JSValToXPCException(XPCCallContext& ccx,
// is this really a native xpcom object with a wrapper?
XPCWrappedNative* wrapper;
if(nsnull != (wrapper =
XPCWrappedNative::GetWrappedNativeOfJSObject(cx,obj)))
XPCWrappedNative::GetWrappedNativeOfJSObject(cx,obj)))
{
nsISupports* supports = wrapper->GetIdentityObject();
nsCOMPtr<nsIException> iface = do_QueryInterface(supports);
@ -1737,11 +1737,10 @@ XPCConvert::JSValToXPCException(XPCCallContext& ccx,
nsISupportsDouble* data;
nsCOMPtr<nsIComponentManager> cm;
if(NS_FAILED(NS_GetComponentManager(getter_AddRefs(cm))) || !cm ||
NS_FAILED(cm->CreateInstanceByContractID(
NS_SUPPORTS_DOUBLE_CONTRACTID,
nsnull,
NS_GET_IID(nsISupportsDouble),
(void**)&data)))
NS_FAILED(cm->CreateInstanceByContractID(NS_SUPPORTS_DOUBLE_CONTRACTID,
nsnull,
NS_GET_IID(nsISupportsDouble),
(void**)&data)))
return NS_ERROR_FAILURE;
data->SetData(number);
rv = ConstructException(NS_ERROR_XPC_JS_THREW_NUMBER, nsnull,

Просмотреть файл

@ -179,10 +179,10 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
JSAutoByteString valueBytes;
const char *value = JSVAL2String(cx, val, &isString, &valueBytes);
buf = JS_sprintf_append(buf, "%s%s%s%s",
k ? ", " : "",
isString ? "\"" : "",
value ? value : "?unknown?",
isString ? "\"" : "");
k ? ", " : "",
isString ? "\"" : "",
value ? value : "?unknown?",
isString ? "\"" : "");
if(!buf) goto out;
}
}

Просмотреть файл

@ -318,14 +318,14 @@ nsXPCException::Initialize(const char *aMessage, nsresult aResult, const char *a
if(aMessage)
{
if(!(mMessage = (char*) nsMemory::Clone(aMessage,
sizeof(char)*(strlen(aMessage)+1))))
sizeof(char)*(strlen(aMessage)+1))))
return NS_ERROR_OUT_OF_MEMORY;
}
if(aName)
{
if(!(mName = (char*) nsMemory::Clone(aName,
sizeof(char)*(strlen(aName)+1))))
sizeof(char)*(strlen(aName)+1))))
return NS_ERROR_OUT_OF_MEMORY;
}

Просмотреть файл

@ -479,8 +479,8 @@ XPCNativeSet::FindMember(jsid name,
!protoSet ||
(protoSet != this &&
!protoSet->MatchesSetUpToInterface(this, Interface) &&
(!protoSet->FindMember(name, &protoMember, (PRUint16*)nsnull) ||
protoMember != Member));
(!protoSet->FindMember(name, &protoMember, (PRUint16*)nsnull) ||
protoMember != Member));
return JS_TRUE;
}

Просмотреть файл

@ -764,8 +764,7 @@ nsJSCID::CreateInstance(nsISupports **_retval)
XPCContext* xpcc = XPCContext::GetXPCContext(cx);
nsIXPCSecurityManager* sm;
sm = xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
sm = xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_INSTANCE);
if(sm && NS_FAILED(sm->CanCreateInstance(cx, mDetails.ID())))
{
NS_ERROR("how are we not being called from chrome here?");
@ -832,8 +831,7 @@ nsJSCID::GetService(nsISupports **_retval)
XPCContext* xpcc = XPCContext::GetXPCContext(cx);
nsIXPCSecurityManager* sm;
sm = xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_GET_SERVICE);
sm = xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_GET_SERVICE);
if(sm && NS_FAILED(sm->CanCreateInstance(cx, mDetails.ID())))
{
NS_ASSERTION(JS_IsExceptionPending(cx),

Просмотреть файл

@ -99,7 +99,7 @@ struct JSDyingJSObjectData
static JSDHashOperator
WrappedJSDyingJSObjectFinder(JSDHashTable *table, JSDHashEntryHdr *hdr,
uint32 number, void *arg)
uint32 number, void *arg)
{
JSDyingJSObjectData* data = (JSDyingJSObjectData*) arg;
nsXPCWrappedJS* wrapper = ((JSObject2WrappedJSMap::Entry*)hdr)->value;
@ -272,8 +272,7 @@ CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
if(!self)
return JS_TRUE;
nsAutoPtr<xpc::CompartmentPrivate> priv(
static_cast<xpc::CompartmentPrivate*>(JS_SetCompartmentPrivate(cx, compartment, nsnull)));
nsAutoPtr<xpc::CompartmentPrivate> priv(static_cast<xpc::CompartmentPrivate*>(JS_SetCompartmentPrivate(cx, compartment, nsnull)));
if(!priv)
return JS_TRUE;
@ -730,9 +729,8 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
XPCWrappedNativeScope::FinishedMarkPhaseOfGC(cx, self);
// Sweep compartments.
self->GetCompartmentMap().EnumerateRead(
(XPCCompartmentMap::EnumReadFunction)
SweepCompartment, cx);
self->GetCompartmentMap().EnumerateRead((XPCCompartmentMap::EnumReadFunction)
SweepCompartment, cx);
self->mDoingFinalization = JS_TRUE;
break;
@ -783,7 +781,7 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
XPCPerThreadData* thread;
while(nsnull != (thread =
XPCPerThreadData::IterateThreads(&iterp)))
XPCPerThreadData::IterateThreads(&iterp)))
{
// Mark those AutoMarkingPtr lists!
thread->MarkAutoRootsAfterJSFinalize();
@ -880,7 +878,7 @@ JSBool XPCJSRuntime::GCCallback(JSContext *cx, JSGCStatus status)
XPCPerThreadData* thread;
while(nsnull != (thread =
XPCPerThreadData::IterateThreads(&iterp)))
XPCPerThreadData::IterateThreads(&iterp)))
{
XPCCallContext* ccxp = thread->GetCallContext();
while(ccxp)
@ -1476,11 +1474,11 @@ GetGCChunkTotalBytes()
}
NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSGCHeap,
"js-gc-heap",
KIND_OTHER,
nsIMemoryReporter::UNITS_BYTES,
GetGCChunkTotalBytes,
"Memory used by the garbage-collected JavaScript heap.")
"js-gc-heap",
KIND_OTHER,
nsIMemoryReporter::UNITS_BYTES,
GetGCChunkTotalBytes,
"Memory used by the garbage-collected JavaScript heap.")
static PRInt64
GetJSSystemCompartmentCount()
@ -1516,24 +1514,24 @@ GetJSUserCompartmentCount()
// easily report them via telemetry, so we live with the small risk of
// inconsistencies.
NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSSystemCompartmentCount,
"js-compartments-system",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSSystemCompartmentCount,
"The number of JavaScript compartments for system code. The sum of this "
"and 'js-compartments-user' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
"js-compartments-system",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSSystemCompartmentCount,
"The number of JavaScript compartments for system code. The sum of this "
"and 'js-compartments-user' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSUserCompartmentCount,
"js-compartments-user",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSUserCompartmentCount,
"The number of JavaScript compartments for user code. The sum of this "
"and 'js-compartments-system' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
"js-compartments-user",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSUserCompartmentCount,
"The number of JavaScript compartments for user code. The sum of this "
"and 'js-compartments-system' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
namespace mozilla {
namespace xpconnect {
@ -1679,179 +1677,179 @@ ReportCompartmentStats(const CompartmentStats &stats,
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/arena-headers"),
JS_GC_HEAP_KIND, stats.gcHeapArenaHeaders,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is used to hold internal book-keeping information.",
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is used to hold internal book-keeping information.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/arena-padding"),
JS_GC_HEAP_KIND, stats.gcHeapArenaPadding,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is unused and present only so that other data is aligned. "
"This constitutes internal fragmentation.",
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that is unused and present only so that other data is aligned. "
"This constitutes internal fragmentation.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/arena-unused"),
JS_GC_HEAP_KIND, stats.gcHeapArenaUnused,
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that could be holding useful data but currently isn't.",
"Memory on the compartment's garbage-collected JavaScript heap, within "
"arenas, that could be holding useful data but currently isn't.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/objects"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_OBJECT],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"objects.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"objects.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/strings"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_STRING],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"string headers. String headers contain various pieces of information "
"about a string, but do not contain (except in the case of very short "
"strings) the string characters; characters in longer strings are counted "
"under 'gc-heap/string-chars' instead.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"string headers. String headers contain various pieces of information "
"about a string, but do not contain (except in the case of very short "
"strings) the string characters; characters in longer strings are counted "
"under 'gc-heap/string-chars' instead.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/scripts"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_SCRIPT],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"JSScript instances. A JSScript is created for each user-defined function "
"in a script. One is also created for the top-level code in a script.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"JSScript instances. A JSScript is created for each user-defined function "
"in a script. One is also created for the top-level code in a script.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/shapes"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_SHAPE],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"shapes. A shape is an internal data structure that makes JavaScript "
"property accesses fast.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"shapes. A shape is an internal data structure that makes JavaScript "
"property accesses fast.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/type-objects"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_TYPE_OBJECT],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"type inference information.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"type inference information.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"gc-heap/xml"),
JS_GC_HEAP_KIND, stats.gcHeapKinds[JSTRACE_XML],
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"E4X XML objects.",
"Memory on the compartment's garbage-collected JavaScript heap that holds "
"E4X XML objects.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"object-slots"),
nsIMemoryReporter::KIND_HEAP, stats.objectSlots,
"Memory allocated for the compartment's non-fixed object slot arrays, "
"which are used to represent object properties. Some objects also "
"contain a fixed number of slots which are stored on the compartment's "
"JavaScript heap; those slots are not counted here, but in "
"'gc-heap/objects' instead." SLOP_BYTES_STRING,
"Memory allocated for the compartment's non-fixed object slot arrays, "
"which are used to represent object properties. Some objects also "
"contain a fixed number of slots which are stored on the compartment's "
"JavaScript heap; those slots are not counted here, but in "
"'gc-heap/objects' instead." SLOP_BYTES_STRING,
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"string-chars"),
nsIMemoryReporter::KIND_HEAP, stats.stringChars,
"Memory allocated to hold the compartment's string characters. Sometimes "
"more memory is allocated than necessary, to simplify string "
"concatenation. Each string also includes a header which is stored on the "
"compartment's JavaScript heap; that header is not counted here, but in "
"'gc-heap/strings' instead.",
"Memory allocated to hold the compartment's string characters. Sometimes "
"more memory is allocated than necessary, to simplify string "
"concatenation. Each string also includes a header which is stored on the "
"compartment's JavaScript heap; that header is not counted here, but in "
"'gc-heap/strings' instead.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"property-tables"),
nsIMemoryReporter::KIND_HEAP, stats.propertyTables,
"Memory allocated for the compartment's property tables. A property "
"table is an internal data structure that makes JavaScript property "
"accesses fast." SLOP_BYTES_STRING,
"Memory allocated for the compartment's property tables. A property "
"table is an internal data structure that makes JavaScript property "
"accesses fast." SLOP_BYTES_STRING,
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"object-empty-shapes"),
nsIMemoryReporter::KIND_HEAP,
stats.typeInferenceMemory.emptyShapes,
"Arrays attached to prototype JS objects managing shape information.",
"Arrays attached to prototype JS objects managing shape information.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"shape-kids"),
nsIMemoryReporter::KIND_HEAP, stats.shapeKids,
"Memory allocated for the compartment's shape kids. A shape kid "
"is an internal data structure that makes JavaScript property accesses "
"fast.",
"Memory allocated for the compartment's shape kids. A shape kid "
"is an internal data structure that makes JavaScript property accesses "
"fast.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"script-data"),
nsIMemoryReporter::KIND_HEAP, stats.scriptData,
"Memory allocated for JSScript bytecode and various variable-length "
"tables." SLOP_BYTES_STRING,
"Memory allocated for JSScript bytecode and various variable-length "
"tables." SLOP_BYTES_STRING,
callback, closure);
#ifdef JS_METHODJIT
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"mjit-code/method"),
nsIMemoryReporter::KIND_NONHEAP, stats.mjitCodeMethod,
"Memory used by the method JIT to hold the compartment's generated code.",
"Memory used by the method JIT to hold the compartment's generated code.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"mjit-code/regexp"),
nsIMemoryReporter::KIND_NONHEAP, stats.mjitCodeRegexp,
"Memory used by the regexp JIT to hold the compartment's generated code.",
"Memory used by the regexp JIT to hold the compartment's generated code.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"mjit-code/unused"),
nsIMemoryReporter::KIND_NONHEAP, stats.mjitCodeUnused,
"Memory allocated by the method and/or regexp JIT to hold the "
"compartment's code, but which is currently unused.",
"Memory allocated by the method and/or regexp JIT to hold the "
"compartment's code, but which is currently unused.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"mjit-data"),
nsIMemoryReporter::KIND_HEAP, stats.mjitData,
"Memory used by the method JIT for the compartment's compilation data: "
"JITScripts, native maps, and inline cache structs." SLOP_BYTES_STRING,
"Memory used by the method JIT for the compartment's compilation data: "
"JITScripts, native maps, and inline cache structs." SLOP_BYTES_STRING,
callback, closure);
#endif
#ifdef JS_TRACER
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"tjit-code"),
nsIMemoryReporter::KIND_NONHEAP, stats.tjitCode,
"Memory used by the trace JIT to hold the compartment's generated code.",
"Memory used by the trace JIT to hold the compartment's generated code.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"tjit-data/allocators-main"),
nsIMemoryReporter::KIND_HEAP,
stats.tjitDataAllocatorsMain,
"Memory used by the trace JIT to store the compartment's trace-related "
"data. This data is allocated via the compartment's VMAllocators.",
"Memory used by the trace JIT to store the compartment's trace-related "
"data. This data is allocated via the compartment's VMAllocators.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"tjit-data/allocators-reserve"),
nsIMemoryReporter::KIND_HEAP,
stats.tjitDataAllocatorsReserve,
"Memory used by the trace JIT and held in reserve for the compartment's "
"VMAllocators in case of OOM.",
"Memory used by the trace JIT and held in reserve for the compartment's "
"VMAllocators in case of OOM.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"tjit-data/trace-monitor"),
nsIMemoryReporter::KIND_HEAP,
stats.tjitDataNonAllocators,
"Memory used by the trace JIT that is stored in the TraceMonitor. This "
"includes the TraceMonitor object itself, plus its TraceNativeStorage, "
"RecordAttemptMap, and LoopProfileMap.",
"Memory used by the trace JIT that is stored in the TraceMonitor. This "
"includes the TraceMonitor object itself, plus its TraceNativeStorage, "
"RecordAttemptMap, and LoopProfileMap.",
callback, closure);
#endif
@ -1859,31 +1857,31 @@ ReportCompartmentStats(const CompartmentStats &stats,
"type-inference/script-main"),
nsIMemoryReporter::KIND_HEAP,
stats.typeInferenceMemory.scripts,
"Memory used during type inference to store type sets of variables "
"and dynamically observed types.",
"Memory used during type inference to store type sets of variables "
"and dynamically observed types.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"type-inference/object-main"),
JS_GC_HEAP_KIND,
stats.typeInferenceMemory.objects,
"Memory used during type inference to store types and possible "
"property types of JS objects.",
"Memory used during type inference to store types and possible "
"property types of JS objects.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"type-inference/tables"),
nsIMemoryReporter::KIND_HEAP,
stats.typeInferenceMemory.tables,
"Memory used during type inference for compartment-wide tables.",
"Memory used during type inference for compartment-wide tables.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"analysis-temporary"),
nsIMemoryReporter::KIND_HEAP,
stats.typeInferenceMemory.temporary,
"Memory used during type inference and compilation to hold transient "
"analysis information. Cleared on GC.",
"Memory used during type inference and compilation to hold transient "
"analysis information. Cleared on GC.",
callback, closure);
}
@ -1902,42 +1900,42 @@ ReportJSRuntimeStats(const IterateData &data, const nsACString &pathPrefix,
ReportMemoryBytes(pathPrefix + NS_LITERAL_CSTRING("runtime/runtime-object"),
nsIMemoryReporter::KIND_NONHEAP, data.runtimeObjectSize,
"Memory used by the JSRuntime object." SLOP_BYTES_STRING,
"Memory used by the JSRuntime object." SLOP_BYTES_STRING,
callback, closure);
ReportMemoryBytes(pathPrefix + NS_LITERAL_CSTRING("runtime/atoms-table"),
nsIMemoryReporter::KIND_NONHEAP, data.atomsTableSize,
"Memory used by the atoms table.",
"Memory used by the atoms table.",
callback, closure);
ReportMemoryBytes(pathPrefix + NS_LITERAL_CSTRING("stack"),
nsIMemoryReporter::KIND_NONHEAP, data.stackSize,
"Memory used for the JavaScript stack. This is the committed portion "
"of the stack; any uncommitted portion is not measured because it "
"hardly costs anything.",
"Memory used for the JavaScript stack. This is the committed portion "
"of the stack; any uncommitted portion is not measured because it "
"hardly costs anything.",
callback, closure);
ReportMemoryBytes(pathPrefix +
NS_LITERAL_CSTRING("gc-heap-chunk-dirty-unused"),
JS_GC_HEAP_KIND, data.gcHeapChunkDirtyUnused,
"Memory on the garbage-collected JavaScript heap, within chunks with at "
"least one allocated GC thing, that could be holding useful data but "
"currently isn't.",
"Memory on the garbage-collected JavaScript heap, within chunks with at "
"least one allocated GC thing, that could be holding useful data but "
"currently isn't.",
callback, closure);
ReportMemoryBytes(pathPrefix +
NS_LITERAL_CSTRING("gc-heap-chunk-clean-unused"),
JS_GC_HEAP_KIND, data.gcHeapChunkCleanUnused,
"Memory on the garbage-collected JavaScript heap taken by completely empty "
"chunks, that soon will be released unless claimed for new allocations.",
callback, closure);
"Memory on the garbage-collected JavaScript heap taken by completely empty "
"chunks, that soon will be released unless claimed for new allocations.",
callback, closure);
ReportMemoryBytes(pathPrefix +
NS_LITERAL_CSTRING("gc-heap-chunk-admin"),
JS_GC_HEAP_KIND, data.gcHeapChunkAdmin,
"Memory on the garbage-collected JavaScript heap, within chunks, that is "
"used to hold internal book-keeping information.",
callback, closure);
"Memory on the garbage-collected JavaScript heap, within chunks, that is "
"used to hold internal book-keeping information.",
callback, closure);
}
} // namespace memory
@ -1971,41 +1969,40 @@ public:
ReportMemoryBytes(NS_LITERAL_CSTRING("js-gc-heap-chunk-dirty-unused"),
nsIMemoryReporter::KIND_OTHER,
data.gcHeapChunkDirtyUnused,
"The same as 'explicit/js/gc-heap-chunk-dirty-unused'. Shown here for "
"easy comparison with other 'js-gc' reporters.",
"The same as 'explicit/js/gc-heap-chunk-dirty-unused'. Shown here for "
"easy comparison with other 'js-gc' reporters.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-gc-heap-chunk-clean-unused"),
nsIMemoryReporter::KIND_OTHER,
data.gcHeapChunkCleanUnused,
"The same as 'explicit/js/gc-heap-chunk-clean-unused'. Shown here for "
"easy comparison with other 'js-gc' reporters.",
"The same as 'explicit/js/gc-heap-chunk-clean-unused'. Shown here for "
"easy comparison with other 'js-gc' reporters.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-gc-heap-arena-unused"),
nsIMemoryReporter::KIND_OTHER, data.gcHeapArenaUnused,
"Memory on the garbage-collected JavaScript heap, within arenas, that "
"could be holding useful data but currently isn't. This is the sum of "
"all compartments' 'gc-heap/arena-unused' numbers.",
"Memory on the garbage-collected JavaScript heap, within arenas, that "
"could be holding useful data but currently isn't. This is the sum of "
"all compartments' 'gc-heap/arena-unused' numbers.",
callback, closure);
ReportMemoryPercentage(NS_LITERAL_CSTRING("js-gc-heap-unused-fraction"),
nsIMemoryReporter::KIND_OTHER,
data.gcHeapUnusedPercentage,
"Fraction of the garbage-collected JavaScript heap that is unused. "
"Computed as ('js-gc-heap-chunk-clean-unused' + "
"'js-gc-heap-chunk-dirty-unused' + 'js-gc-heap-arena-unused') / "
"'js-gc-heap'.",
"Fraction of the garbage-collected JavaScript heap that is unused. "
"Computed as ('js-gc-heap-chunk-clean-unused' + "
"'js-gc-heap-chunk-dirty-unused' + 'js-gc-heap-arena-unused') / "
"'js-gc-heap'.",
callback, closure);
return NS_OK;
}
};
NS_IMPL_THREADSAFE_ISUPPORTS1(
XPConnectJSCompartmentsMultiReporter
, nsIMemoryMultiReporter
)
NS_IMPL_THREADSAFE_ISUPPORTS1(XPConnectJSCompartmentsMultiReporter
, nsIMemoryMultiReporter
)
#ifdef MOZ_CRASHREPORTER
static JSBool
@ -2276,8 +2273,8 @@ XPCJSRuntime::DebugDump(PRInt16 depth)
XPC_LOG_ALWAYS(("mMapLock @ %x", mMapLock));
XPC_LOG_ALWAYS(("mWrappedJSToReleaseArray @ %x with %d wrappers(s)", \
&mWrappedJSToReleaseArray,
mWrappedJSToReleaseArray.Length()));
&mWrappedJSToReleaseArray,
mWrappedJSToReleaseArray.Length()));
int cxCount = 0;
JSContext* iter = nsnull;
@ -2295,8 +2292,8 @@ XPCJSRuntime::DebugDump(PRInt16 depth)
}
XPC_LOG_ALWAYS(("mWrappedJSClassMap @ %x with %d wrapperclasses(s)", \
mWrappedJSClassMap, mWrappedJSClassMap ? \
mWrappedJSClassMap->Count() : 0));
mWrappedJSClassMap, mWrappedJSClassMap ? \
mWrappedJSClassMap->Count() : 0));
// iterate wrappersclasses...
if(depth && mWrappedJSClassMap && mWrappedJSClassMap->Count())
{
@ -2305,8 +2302,8 @@ XPCJSRuntime::DebugDump(PRInt16 depth)
XPC_LOG_OUTDENT();
}
XPC_LOG_ALWAYS(("mWrappedJSMap @ %x with %d wrappers(s)", \
mWrappedJSMap, mWrappedJSMap ? \
mWrappedJSMap->Count() : 0));
mWrappedJSMap, mWrappedJSMap ? \
mWrappedJSMap->Count() : 0));
// iterate wrappers...
if(depth && mWrappedJSMap && mWrappedJSMap->Count())
{
@ -2316,20 +2313,20 @@ XPCJSRuntime::DebugDump(PRInt16 depth)
}
XPC_LOG_ALWAYS(("mIID2NativeInterfaceMap @ %x with %d interface(s)", \
mIID2NativeInterfaceMap, mIID2NativeInterfaceMap ? \
mIID2NativeInterfaceMap->Count() : 0));
mIID2NativeInterfaceMap, mIID2NativeInterfaceMap ? \
mIID2NativeInterfaceMap->Count() : 0));
XPC_LOG_ALWAYS(("mClassInfo2NativeSetMap @ %x with %d sets(s)", \
mClassInfo2NativeSetMap, mClassInfo2NativeSetMap ? \
mClassInfo2NativeSetMap->Count() : 0));
mClassInfo2NativeSetMap, mClassInfo2NativeSetMap ? \
mClassInfo2NativeSetMap->Count() : 0));
XPC_LOG_ALWAYS(("mThisTranslatorMap @ %x with %d translator(s)", \
mThisTranslatorMap, mThisTranslatorMap ? \
mThisTranslatorMap->Count() : 0));
mThisTranslatorMap, mThisTranslatorMap ? \
mThisTranslatorMap->Count() : 0));
XPC_LOG_ALWAYS(("mNativeSetMap @ %x with %d sets(s)", \
mNativeSetMap, mNativeSetMap ? \
mNativeSetMap->Count() : 0));
mNativeSetMap, mNativeSetMap ? \
mNativeSetMap->Count() : 0));
// iterate sets...
if(depth && mNativeSetMap && mNativeSetMap->Count())

Просмотреть файл

@ -120,7 +120,7 @@ extern void LogSlimWrapperNotCreated(JSContext *cx, nsISupports *obj,
if (strId) \
{ \
NS_ConvertUTF16toUTF8 name((PRUnichar*)::JS_GetStringChars(strId), \
::JS_GetStringLength(strId)); \
::JS_GetStringLength(strId)); \
LOG_WILL_MORPH_FOR_PROP(cx, obj, name.get()); \
} \
else \

Просмотреть файл

@ -56,8 +56,8 @@ HashIIDPtrKey(JSDHashTable *table, const void *key)
static JSBool
MatchIIDPtrKey(JSDHashTable *table,
const JSDHashEntryHdr *entry,
const void *key)
const JSDHashEntryHdr *entry,
const void *key)
{
return ((const nsID*)key)->
Equals(*((const nsID*)((JSDHashEntryStub*)entry)->key));
@ -485,8 +485,8 @@ XPCNativeScriptableSharedMap::Entry::Hash(JSDHashTable *table, const void *key)
JSBool
XPCNativeScriptableSharedMap::Entry::Match(JSDHashTable *table,
const JSDHashEntryHdr *entry,
const void *key)
const JSDHashEntryHdr *entry,
const void *key)
{
XPCNativeScriptableShared* obj1 =
((XPCNativeScriptableSharedMap::Entry*) entry)->key;

Просмотреть файл

@ -94,8 +94,7 @@ LookupInterfaceOrAncestor(PRUint32 tableSize, const xpc_qsHashEntry *table,
* supports, including ancestors.
*/
nsCOMPtr<nsIInterfaceInfo> info;
if(NS_FAILED(nsXPConnect::GetXPConnect()->GetInfoForIID(
&iid, getter_AddRefs(info))))
if(NS_FAILED(nsXPConnect::GetXPConnect()->GetInfoForIID(&iid, getter_AddRefs(info))))
return nsnull;
const nsIID *piid;
@ -446,10 +445,9 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN flags,
{
for(; fs->name; fs++)
{
if(!JS_DefineFunction(
cx, proto, fs->name,
reinterpret_cast<JSNative>(fs->native),
fs->arity, flags))
if(!JS_DefineFunction(cx, proto, fs->name,
reinterpret_cast<JSNative>(fs->native),
fs->arity, flags))
return JS_FALSE;
}
}
@ -459,9 +457,8 @@ xpc_qsDefineQuickStubs(JSContext *cx, JSObject *proto, uintN flags,
{
for(; ts->name; ts++)
{
if(!JS_DefineFunction(
cx, proto, ts->name, ts->native, ts->arity,
flags | JSFUN_STUB_GSOPS | JSFUN_TRCINFO))
if(!JS_DefineFunction(cx, proto, ts->name, ts->native, ts->arity,
flags | JSFUN_STUB_GSOPS | JSFUN_TRCINFO))
return JS_FALSE;
}
}
@ -577,9 +574,8 @@ ThrowCallFailed(JSContext *cx, nsresult rv,
// else...
if(!nsXPCException::NameAndFormatForNSResult(
NS_ERROR_XPC_NATIVE_RETURNED_FAILURE, nsnull, &format) ||
!format)
if(!nsXPCException::NameAndFormatForNSResult(NS_ERROR_XPC_NATIVE_RETURNED_FAILURE, nsnull, &format) ||
!format)
{
format = "";
}
@ -591,7 +587,7 @@ ThrowCallFailed(JSContext *cx, nsresult rv,
: "unknown";
}
if(nsXPCException::NameAndFormatForNSResult(rv, &name, nsnull)
&& name)
&& name)
{
sz = JS_smprintf("%s 0x%x (%s) [%s.%s]",
format, rv, name, ifaceName, memberName);
@ -942,8 +938,8 @@ xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv)
{
*ppArgRef = nsnull;
*rv = ((JSVAL_IS_INT(v) && JSVAL_TO_INT(v) == 0)
? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL
: NS_ERROR_XPC_BAD_CONVERT_JS);
? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL
: NS_ERROR_XPC_BAD_CONVERT_JS);
return nsnull;
}

Просмотреть файл

@ -378,8 +378,7 @@ protected:
{
// Here behavior == eStringify implies !pval, so both eNull and
// eStringify should end up with void strings.
(new(mBuf) implementation_type(
traits::sEmptyBuffer, PRUint32(0)))->
(new(mBuf) implementation_type(traits::sEmptyBuffer, PRUint32(0)))->
SetIsVoid(behavior != eEmpty);
mValid = JS_TRUE;
return nsnull;

Просмотреть файл

@ -106,7 +106,7 @@ BackstagePass::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
nsIID* clone;
#define PUSH_IID(id) \
clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \
sizeof(nsIID))); \
sizeof(nsIID))); \
if (!clone) \
goto oom; \
array[index++] = clone;
@ -127,7 +127,7 @@ oom:
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP
BackstagePass::GetHelperForLanguage(PRUint32 language,
nsISupports **retval)
nsISupports **retval)
{
*retval = nsnull;
return NS_OK;
@ -160,8 +160,7 @@ BackstagePass::GetClassID(nsCID * *aClassID)
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP
BackstagePass::GetImplementationLanguage(
PRUint32 *aImplementationLanguage)
BackstagePass::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;

Просмотреть файл

@ -51,13 +51,12 @@ public:
static nsresult CreateStack(JSContext* cx, JSStackFrame* fp,
XPCJSStackFrame** stack);
static nsresult CreateStackFrameLocation(
PRUint32 aLanguage,
const char* aFilename,
const char* aFunctionName,
PRInt32 aLineNumber,
nsIStackFrame* aCaller,
XPCJSStackFrame** stack);
static nsresult CreateStackFrameLocation(PRUint32 aLanguage,
const char* aFilename,
const char* aFunctionName,
PRInt32 aLineNumber,
nsIStackFrame* aCaller,
XPCJSStackFrame** stack);
XPCJSStackFrame();
virtual ~XPCJSStackFrame();
@ -99,13 +98,12 @@ XPCJSStack::CreateStackFrameLocation(PRUint32 aLanguage,
nsIStackFrame* aCaller,
nsIStackFrame** stack)
{
return XPCJSStackFrame::CreateStackFrameLocation(
aLanguage,
aFilename,
aFunctionName,
aLineNumber,
aCaller,
(XPCJSStackFrame**) stack);
return XPCJSStackFrame::CreateStackFrameLocation(aLanguage,
aFilename,
aFunctionName,
aLineNumber,
aCaller,
(XPCJSStackFrame**) stack);
}
@ -232,7 +230,7 @@ XPCJSStackFrame::CreateStackFrameLocation(PRUint32 aLanguage,
{
self->mFilename = (char*)
nsMemory::Clone(aFilename,
sizeof(char)*(strlen(aFilename)+1));
sizeof(char)*(strlen(aFilename)+1));
if(!self->mFilename)
failed = JS_TRUE;
}
@ -241,7 +239,7 @@ XPCJSStackFrame::CreateStackFrameLocation(PRUint32 aLanguage,
{
self->mFunname = (char*)
nsMemory::Clone(aFunctionName,
sizeof(char)*(strlen(aFunctionName)+1));
sizeof(char)*(strlen(aFunctionName)+1));
if(!self->mFunname)
failed = JS_TRUE;
}

Просмотреть файл

@ -121,7 +121,7 @@ XPCStringConvert::ReadableToJSVal(JSContext *cx,
jschar *chars = reinterpret_cast<jschar *>
(JS_malloc(cx, (length + 1) *
sizeof(jschar)));
sizeof(jschar)));
if (!chars)
return JSVAL_NULL;

Просмотреть файл

@ -217,10 +217,9 @@ XPCThrower::BuildAndThrowException(JSContext* cx, nsresult rv, const char* sz)
{
// Ask the provider for the exception, if there is no provider
// we expect it to set e to null
exceptionManager->GetExceptionFromProvider(
rv,
defaultException,
getter_AddRefs(finalException));
exceptionManager->GetExceptionFromProvider(rv,
defaultException,
getter_AddRefs(finalException));
// We should get at least the defaultException back,
// but just in case
if(finalException == nsnull)

Просмотреть файл

@ -407,7 +407,7 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
return nsnull != (xpc = nsXPConnect::GetXPConnect()) &&
NS_SUCCEEDED(xpc->WrapJS(ccx, jsobj,
iid, getter_AddRefs(wrapper))) &&
iid, getter_AddRefs(wrapper))) &&
NS_SUCCEEDED(nsVariant::SetFromInterface(&mData, iid, wrapper));
}
@ -434,10 +434,10 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
nsresult rv = variant->GetAsJSVal(&realVal);
if(NS_SUCCEEDED(rv) &&
(JSVAL_IS_PRIMITIVE(realVal) ||
type == nsIDataType::VTYPE_ARRAY ||
type == nsIDataType::VTYPE_EMPTY_ARRAY ||
type == nsIDataType::VTYPE_ID))
(JSVAL_IS_PRIMITIVE(realVal) ||
type == nsIDataType::VTYPE_ARRAY ||
type == nsIDataType::VTYPE_EMPTY_ARRAY ||
type == nsIDataType::VTYPE_ID))
{
JSContext *cx = lccx.GetJSContext();
if(!JS_WrapValue(cx, &realVal))
@ -570,7 +570,7 @@ XPCVariant::VariantDataToJS(XPCLazyCallContext& lccx,
break;
case nsIDataType::VTYPE_WSTRING_SIZE_IS:
if(NS_FAILED(variant->GetAsWStringWithSize(&size,
(PRUnichar**)&xpctvar.val.p)))
(PRUnichar**)&xpctvar.val.p)))
return JS_FALSE;
xpctvar.type = (uint8)(TD_PWSTRING_SIZE_IS | XPT_TDP_POINTER);
xpctvar.SetValNeedsCleanup();

Просмотреть файл

@ -539,7 +539,7 @@ nsXPCWrappedJS::FindInherited(REFNSIID aIID)
{
bool found;
if(NS_SUCCEEDED(cur->GetClass()->GetInterfaceInfo()->
HasAncestor(&aIID, &found)) && found)
HasAncestor(&aIID, &found)) && found)
return cur;
}
@ -658,7 +658,7 @@ nsXPCWrappedJS::DebugDump(PRInt16 depth)
bool isRoot = mRoot == this;
XPC_LOG_ALWAYS(("%s wrapper around JSObject @ %x", \
isRoot ? "ROOT":"non-root", mJSObj));
isRoot ? "ROOT":"non-root", mJSObj));
char* name;
GetClass()->GetInterfaceInfo()->GetName(&name);
XPC_LOG_ALWAYS(("interface name is %s", name));

Просмотреть файл

@ -117,7 +117,7 @@ AutoScriptEvaluate::~AutoScriptEvaluate()
{
nsCOMPtr<nsIXPCScriptNotify> scriptNotify =
do_QueryInterface(static_cast<nsISupports*>
(JS_GetContextPrivate(mJSContext)));
(JS_GetContextPrivate(mJSContext)));
if(scriptNotify)
scriptNotify->ScriptExecuted();
}
@ -957,7 +957,7 @@ nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
if(type_tag == nsXPTType::T_INTERFACE)
{
if(NS_SUCCEEDED(GetInterfaceInfo()->
GetIIDForParamNoAlloc(methodIndex, &param, result)))
GetIIDForParamNoAlloc(methodIndex, &param, result)))
{
return JS_TRUE;
}
@ -1414,11 +1414,11 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
nsCOMPtr<nsISupports> newThis;
if(NS_FAILED(translator->
TranslateThis((nsISupports*)nativeParams[0].val.p,
mInfo, methodIndex,
&hideFirstParamFromJS,
&newWrapperIID,
getter_AddRefs(newThis))))
TranslateThis((nsISupports*)nativeParams[0].val.p,
mInfo, methodIndex,
&hideFirstParamFromJS,
&newWrapperIID,
getter_AddRefs(newThis))))
{
goto pre_call_clean_up;
}
@ -1433,9 +1433,9 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
xpcObjectHelper helper(newThis);
JSBool ok =
XPCConvert::NativeInterface2JSObject(ccx,
&v, nsnull, helper, newWrapperIID,
nsnull, PR_FALSE, PR_FALSE,
nsnull);
&v, nsnull, helper, newWrapperIID,
nsnull, PR_FALSE, PR_FALSE,
nsnull);
if(newWrapperIID)
nsMemory::Free(newWrapperIID);
if(!ok)
@ -1543,9 +1543,9 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
else if(isSizedString)
{
if(!XPCConvert::NativeStringWithSize2JS(ccx, &val,
(const void*)&pv->val,
datum_type,
array_count, nsnull))
(const void*)&pv->val,
datum_type,
array_count, nsnull))
goto pre_call_clean_up;
}
else
@ -1569,8 +1569,8 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16 methodIndex,
if(param.IsIn())
{
if(!JS_SetPropertyById(cx, out_obj,
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
{
goto pre_call_clean_up;
}
@ -1735,8 +1735,8 @@ pre_call_clean_up:
val = rval;
else if(JSVAL_IS_PRIMITIVE(argv[i]) ||
!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
break;
// setup allocator and/or iid
@ -1744,8 +1744,8 @@ pre_call_clean_up:
if(type_tag == nsXPTType::T_INTERFACE)
{
if(NS_FAILED(GetInterfaceInfo()->
GetIIDForParamNoAlloc(methodIndex, &param,
&param_iid)))
GetIIDForParamNoAlloc(methodIndex, &param,
&param_iid)))
break;
}
@ -1782,8 +1782,8 @@ pre_call_clean_up:
if(param.IsRetval())
val = rval;
else if(!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
&val))
break;
// setup allocator and/or iid
@ -1825,9 +1825,9 @@ pre_call_clean_up:
else if(isSizedString)
{
if(!XPCConvert::JSStringWithSize2Native(ccx,
(void*)&pv->val, val,
array_count, array_count,
datum_type, nsnull))
(void*)&pv->val, val,
array_count, array_count,
datum_type, nsnull))
break;
}
else
@ -1947,7 +1947,7 @@ nsXPCWrappedJSClass::DebugDump(PRInt16 depth)
for(uint16 i = 0; i < methodCount; i++)
{
XPC_LOG_ALWAYS(("Method %d is %s%s", \
i, IsReflectable(i) ? "":" NOT ","reflectable"));
i, IsReflectable(i) ? "":" NOT ","reflectable"));
}
XPC_LOG_OUTDENT();
depth++;

Просмотреть файл

@ -956,9 +956,8 @@ XPCWrappedNative::Destroy()
// This is factored out so that it can be called publicly
// static
void
XPCWrappedNative::GatherProtoScriptableCreateInfo(
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto)
XPCWrappedNative::GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto)
{
NS_ASSERTION(classInfo, "bad param");
NS_ASSERTION(!sciProto.GetCallback(), "bad param");
@ -982,9 +981,8 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo(
}
nsCOMPtr<nsISupports> possibleHelper;
nsresult rv = classInfo->GetHelperForLanguage(
nsIProgrammingLanguage::JAVASCRIPT,
getter_AddRefs(possibleHelper));
nsresult rv = classInfo->GetHelperForLanguage(nsIProgrammingLanguage::JAVASCRIPT,
getter_AddRefs(possibleHelper));
if(NS_SUCCEEDED(rv) && possibleHelper)
{
nsCOMPtr<nsIXPCScriptable> helper(do_QueryInterface(possibleHelper));
@ -1003,11 +1001,10 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo(
// static
const XPCNativeScriptableCreateInfo&
XPCWrappedNative::GatherScriptableCreateInfo(
nsISupports* obj,
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto,
XPCNativeScriptableCreateInfo& sciWrapper)
XPCWrappedNative::GatherScriptableCreateInfo(nsISupports* obj,
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto,
XPCNativeScriptableCreateInfo& sciWrapper)
{
NS_ASSERTION(!sciWrapper.GetCallback(), "bad param");
@ -1036,53 +1033,53 @@ XPCWrappedNative::GatherScriptableCreateInfo(
// the siWrapper...
NS_ASSERTION(!(sciWrapper.GetFlags().WantPreCreate() &&
!sciProto.GetFlags().WantPreCreate()),
!sciProto.GetFlags().WantPreCreate()),
"Can't set WANT_PRECREATE on an instance scriptable "
"without also setting it on the class scriptable");
NS_ASSERTION(!(sciWrapper.GetFlags().DontEnumStaticProps() &&
!sciProto.GetFlags().DontEnumStaticProps() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
!sciProto.GetFlags().DontEnumStaticProps() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
"Can't set DONT_ENUM_STATIC_PROPS on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().DontEnumQueryInterface() &&
!sciProto.GetFlags().DontEnumQueryInterface() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
!sciProto.GetFlags().DontEnumQueryInterface() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
"Can't set DONT_ENUM_QUERY_INTERFACE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().DontAskInstanceForScriptable() &&
!sciProto.GetFlags().DontAskInstanceForScriptable()),
!sciProto.GetFlags().DontAskInstanceForScriptable()),
"Can't set DONT_ASK_INSTANCE_FOR_SCRIPTABLE on an instance scriptable "
"without also setting it on the class scriptable");
NS_ASSERTION(!(sciWrapper.GetFlags().ClassInfoInterfacesOnly() &&
!sciProto.GetFlags().ClassInfoInterfacesOnly() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
!sciProto.GetFlags().ClassInfoInterfacesOnly() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
"Can't set CLASSINFO_INTERFACES_ONLY on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().AllowPropModsDuringResolve() &&
!sciProto.GetFlags().AllowPropModsDuringResolve() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
!sciProto.GetFlags().AllowPropModsDuringResolve() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
"Can't set ALLOW_PROP_MODS_DURING_RESOLVE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().AllowPropModsToPrototype() &&
!sciProto.GetFlags().AllowPropModsToPrototype() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
!sciProto.GetFlags().AllowPropModsToPrototype() &&
sciProto.GetCallback() &&
!sciProto.GetFlags().DontSharePrototype()),
"Can't set ALLOW_PROP_MODS_TO_PROTOTYPE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
NS_ASSERTION(!(sciWrapper.GetFlags().DontSharePrototype() &&
!sciProto.GetFlags().DontSharePrototype() &&
sciProto.GetCallback()),
!sciProto.GetFlags().DontSharePrototype() &&
sciProto.GetCallback()),
"Can't set DONT_SHARE_PROTOTYPE on an instance scriptable "
"without also setting it on the class scriptable (if present and shared)");
@ -1221,7 +1218,7 @@ XPCWrappedNative::FinishInit(XPCCallContext &ccx)
if(HasProto() && GetProto()->ClassIsMainThreadOnly() && !NS_IsMainThread())
{
DEBUG_ReportWrapperThreadSafetyError(ccx,
"MainThread only wrapper created on the wrong thread", this);
"MainThread only wrapper created on the wrong thread", this);
return JS_FALSE;
}
#endif
@ -1573,11 +1570,10 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
// this stuff. So, if these don't match then the caller is
// doing something bad here.
NS_ASSERTION(
oldProto->GetScriptableInfo()->GetScriptableShared() ==
newProto->GetScriptableInfo()->GetScriptableShared(),
"Changing proto is also changing JSObject Classname or "
"helper's nsIXPScriptable flags. This is not allowed!");
NS_ASSERTION(oldProto->GetScriptableInfo()->GetScriptableShared() ==
newProto->GetScriptableInfo()->GetScriptableShared(),
"Changing proto is also changing JSObject Classname or "
"helper's nsIXPScriptable flags. This is not allowed!");
wrapper->mScriptableInfo = newProto->GetScriptableInfo();
}
@ -1844,20 +1840,18 @@ XPCWrappedNative::ExtendSet(XPCCallContext& ccx, XPCNativeInterface* aInterface)
XPCWrappedNativeTearOff*
XPCWrappedNative::LocateTearOff(XPCCallContext& ccx,
XPCNativeInterface* aInterface)
XPCNativeInterface* aInterface)
{
XPCAutoLock al(GetLock()); // hold the lock throughout
for(
XPCWrappedNativeTearOffChunk* chunk = &mFirstChunk;
for(XPCWrappedNativeTearOffChunk* chunk = &mFirstChunk;
chunk != nsnull;
chunk = chunk->mNextChunk)
{
XPCWrappedNativeTearOff* tearOff = chunk->mTearOffs;
XPCWrappedNativeTearOff* const end = tearOff +
XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK;
for(
tearOff = chunk->mTearOffs;
for(tearOff = chunk->mTearOffs;
tearOff < end;
tearOff++)
{
@ -1891,8 +1885,7 @@ XPCWrappedNative::FindTearOff(XPCCallContext& ccx,
to = chunk->mTearOffs;
XPCWrappedNativeTearOff* const end = chunk->mTearOffs +
XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK;
for(
to = chunk->mTearOffs;
for(to = chunk->mTearOffs;
to < end;
to++)
{
@ -2055,7 +2048,7 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
proto = jso->getProto();
NS_ASSERTION(proto && proto != our_proto,
"!!! xpconnect/xbl check - wrapper has no special proto");
"!!! xpconnect/xbl check - wrapper has no special proto");
bool found_our_proto = false;
while(proto && !found_our_proto) {
@ -2065,7 +2058,7 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
}
NS_ASSERTION(found_our_proto,
"!!! xpconnect/xbl check - wrapper has extra proto");
"!!! xpconnect/xbl check - wrapper has extra proto");
}
else
{
@ -2107,11 +2100,10 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx,
}
nsIXPCSecurityManager* sm;
sm = ccx.GetXPCContext()->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_CREATE_WRAPPER);
sm = ccx.GetXPCContext()->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_CREATE_WRAPPER);
if(sm && NS_FAILED(sm->
CanCreateWrapper(ccx, *iid, identity,
GetClassInfo(), GetSecurityInfoAddr())))
CanCreateWrapper(ccx, *iid, identity,
GetClassInfo(), GetSecurityInfoAddr())))
{
// the security manager vetoed. It should have set an exception.
NS_RELEASE(obj);
@ -3837,16 +3829,16 @@ void DEBUG_CheckWrapperThreadSafety(const XPCWrappedNative* wrapper)
{
XPCCallContext ccx(NATIVE_CALLER);
DEBUG_ReportWrapperThreadSafetyError(ccx,
"Main Thread Only wrapper accessed on another thread", wrapper);
"Main Thread Only wrapper accessed on another thread", wrapper);
}
}
else if(PR_GetCurrentThread() != wrapper->mThread)
{
XPCCallContext ccx(NATIVE_CALLER);
DEBUG_ReportWrapperThreadSafetyError(ccx,
"XPConnect WrappedNative is being accessed on multiple threads but "
"the underlying native xpcom object does not have a "
"nsIClassInfo with the 'THREADSAFE' flag set", wrapper);
"XPConnect WrappedNative is being accessed on multiple threads but "
"the underlying native xpcom object does not have a "
"nsIClassInfo with the 'THREADSAFE' flag set", wrapper);
}
}
#endif

Просмотреть файл

@ -229,8 +229,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
nsIXPCSecurityManager* sm;
XPCContext* xpcc = ccx.GetXPCContext();
sm = xpcc->GetAppropriateSecurityManager(
nsIXPCSecurityManager::HOOK_GET_PROPERTY);
sm = xpcc->GetAppropriateSecurityManager(nsIXPCSecurityManager::HOOK_GET_PROPERTY);
if(sm)
{
AutoMarkingNativeInterfacePtr iface(ccx);
@ -244,12 +243,12 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
ccx.SetCallInfo(iface, iface->GetMemberAt(1), JS_FALSE);
if(NS_FAILED(sm->
CanAccess(nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
&ccx, ccx,
ccx.GetFlattenedJSObject(),
wrapper->GetIdentityObject(),
wrapper->GetClassInfo(), id,
wrapper->GetSecurityInfoAddr())))
CanAccess(nsIXPCSecurityManager::ACCESS_GET_PROPERTY,
&ccx, ccx,
ccx.GetFlattenedJSObject(),
wrapper->GetIdentityObject(),
wrapper->GetClassInfo(), id,
wrapper->GetSecurityInfoAddr())))
{
// The SecurityManager should have set an exception.
return JS_FALSE;
@ -355,7 +354,7 @@ DefinePropertyIfFound(XPCCallContext& ccx,
name.encode(ccx, JSID_TO_STRING(id)) &&
(iface2 = XPCNativeInterface::GetNewOrUsed(ccx, name.ptr()), iface2) &&
nsnull != (to = wrapperToReflectInterfaceNames->
FindTearOff(ccx, iface2, JS_TRUE, &rv)) &&
FindTearOff(ccx, iface2, JS_TRUE, &rv)) &&
nsnull != (jso = to->GetJSObject()))
{
@ -1170,7 +1169,7 @@ XPC_WN_Helper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
oldResolvingWrapper = ccx.SetResolvingWrapper(wrapper);
rv = si->GetCallback()->NewResolve(wrapper, cx, obj, id, flags,
&obj2FromScriptable, &retval);
&obj2FromScriptable, &retval);
if(allowPropMods)
(void)ccx.SetResolvingWrapper(oldResolvingWrapper);
@ -1684,12 +1683,11 @@ XPC_WN_GetterSetter(JSContext *cx, uintN argc, jsval *vp)
static JSBool
XPC_WN_Shared_Proto_Enumerate(JSContext *cx, JSObject *obj)
{
NS_ASSERTION(
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_NoMods_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);
if(!self)
@ -1749,10 +1747,9 @@ XPC_WN_Shared_Proto_Trace(JSTracer *trc, JSObject *obj)
static JSBool
XPC_WN_ModsAllowed_Proto_Resolve(JSContext *cx, JSObject *obj, jsid id)
{
NS_ASSERTION(
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass,
"bad proto");
NS_ASSERTION(js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_WithCall_Proto_JSClass ||
js::GetObjectClass(obj) == &XPC_WN_ModsAllowed_NoCall_Proto_JSClass,
"bad proto");
XPCWrappedNativeProto* self =
(XPCWrappedNativeProto*) xpc_GetJSPrivate(obj);

Просмотреть файл

@ -88,10 +88,9 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
}
JSBool
XPCWrappedNativeProto::Init(
XPCCallContext& ccx,
JSBool isGlobal,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo)
XPCWrappedNativeProto::Init(XPCCallContext& ccx,
JSBool isGlobal,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo)
{
nsIXPCScriptable *callback = scriptableCreateInfo ?
scriptableCreateInfo->GetCallback() :

Просмотреть файл

@ -557,12 +557,9 @@ XPCWrappedNativeScope::ASSERT_NoInterfaceSetsAreMarked()
{
for(XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext)
{
cur->mWrappedNativeMap->Enumerate(
ASSERT_WrappedNativeSetNotMarked, nsnull);
cur->mWrappedNativeProtoMap->Enumerate(
ASSERT_WrappedNativeProtoSetNotMarked, nsnull);
cur->mMainThreadWrappedNativeProtoMap->Enumerate(
ASSERT_WrappedNativeProtoSetNotMarked, nsnull);
cur->mWrappedNativeMap->Enumerate(ASSERT_WrappedNativeSetNotMarked, nsnull);
cur->mWrappedNativeProtoMap->Enumerate(ASSERT_WrappedNativeProtoSetNotMarked, nsnull);
cur->mMainThreadWrappedNativeProtoMap->Enumerate(ASSERT_WrappedNativeProtoSetNotMarked, nsnull);
}
}
#endif
@ -869,7 +866,7 @@ WNProtoSecPolicyClearer(JSDHashTable *table, JSDHashEntryHdr *hdr,
static JSDHashOperator
WNSecPolicyClearer(JSDHashTable *table, JSDHashEntryHdr *hdr,
uint32 number, void *arg)
uint32 number, void *arg)
{
XPCWrappedNative* wrapper = ((Native2WrappedNativeMap::Entry*)hdr)->value;
if(wrapper->HasProto() && !wrapper->HasSharedProto())
@ -916,9 +913,9 @@ XPCWrappedNativeScope::RemoveWrappedNativeProtos()
XPCAutoLock al(mRuntime->GetMapLock());
mWrappedNativeProtoMap->Enumerate(WNProtoRemover,
GetRuntime()->GetDetachedWrappedNativeProtoMap());
GetRuntime()->GetDetachedWrappedNativeProtoMap());
mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoRemover,
GetRuntime()->GetDetachedWrappedNativeProtoMap());
GetRuntime()->GetDetachedWrappedNativeProtoMap());
}
static PLDHashOperator
@ -995,8 +992,8 @@ XPCWrappedNativeScope::DebugDump(PRInt16 depth)
XPC_LOG_ALWAYS(("mPrototypeNoHelper @ %x", mPrototypeNoHelper));
XPC_LOG_ALWAYS(("mWrappedNativeMap @ %x with %d wrappers(s)", \
mWrappedNativeMap, \
mWrappedNativeMap ? mWrappedNativeMap->Count() : 0));
mWrappedNativeMap, \
mWrappedNativeMap ? mWrappedNativeMap->Count() : 0));
// iterate contexts...
if(depth && mWrappedNativeMap && mWrappedNativeMap->Count())
{
@ -1006,8 +1003,8 @@ XPCWrappedNativeScope::DebugDump(PRInt16 depth)
}
XPC_LOG_ALWAYS(("mWrappedNativeProtoMap @ %x with %d protos(s)", \
mWrappedNativeProtoMap, \
mWrappedNativeProtoMap ? mWrappedNativeProtoMap->Count() : 0));
mWrappedNativeProtoMap, \
mWrappedNativeProtoMap ? mWrappedNativeProtoMap->Count() : 0));
// iterate contexts...
if(depth && mWrappedNativeProtoMap && mWrappedNativeProtoMap->Count())
{
@ -1017,8 +1014,8 @@ XPCWrappedNativeScope::DebugDump(PRInt16 depth)
}
XPC_LOG_ALWAYS(("mMainThreadWrappedNativeProtoMap @ %x with %d protos(s)", \
mMainThreadWrappedNativeProtoMap, \
mMainThreadWrappedNativeProtoMap ? mMainThreadWrappedNativeProtoMap->Count() : 0));
mMainThreadWrappedNativeProtoMap, \
mMainThreadWrappedNativeProtoMap ? mMainThreadWrappedNativeProtoMap->Count() : 0));
// iterate contexts...
if(depth && mMainThreadWrappedNativeProtoMap && mMainThreadWrappedNativeProtoMap->Count())
{

Просмотреть файл

@ -285,17 +285,17 @@ nsXPConnect::IsISupportsDescendant(nsIInterfaceInfo* info)
/***************************************************************************/
typedef bool (*InfoTester)(nsIInterfaceInfoManager* manager, const void* data,
nsIInterfaceInfo** info);
nsIInterfaceInfo** info);
static bool IIDTester(nsIInterfaceInfoManager* manager, const void* data,
nsIInterfaceInfo** info)
nsIInterfaceInfo** info)
{
return NS_SUCCEEDED(manager->GetInfoForIID((const nsIID *) data, info)) &&
*info;
}
static bool NameTester(nsIInterfaceInfoManager* manager, const void* data,
nsIInterfaceInfo** info)
nsIInterfaceInfo** info)
{
return NS_SUCCEEDED(manager->GetInfoForName((const char *) data, info)) &&
*info;
@ -702,8 +702,7 @@ NoteJSChild(JSTracer *trc, void *thing, JSGCTraceKind kind)
tracer->debugPrintIndex);
tracer->cb.NoteNextEdgeName(buffer);
} else {
tracer->cb.NoteNextEdgeName(
static_cast<const char*>(tracer->debugPrintArg));
tracer->cb.NoteNextEdgeName(static_cast<const char*>(tracer->debugPrintArg));
}
}
#endif
@ -2257,7 +2256,7 @@ nsXPConnect::ReleaseJSContext(JSContext * aJSContext, bool noGC)
NS_ASSERTION(!tls->GetJSContextStack() ||
!tls->GetJSContextStack()->
DEBUG_StackHasJSContext(aJSContext),
DEBUG_StackHasJSContext(aJSContext),
"JSContext still in threadjscontextstack!");
}
@ -2315,28 +2314,28 @@ nsXPConnect::DebugDumpObject(nsISupports *p, PRInt16 depth)
nsIXPConnectWrappedJS* wjs;
if(NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPConnect),
(void**)&xpc)))
(void**)&xpc)))
{
XPC_LOG_ALWAYS(("Dumping a nsIXPConnect..."));
xpc->DebugDump(depth);
NS_RELEASE(xpc);
}
else if(NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPCWrappedJSClass),
(void**)&wjsc)))
(void**)&wjsc)))
{
XPC_LOG_ALWAYS(("Dumping a nsIXPCWrappedJSClass..."));
wjsc->DebugDump(depth);
NS_RELEASE(wjsc);
}
else if(NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPConnectWrappedNative),
(void**)&wn)))
(void**)&wn)))
{
XPC_LOG_ALWAYS(("Dumping a nsIXPConnectWrappedNative..."));
wn->DebugDump(depth);
NS_RELEASE(wn);
}
else if(NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPConnectWrappedJS),
(void**)&wjs)))
(void**)&wjs)))
{
XPC_LOG_ALWAYS(("Dumping a nsIXPConnectWrappedJS..."));
wjs->DebugDump(depth);

Просмотреть файл

@ -312,7 +312,7 @@ typedef nsDataHashtable<xpc::PtrAndPrincipalHashKey, JSCompartment *> XPCCompart
char* result; \
if(src) \
result = (char*) nsMemory::Clone(src, \
sizeof(char)*(strlen(src)+1)); \
sizeof(char)*(strlen(src)+1)); \
else \
result = nsnull; \
*dest = result; \
@ -2730,9 +2730,8 @@ public:
char* ToString(XPCCallContext& ccx,
XPCWrappedNativeTearOff* to = nsnull) const;
static void GatherProtoScriptableCreateInfo(
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto);
static void GatherProtoScriptableCreateInfo(nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto);
JSBool HasExternalReference() const {return mRefCnt > 1;}
@ -2822,14 +2821,13 @@ private:
JSBool needJSObject);
JSBool InitTearOffJSObject(XPCCallContext& ccx,
XPCWrappedNativeTearOff* to);
XPCWrappedNativeTearOff* to);
public:
static const XPCNativeScriptableCreateInfo& GatherScriptableCreateInfo(
nsISupports* obj,
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto,
XPCNativeScriptableCreateInfo& sciWrapper);
static const XPCNativeScriptableCreateInfo& GatherScriptableCreateInfo(nsISupports* obj,
nsIClassInfo* classInfo,
XPCNativeScriptableCreateInfo& sciProto,
XPCNativeScriptableCreateInfo& sciWrapper);
private:
union