author | Bobby Holley <bobbyholley@gmail.com> |
Fri, 14 Oct 2011 10:52:48 -0700 | |
changeset 78741 | 0b91a5164a64bdfe59ba94c8aa183d2d38ecee67 |
parent 78740 | ac22bf1a3e238428d70ede09ca6fd31f179884ec |
child 78742 | 0a2a7c748da6a979a262067d5ae4684db82b7c52 |
push id | 21330 |
push user | bobbyholley@gmail.com |
push date | Fri, 14 Oct 2011 17:56:10 +0000 |
treeherder | mozilla-central@921f44191dcb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 688012 |
milestone | 10.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -153,20 +153,20 @@ mozJSLoaderErrorReporter(JSContext *cx, * various arguments to it. */ nsAutoString fileUni; fileUni.AssignWithConversion(rep->filename); 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)) { rv = consoleService->LogMessage(errorObject); if (NS_SUCCEEDED(rv)) { // We're done! Skip return to fall thru to stderr // printout, for the benefit of those invoking the // browser with -console @@ -773,17 +773,17 @@ mozJSComponentLoader::GlobalForLocation( JS_SetGlobalObject(cx, nsnull); nsCOMPtr<nsIXPConnectJSObjectHolder> holder; rv = xpc->InitClassesWithNewWrappedGlobal(cx, backstagePass, NS_GET_IID(nsISupports), mSystemPrincipal, nsnull, nsIXPConnect:: - FLAG_SYSTEM_GLOBAL_OBJECT, + FLAG_SYSTEM_GLOBAL_OBJECT, getter_AddRefs(holder)); NS_ENSURE_SUCCESS(rv, rv); JSObject *global; rv = holder->GetJSObject(&global); NS_ENSURE_SUCCESS(rv, rv); JSAutoEnterCompartment ac; @@ -864,17 +864,17 @@ mozJSComponentLoader::GlobalForLocation( // The script wasn't in the cache , so compile it now. LOG(("Slow loading %s\n", nativePath.get())); // If |exception| is non-null, then our caller wants us to propagate // any exceptions out to our caller. Ensure that the engine doesn't // 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 PRInt64 fileSize; rv = aComponentFile->GetFileSize(&fileSize); if (NS_FAILED(rv)) { JS_SetOptions(cx, oldopts); return rv; @@ -914,19 +914,18 @@ mozJSComponentLoader::GlobalForLocation( char *buf = static_cast<char*>(PR_MemMap(map, 0, fileSize32)); if (!buf) { NS_WARNING("Failed to map file"); JS_SetOptions(cx, oldopts); 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); #else /* HAVE_PR_MEMMAP */ /** * No memmap implementation, so fall back to using * JS_CompileFileHandleForPrincipals(). @@ -934,18 +933,17 @@ mozJSComponentLoader::GlobalForLocation( FILE *fileHandle; rv = aComponentFile->OpenANSIFileDesc("r", &fileHandle); if (NS_FAILED(rv)) { JS_SetOptions(cx, oldopts); 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 */ } else { nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIChannel> scriptChannel; @@ -970,19 +968,18 @@ mozJSComponentLoader::GlobalForLocation( /* read the file in one swoop */ rv = scriptStream->Read(buf, len, &bytesRead); if (bytesRead != len) return NS_BASE_STREAM_OSERROR; 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. JS_SetOptions(cx, oldopts); if (!script && exception) { JS_GetPendingException(cx, exception); JS_ClearPendingException(cx); } @@ -1341,17 +1338,17 @@ mozJSComponentLoader::ImportInto(const n logBuffer.AssignLiteral("Installing symbols [ "); } JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId)); if (!!bytes) logBuffer.Append(bytes.ptr()); logBuffer.AppendLiteral(" "); if (i == symbolCount - 1) { LOG(("%s] from %s\n", logBuffer.get(), - PromiseFlatCString(aLocation).get())); + PromiseFlatCString(aLocation).get())); } #endif } } // Cache this module for later if (newEntry) { if (!mImports.Put(key, newEntry))
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -150,19 +150,18 @@ mozJSSubScriptLoader::ReadScript(nsIURI } /* set our own error reporter so we can report any bad things as catchable * exceptions, including the source/line number */ er = JS_SetErrorReporter(cx, mozJSLoaderErrorReporter); 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); return ReportError(cx, LOAD_ERROR_BADCHARSET); } *scriptp = JS_CompileUCScriptForPrincipals(cx, target_obj, jsPrincipals,
--- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -1939,17 +1939,17 @@ main(int argc, char **argv, char **envp) } nsCOMPtr<nsIXPConnectJSObjectHolder> holder; rv = xpc->InitClassesWithNewWrappedGlobal(cx, backstagePass, NS_GET_IID(nsISupports), systemprincipal, nsnull, nsIXPConnect:: - FLAG_SYSTEM_GLOBAL_OBJECT, + FLAG_SYSTEM_GLOBAL_OBJECT, getter_AddRefs(holder)); if (NS_FAILED(rv)) return 1; rv = holder->GetJSObject(&glob); if (NS_FAILED(rv)) { NS_ASSERTION(glob == nsnull, "bad GetJSObject?"); return 1;
--- a/js/xpconnect/src/XPCCallContext.cpp +++ b/js/xpconnect/src/XPCCallContext.cpp @@ -227,18 +227,18 @@ XPCCallContext::SetName(jsid name) } else { mSet = mWrapper ? mWrapper->GetSet() : nsnull; if(mSet && mSet->FindMember(name, &mMember, &mInterface, mWrapper->HasProto() ? - mWrapper->GetProto()->GetSet() : - nsnull, + mWrapper->GetProto()->GetSet() : + nsnull, &mStaticMemberIsLocal)) { if(mMember && !mMember->IsConstant()) mMethodIndex = mMember->GetIndex(); } else { mMember = nsnull; @@ -382,17 +382,17 @@ XPCCallContext::~XPCCallContext() if(mDestroyJSContextInDestructor) { #ifdef DEBUG_xpc_hacker printf("!xpc - doing deferred destruction of JSContext @ %p\n", mJSContext); #endif NS_ASSERTION(!mThreadData->GetJSContextStack() || !mThreadData->GetJSContextStack()-> - DEBUG_StackHasJSContext(mJSContext), + DEBUG_StackHasJSContext(mJSContext), "JSContext still in threadjscontextstack!"); JS_DestroyContext(mJSContext); } } #ifdef DEBUG for(PRUint32 i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i)
--- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -72,17 +72,17 @@ JSValIsInterfaceOfType(JSContext *cx, js { nsCOMPtr<nsIXPConnect> xpc; nsCOMPtr<nsIXPConnectWrappedNative> wn; nsCOMPtr<nsISupports> sup; nsISupports* iface; 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); return JS_TRUE; } return JS_FALSE; } @@ -143,17 +143,17 @@ nsXPCComponents_Interfaces::GetInterface *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_Interfaces) PUSH_IID(nsIXPCScriptable) PUSH_IID(nsISecurityCheckedComponent) #undef PUSH_IID @@ -165,17 +165,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_Interfaces::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_Interfaces::GetContractID(char * *aContractID) @@ -198,18 +198,17 @@ NS_IMETHODIMP nsXPCComponents_Interfaces::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_Interfaces::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_Interfaces::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_Interfaces::GetFlags(PRUint32 *aFlags) @@ -458,17 +457,17 @@ nsXPCComponents_InterfacesByID::GetInter *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_InterfacesByID) PUSH_IID(nsIXPCScriptable) PUSH_IID(nsISecurityCheckedComponent) #undef PUSH_IID @@ -480,17 +479,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_InterfacesByID::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_InterfacesByID::GetContractID(char * *aContractID) @@ -513,18 +512,17 @@ NS_IMETHODIMP nsXPCComponents_InterfacesByID::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_InterfacesByID::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_InterfacesByID::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_InterfacesByID::GetFlags(PRUint32 *aFlags) @@ -779,17 +777,17 @@ nsXPCComponents_Classes::GetInterfaces(P *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_Classes) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -800,17 +798,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_Classes::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_Classes::GetContractID(char * *aContractID) @@ -833,18 +831,17 @@ NS_IMETHODIMP nsXPCComponents_Classes::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_Classes::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_Classes::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_Classes::GetFlags(PRUint32 *aFlags) @@ -1031,17 +1028,17 @@ nsXPCComponents_ClassesByID::GetInterfac *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_ClassesByID) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -1052,17 +1049,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_ClassesByID::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_ClassesByID::GetContractID(char * *aContractID) @@ -1085,18 +1082,17 @@ NS_IMETHODIMP nsXPCComponents_ClassesByID::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_ClassesByID::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_ClassesByID::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_ClassesByID::GetFlags(PRUint32 *aFlags) @@ -1302,17 +1298,17 @@ nsXPCComponents_Results::GetInterfaces(P *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_Results) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -1323,17 +1319,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_Results::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_Results::GetContractID(char * *aContractID) @@ -1356,18 +1352,17 @@ NS_IMETHODIMP nsXPCComponents_Results::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_Results::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_Results::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_Results::GetFlags(PRUint32 *aFlags) @@ -1531,17 +1526,17 @@ nsXPCComponents_ID::GetInterfaces(PRUint *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_ID) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -1552,17 +1547,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_ID::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_ID::GetContractID(char * *aContractID) @@ -1585,18 +1580,17 @@ NS_IMETHODIMP nsXPCComponents_ID::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_ID::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_ID::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_ID::GetFlags(PRUint32 *aFlags) @@ -1672,18 +1666,17 @@ nsXPCComponents_ID::CallOrConstruct(nsIX if(!ccx.IsValid()) return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); XPCContext* xpcc = ccx.GetXPCContext(); // 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. *_retval = JS_FALSE; return NS_OK; } // convert the first argument into a string and see if it looks like an id @@ -1759,17 +1752,17 @@ nsXPCComponents_Exception::GetInterfaces *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_Exception) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -1780,17 +1773,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_Exception::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_Exception::GetContractID(char * *aContractID) @@ -1813,18 +1806,17 @@ NS_IMETHODIMP nsXPCComponents_Exception::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_Exception::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_Exception::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_Exception::GetFlags(PRUint32 *aFlags) @@ -1896,18 +1888,17 @@ nsXPCComponents_Exception::CallOrConstru return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); nsXPConnect* xpc = ccx.GetXPConnect(); XPCContext* xpcc = ccx.GetXPCContext(); // 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. *_retval = JS_FALSE; return NS_OK; } // initialization params for the exception object we will create @@ -1969,17 +1960,17 @@ nsXPCComponents_Exception::CallOrConstru nsXPCException::NewException(eMsg, eResult, eStack, eData, getter_AddRefs(e)); if(!e) return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); nsCOMPtr<nsIXPConnectJSObjectHolder> holder; 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); } if(vp) *vp = OBJECT_TO_JSVAL(newObj); @@ -2054,17 +2045,17 @@ nsXPCConstructor::GetInterfaces(PRUint32 *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCConstructor) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -2075,17 +2066,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCConstructor::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCConstructor::GetContractID(char * *aContractID) @@ -2108,18 +2099,17 @@ NS_IMETHODIMP nsXPCConstructor::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCConstructor::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCConstructor::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCConstructor::GetFlags(PRUint32 *aFlags) @@ -2228,20 +2218,20 @@ nsXPCConstructor::CallOrConstruct(nsIXPC // code which is reflected into JS which will do that for us later. nsCOMPtr<nsIXPConnectJSObjectHolder> cidHolder; nsCOMPtr<nsIXPConnectJSObjectHolder> iidHolder; JSObject* cidObj; 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); } jsval ctorArgs[1] = {OBJECT_TO_JSVAL(iidObj)}; jsval val; @@ -2320,17 +2310,17 @@ nsXPCComponents_Constructor::GetInterfac *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents_Constructor) PUSH_IID(nsIXPCScriptable) #undef PUSH_IID @@ -2341,17 +2331,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP nsXPCComponents_Constructor::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP nsXPCComponents_Constructor::GetContractID(char * *aContractID) @@ -2374,18 +2364,17 @@ NS_IMETHODIMP nsXPCComponents_Constructor::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents_Constructor::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents_Constructor::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents_Constructor::GetFlags(PRUint32 *aFlags) @@ -2469,18 +2458,17 @@ nsXPCComponents_Constructor::CallOrConst nsXPCComponents* comp; if(!xpc || !xpcc || !scope || !(comp = scope->GetComponents())) return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); // 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. *_retval = JS_FALSE; return NS_OK; } // initialization params for the Constructor object we will create @@ -2525,32 +2513,31 @@ nsXPCComponents_Constructor::CallOrConst return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); jsval val; if(!JS_GetPropertyById(cx, ifacesObj, id, &val) || JSVAL_IS_PRIMITIVE(val)) return ThrowAndFail(NS_ERROR_XPC_BAD_IID, cx, _retval); 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); } } else { nsCOMPtr<nsIInterfaceInfo> info; xpc->GetInfoForIID(&NS_GET_IID(nsISupports), getter_AddRefs(info)); 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); } // a new scope to avoid warnings about shadowed names { // argv[0] is a contractid name string @@ -2579,34 +2566,34 @@ nsXPCComponents_Constructor::CallOrConst return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); jsval val; if(!JS_GetPropertyById(cx, classesObj, id, &val) || JSVAL_IS_PRIMITIVE(val)) return ThrowAndFail(NS_ERROR_XPC_BAD_CID, cx, _retval); 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); } } nsCOMPtr<nsIXPCConstructor> ctor = static_cast<nsIXPCConstructor*> (new nsXPCConstructor(cClassID, cInterfaceID, cInitializer)); if(!ctor) return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); nsCOMPtr<nsIXPConnectJSObjectHolder> holder2; 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); } if(vp) *vp = OBJECT_TO_JSVAL(newObj); @@ -2714,18 +2701,18 @@ nsXPCComponents_Utils::LookupMethod() // Check disabled until deprecated Components.lookupMethod removed. #undef CHECK_FOR_INDIRECT_CALL #ifdef CHECK_FOR_INDIRECT_CALL // verify that we are being called from JS (i.e. the current call is // to this object - though we don't verify that it is to this exact method) 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 // Get JSContext of current call JSContext* cx; rv = cc->GetJSContext(&cx); if(NS_FAILED(rv) || !cx) return NS_ERROR_FAILURE; @@ -2829,21 +2816,19 @@ nsXPCComponents_Utils::LookupMethod() /* void reportError (); */ NS_IMETHODIMP nsXPCComponents_Utils::ReportError() { // This function shall never fail! Silently eat any failure conditions. nsresult rv; - nsCOMPtr<nsIConsoleService> console( - do_GetService(NS_CONSOLESERVICE_CONTRACTID)); - - nsCOMPtr<nsIScriptError2> scripterr( - do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); + nsCOMPtr<nsIConsoleService> console(do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + + nsCOMPtr<nsIScriptError2> scripterr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID())); if(!scripterr || !console || !xpc) return NS_OK; // get the xpconnect native call context nsAXPCNativeCallContext *cc = nsnull; xpc->GetCurrentNativeCallContext(&cc); @@ -2853,18 +2838,18 @@ nsXPCComponents_Utils::ReportError() // Check disabled until deprecated Components.reportError removed. #undef CHECK_FOR_INDIRECT_CALL #ifdef CHECK_FOR_INDIRECT_CALL // verify that we are being called from JS (i.e. the current call is // to this object - though we don't verify that it is to this exact method) 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; } #endif // Get JSContext of current call JSContext* cx; rv = cc->GetJSContext(&cx); @@ -2894,20 +2879,20 @@ nsXPCComponents_Utils::ReportError() { // It's a proper JS Error nsAutoString fileUni; CopyUTF8toUTF16(err->filename, fileUni); 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, "XPConnect JavaScript", innerWindowID); if(NS_FAILED(rv)) return NS_OK; nsCOMPtr<nsIScriptError> logError = do_QueryInterface(scripterr); @@ -3324,17 +3309,17 @@ nsXPCComponents_utils_Sandbox::CallOrCon if (NS_FAILED(rv)) { return ThrowAndFail(rv, cx, _retval); } nsCOMPtr<nsIScriptSecurityManager> secman = 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; return ThrowAndFail(rv, cx, _retval); } prinOrSop = principal; } else { @@ -3644,17 +3629,17 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec if (jsVersion != JSVERSION_DEFAULT) JS_SetVersion(sandcx->GetJSContext(), jsVersion); XPCPerThreadData *data = XPCPerThreadData::GetData(cx); XPCJSContextStack *stack = nsnull; 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; } } if (!filename) { // Default the filename to the codebase. filename = jsPrincipals->codebase; @@ -3675,17 +3660,17 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec } return NS_ERROR_FAILURE; } JSBool ok = 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))) { ok = !!(str = JS_ValueToString(sandcx->GetJSContext(), v)); } if (!ok) { // The sandbox threw an exception, convert it to a string (if @@ -4099,17 +4084,17 @@ nsXPCComponents::GetInterfaces(PRUint32 *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCComponents) PUSH_IID(nsIXPCScriptable) PUSH_IID(nsISecurityCheckedComponent) #undef PUSH_IID @@ -4154,18 +4139,17 @@ NS_IMETHODIMP nsXPCComponents::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -nsXPCComponents::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +nsXPCComponents::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP nsXPCComponents::GetFlags(PRUint32 *aFlags)
--- a/js/xpconnect/src/XPCContext.cpp +++ b/js/xpconnect/src/XPCContext.cpp @@ -100,14 +100,14 @@ XPCContext::DebugDump(PRInt16 depth) XPC_LOG_ALWAYS(("mException @ %x", mException)); if(depth && mException) { // XXX show the exception here... } 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 }
--- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -270,17 +270,17 @@ XPCConvert::NativeData2JS(XPCLazyCallCon case nsXPTType::T_U64 : *d = DOUBLE_TO_JSVAL(UINT64_TO_DOUBLE(*((uint64*)s))); break; case nsXPTType::T_FLOAT : *d = DOUBLE_TO_JSVAL(*((float*)s)); break; case nsXPTType::T_DOUBLE: *d = DOUBLE_TO_JSVAL(*((double*)s)); break; case nsXPTType::T_BOOL : { 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; } case nsXPTType::T_CHAR : { char* p = (char*)s; if(!p) return JS_FALSE; @@ -449,19 +449,19 @@ XPCConvert::NativeData2JS(XPCLazyCallCon if(!unicodeString) return JS_FALSE; if(sXPCOMUCStringFinalizerIndex == -1 && !AddXPCOMUCStringFinalizer()) return JS_FALSE; JSString* jsString = JS_NewExternalString(cx, - (jschar*)unicodeString, - cString->Length(), - sXPCOMUCStringFinalizerIndex); + (jschar*)unicodeString, + cString->Length(), + sXPCOMUCStringFinalizerIndex); if(!jsString) { nsMemory::Free(unicodeString); return JS_FALSE; } *d = STRING_TO_JSVAL(jsString); @@ -1045,17 +1045,17 @@ XPCConvert::JSData2Native(XPCCallContext const PRUnichar* chars = JS_GetStringCharsZ(cx, str); if (!chars) { if (pErr) *pErr = NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF; return JS_FALSE; } 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; return atom != nsnull; } //else ... if(JSVAL_IS_VOID(s) || JSVAL_IS_NULL(s)) @@ -1602,17 +1602,17 @@ XPCConvert::JSValToXPCException(XPCCallC { NS_ERROR("when is an object not an object?"); return NS_ERROR_FAILURE; } // 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); if(iface) { // just pass through the exception (with extra ref and all) nsIException* temp = iface; NS_ADDREF(temp); @@ -1732,21 +1732,20 @@ XPCConvert::JSValToXPCException(XPCCallC nsnull, exceptn, cx, &s); else { // XXX all this nsISupportsDouble code seems a little redundant // now that we're storing the jsval in the exception... 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, ifaceName, methodName, data, exceptn, cx, &s); NS_RELEASE(data); return rv; } }
--- a/js/xpconnect/src/XPCDebug.cpp +++ b/js/xpconnect/src/XPCDebug.cpp @@ -174,20 +174,20 @@ static char* FormatJSFrame(JSContext* cx char number[8]; JS_snprintf(number, 8, "%d", (int) k); if(JS_GetProperty(cx, argsObj, number, &val)) { 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; } } } } } // print filename and line number
--- a/js/xpconnect/src/XPCException.cpp +++ b/js/xpconnect/src/XPCException.cpp @@ -313,24 +313,24 @@ nsXPCException::Initialize(const char *a if(mInitialized) return NS_ERROR_ALREADY_INITIALIZED; Reset(); 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; } mResult = aResult; if(aLocation) { mLocation = aLocation;
--- a/js/xpconnect/src/XPCInlines.h +++ b/js/xpconnect/src/XPCInlines.h @@ -474,18 +474,18 @@ XPCNativeSet::FindMember(jsid name, *pMember = Member; *pInterface = Interface; *pIsLocal = !Member || !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; } inline XPCNativeInterface* XPCNativeSet::FindNamedInterface(jsid name) const { XPCNativeInterface* const * pp = mInterfaces;
--- a/js/xpconnect/src/XPCJSID.cpp +++ b/js/xpconnect/src/XPCJSID.cpp @@ -759,18 +759,17 @@ nsJSCID::CreateInstance(nsISupports **_r ccxp->GetCalleeWrapper(getter_AddRefs(wrapper)); wrapper->GetJSObject(&obj); // Do the security check if necessary 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?"); return NS_OK; } // If an IID was passed in then use it const nsID* iid = GetIIDArg(argc, argv, cx); @@ -827,18 +826,17 @@ nsJSCID::GetService(nsISupports **_retva ccxp->GetCalleeWrapper(getter_AddRefs(wrapper)); wrapper->GetJSObject(&obj); // Do the security check if necessary 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), "security manager vetoed GetService without setting exception"); return NS_OK; } // If an IID was passed in then use it
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -94,17 +94,17 @@ const char* XPCJSRuntime::mStrings[] = { struct JSDyingJSObjectData { JSContext* cx; nsTArray<nsXPCWrappedJS*>* array; }; 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; NS_ASSERTION(wrapper, "found a null JS wrapper!"); // walk the wrapper chain and find any whose JSObject is to be finalized while(wrapper) { @@ -267,18 +267,17 @@ static JSBool CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op) { JS_ASSERT(op == JSCOMPARTMENT_DESTROY); XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance(); 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; if(xpc::PtrAndPrincipalHashKey *key = priv->key) { XPCCompartmentMap &map = self->GetCompartmentMap(); #ifdef DEBUG { @@ -725,19 +724,18 @@ JSBool XPCJSRuntime::GCCallback(JSContex self->mWrappedJSMap-> Enumerate(WrappedJSDyingJSObjectFinder, &data); } // Find dying scopes. 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; } case JSGC_FINALIZE_END: { NS_ASSERTION(self->mDoingFinalization, "bad state"); self->mDoingFinalization = JS_FALSE; @@ -778,17 +776,17 @@ JSBool XPCJSRuntime::GCCallback(JSContex if(threadLock) { // scoped lock MutexAutoLock lock(*threadLock); XPCPerThreadData* iterp = nsnull; XPCPerThreadData* thread; while(nsnull != (thread = - XPCPerThreadData::IterateThreads(&iterp))) + XPCPerThreadData::IterateThreads(&iterp))) { // Mark those AutoMarkingPtr lists! thread->MarkAutoRootsAfterJSFinalize(); XPCCallContext* ccxp = thread->GetCallContext(); while(ccxp) { // Deal with the strictness of callcontext that @@ -875,17 +873,17 @@ JSBool XPCJSRuntime::GCCallback(JSContex { // scoped lock MutexAutoLock lock(*threadLock); XPCPerThreadData* iterp = nsnull; XPCPerThreadData* thread; while(nsnull != (thread = - XPCPerThreadData::IterateThreads(&iterp))) + XPCPerThreadData::IterateThreads(&iterp))) { XPCCallContext* ccxp = thread->GetCallContext(); while(ccxp) { // Deal with the strictness of callcontext that // complains if you ask for a tearoff when // it is in a state where the tearoff could not // possibly be valid. @@ -1471,21 +1469,21 @@ MakeMemoryReporterPath(const nsACString static PRInt64 GetGCChunkTotalBytes() { JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime(); return PRInt64(JS_GetGCParameter(rt, JSGC_TOTAL_CHUNKS)) * js::GC_CHUNK_SIZE; } 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() { JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime(); size_t n = 0; for (size_t i = 0; i < rt->compartments.length(); i++) { if (rt->compartments[i]->isSystemCompartment) { @@ -1511,34 +1509,34 @@ GetJSUserCompartmentCount() // Nb: js-system-compartment-count + js-user-compartment-count could be // different to the number of compartments reported by // XPConnectJSCompartmentsMultiReporter if a garbage collection occurred // between them being consulted. We could move these reporters into // XPConnectJSCompartmentCount to avoid that problem, but then we couldn't // 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 { namespace memory { CompartmentStats::CompartmentStats(JSContext *cx, JSCompartment *c) { memset(this, 0, sizeof(*this)); @@ -1674,221 +1672,221 @@ static void ReportCompartmentStats(const CompartmentStats &stats, const nsACString &pathPrefix, nsIMemoryMultiReporterCallback *callback, nsISupports *closure) { 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 ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name, "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); } void ReportJSRuntimeStats(const IterateData &data, const nsACString &pathPrefix, nsIMemoryMultiReporterCallback *callback, nsISupports *closure) { @@ -1897,52 +1895,52 @@ ReportJSRuntimeStats(const IterateData & index++) { ReportCompartmentStats(data.compartmentStatsVector[index], pathPrefix, callback, closure); } 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 } // namespace xpconnect } // namespace mozilla class XPConnectJSCompartmentsMultiReporter : public nsIMemoryMultiReporter { @@ -1966,51 +1964,50 @@ public: NS_NAMED_LITERAL_CSTRING(pathPrefix, "explicit/js/"); // This is the second step (see above). ReportJSRuntimeStats(data, pathPrefix, callback, closure); 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 DiagnosticMemoryCallback(void *ptr, size_t size) { return CrashReporter::RegisterAppMemory(ptr, size) == NS_OK; } #endif @@ -2271,18 +2268,18 @@ XPCJSRuntime::DebugDump(PRInt16 depth) depth--; XPC_LOG_ALWAYS(("XPCJSRuntime @ %x", this)); XPC_LOG_INDENT(); XPC_LOG_ALWAYS(("mXPConnect @ %x", mXPConnect)); XPC_LOG_ALWAYS(("mJSRuntime @ %x", mJSRuntime)); 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; while(JS_ContextIterator(mJSRuntime, &iter)) ++cxCount; XPC_LOG_ALWAYS(("%d JS context(s)", cxCount)); iter = nsnull; @@ -2290,51 +2287,51 @@ XPCJSRuntime::DebugDump(PRInt16 depth) { XPCContext *xpc = XPCContext::GetXPCContext(iter); XPC_LOG_INDENT(); xpc->DebugDump(depth); XPC_LOG_OUTDENT(); } 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()) { XPC_LOG_INDENT(); mWrappedJSClassMap->Enumerate(WrappedJSClassMapDumpEnumerator, &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()) { XPC_LOG_INDENT(); mWrappedJSMap->Enumerate(WrappedJSMapDumpEnumerator, &depth); XPC_LOG_OUTDENT(); } 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()) { XPC_LOG_INDENT(); mNativeSetMap->Enumerate(NativeSetDumpEnumerator, &depth); XPC_LOG_OUTDENT(); }
--- a/js/xpconnect/src/XPCLog.h +++ b/js/xpconnect/src/XPCLog.h @@ -115,17 +115,17 @@ extern void LogSlimWrapperNotCreated(JSC LogSlimWrapperWillMorph(cx, obj, (const char*)prop, __FUNCTION__); \ PR_END_MACRO #define SLIM_LOG_WILL_MORPH_FOR_ID(cx, obj, id) \ PR_BEGIN_MACRO \ JSString* strId = ::JS_ValueToString(cx, id); \ 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 \ { \ LOG_WILL_MORPH_FOR_PROP(cx, obj, nsnull); \ } \ PR_END_MACRO #define SLIM_LOG_NOT_CREATED(cx, obj, reason) \
--- a/js/xpconnect/src/XPCMaps.cpp +++ b/js/xpconnect/src/XPCMaps.cpp @@ -51,18 +51,18 @@ static JSDHashNumber HashIIDPtrKey(JSDHashTable *table, const void *key) { return *((JSHashNumber*)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)); } static JSDHashNumber HashNativeKey(JSDHashTable *table, const void *key) { @@ -480,18 +480,18 @@ XPCNativeScriptableSharedMap::Entry::Has h = (JSDHashNumber) obj->GetFlags(); for (s = (const unsigned char*) obj->GetJSClass()->name; *s != '\0'; s++) h = JS_ROTATE_LEFT32(h, 4) ^ *s; return h; } JSBool XPCNativeScriptableSharedMap::Entry::Match(JSDHashTable *table, - const JSDHashEntryHdr *entry, - const void *key) + const JSDHashEntryHdr *entry, + const void *key) { XPCNativeScriptableShared* obj1 = ((XPCNativeScriptableSharedMap::Entry*) entry)->key; XPCNativeScriptableShared* obj2 = (XPCNativeScriptableShared*) key; // match the flags, the classname string and the interfaces bitmap
--- a/js/xpconnect/src/XPCQuickStubs.cpp +++ b/js/xpconnect/src/XPCQuickStubs.cpp @@ -89,18 +89,17 @@ LookupInterfaceOrAncestor(PRUint32 table const xpc_qsHashEntry *entry = LookupEntry(tableSize, table, iid); if(!entry) { /* * On a miss, we have to search for every interface the object * 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; for(;;) { nsCOMPtr<nsIInterfaceInfo> parent; if(NS_FAILED(info->GetParent(getter_AddRefs(parent))) || !parent || @@ -441,32 +440,30 @@ xpc_qsDefineQuickStubs(JSContext *cx, JS } // Define quick stubs for methods. const xpc_qsFunctionSpec *fs = entry->functions; if(fs) { 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; } } const xpc_qsTraceableSpec *ts = entry->traceables; if(ts) { 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; } } // Next. size_t j = entry->parentInterface; if(j == XPC_QS_NULL_INDEX) break; @@ -572,31 +569,30 @@ ThrowCallFailed(JSContext *cx, nsresult * the native call may be passing through an error from a previous JS * call. So we'll just throw that exception into our JS. */ if(XPCThrower::CheckForPendingException(rv, cx)) return JS_FALSE; // 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 = ""; } JSAutoByteString memberNameBytes; if (!memberName) { memberName = JSID_IS_STRING(memberId) ? memberNameBytes.encode(cx, JSID_TO_STRING(memberId)) : "unknown"; } if(nsXPCException::NameAndFormatForNSResult(rv, &name, nsnull) - && name) + && name) { sz = JS_smprintf("%s 0x%x (%s) [%s.%s]", format, rv, name, ifaceName, memberName); } else { sz = JS_smprintf("%s 0x%x [%s.%s]", format, rv, ifaceName, memberName); @@ -937,18 +933,18 @@ xpc_qsUnwrapObj(jsval v, nsISupports **p *rv = NS_OK; return nsnull; } if(!JSVAL_IS_OBJECT(v)) { *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; } *rv = NS_OK; return JSVAL_TO_OBJECT(v); } nsresult
--- a/js/xpconnect/src/XPCQuickStubs.h +++ b/js/xpconnect/src/XPCQuickStubs.h @@ -373,18 +373,17 @@ protected: // If pval is null, that means the argument was optional and // not passed; turn those into void strings if they're // supposed to be stringified. if (behavior != eStringify || !pval) { // 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; } s = JS_ValueToString(cx, v); if(!s) {
--- a/js/xpconnect/src/XPCRuntimeService.cpp +++ b/js/xpconnect/src/XPCRuntimeService.cpp @@ -101,17 +101,17 @@ BackstagePass::GetInterfaces(PRUint32 *a *aArray = array = static_cast<nsIID**>(nsMemory::Alloc(count * sizeof(nsIID*))); if(!array) return NS_ERROR_OUT_OF_MEMORY; PRUint32 index = 0; 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; PUSH_IID(nsIXPCScriptable) PUSH_IID(nsIScriptObjectPrincipal) #undef PUSH_IID @@ -122,17 +122,17 @@ oom: nsMemory::Free(array); *aArray = nsnull; return NS_ERROR_OUT_OF_MEMORY; } /* nsISupports getHelperForLanguage (in PRUint32 language); */ NS_IMETHODIMP BackstagePass::GetHelperForLanguage(PRUint32 language, - nsISupports **retval) + nsISupports **retval) { *retval = nsnull; return NS_OK; } /* readonly attribute string contractID; */ NS_IMETHODIMP BackstagePass::GetContractID(char * *aContractID) @@ -155,18 +155,17 @@ NS_IMETHODIMP BackstagePass::GetClassID(nsCID * *aClassID) { *aClassID = nsnull; return NS_OK; } /* readonly attribute PRUint32 implementationLanguage; */ NS_IMETHODIMP -BackstagePass::GetImplementationLanguage( - PRUint32 *aImplementationLanguage) +BackstagePass::GetImplementationLanguage(PRUint32 *aImplementationLanguage) { *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; return NS_OK; } /* readonly attribute PRUint32 flags; */ NS_IMETHODIMP BackstagePass::GetFlags(PRUint32 *aFlags)
--- a/js/xpconnect/src/XPCStack.cpp +++ b/js/xpconnect/src/XPCStack.cpp @@ -46,23 +46,22 @@ class XPCJSStackFrame : public nsIStackF { public: NS_DECL_ISUPPORTS NS_DECL_NSISTACKFRAME 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(); JSBool IsJSFrame() const {return mLanguage == nsIProgrammingLanguage::JAVASCRIPT;} private: @@ -94,23 +93,22 @@ XPCJSStack::CreateStack(JSContext* cx, n nsresult XPCJSStack::CreateStackFrameLocation(PRUint32 aLanguage, const char* aFilename, const char* aFunctionName, PRInt32 aLineNumber, nsIStackFrame* aCaller, nsIStackFrame** stack) { - return XPCJSStackFrame::CreateStackFrameLocation( - aLanguage, - aFilename, - aFunctionName, - aLineNumber, - aCaller, - (XPCJSStackFrame**) stack); + return XPCJSStackFrame::CreateStackFrameLocation(aLanguage, + aFilename, + aFunctionName, + aLineNumber, + aCaller, + (XPCJSStackFrame**) stack); } /**********************************************/ XPCJSStackFrame::XPCJSStackFrame() : mFilename(nsnull), mFunname(nsnull), @@ -227,26 +225,26 @@ XPCJSStackFrame::CreateStackFrameLocatio self->mLanguage = aLanguage; self->mLineno = aLineNumber; } if(!failed && aFilename) { self->mFilename = (char*) nsMemory::Clone(aFilename, - sizeof(char)*(strlen(aFilename)+1)); + sizeof(char)*(strlen(aFilename)+1)); if(!self->mFilename) failed = JS_TRUE; } if(!failed && aFunctionName) { self->mFunname = (char*) nsMemory::Clone(aFunctionName, - sizeof(char)*(strlen(aFunctionName)+1)); + sizeof(char)*(strlen(aFunctionName)+1)); if(!self->mFunname) failed = JS_TRUE; } if(!failed && aCaller) { self->mCaller = aCaller; }
--- a/js/xpconnect/src/XPCString.cpp +++ b/js/xpconnect/src/XPCString.cpp @@ -116,17 +116,17 @@ XPCStringConvert::ReadableToJSVal(JSCont } } else { // blech, have to copy. jschar *chars = reinterpret_cast<jschar *> (JS_malloc(cx, (length + 1) * - sizeof(jschar))); + sizeof(jschar))); if (!chars) return JSVAL_NULL; if (length && !CopyUnicodeTo(readable, 0, reinterpret_cast<PRUnichar *>(chars), length)) { JS_free(cx, chars);
--- a/js/xpconnect/src/XPCThrower.cpp +++ b/js/xpconnect/src/XPCThrower.cpp @@ -212,20 +212,19 @@ XPCThrower::BuildAndThrowException(JSCon XPCPerThreadData* tls = XPCPerThreadData::GetData(cx); if(tls) { nsIExceptionManager * exceptionManager = tls->GetExceptionManager(); if(exceptionManager) { // 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) { finalException = defaultException; } } }
--- a/js/xpconnect/src/XPCVariant.cpp +++ b/js/xpconnect/src/XPCVariant.cpp @@ -402,17 +402,17 @@ JSBool XPCVariant::InitializeData(XPCCal // XXX This could be smarter and pick some more interesting iface. nsXPConnect* xpc; nsCOMPtr<nsISupports> wrapper; const nsIID& iid = NS_GET_IID(nsISupports); 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)); } NS_IMETHODIMP XPCVariant::GetAsJSVal(jsval* result) { NS_PRECONDITION(result, "null result arg."); *result = GetJSVal(); @@ -429,20 +429,20 @@ XPCVariant::VariantDataToJS(XPCLazyCallC PRUint16 type; if (NS_FAILED(variant->GetDataType(&type))) return JS_FALSE; jsval realVal; 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)) return JS_FALSE; *pJSVal = realVal; return JS_TRUE; } @@ -565,17 +565,17 @@ XPCVariant::VariantDataToJS(XPCLazyCallC case nsIDataType::VTYPE_WCHAR_STR: if(NS_FAILED(variant->GetAsWString((PRUnichar**)&xpctvar.val.p))) return JS_FALSE; xpctvar.type = (uint8)(TD_PWSTRING | XPT_TDP_POINTER); xpctvar.SetValNeedsCleanup(); 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(); break; case nsIDataType::VTYPE_INTERFACE: case nsIDataType::VTYPE_INTERFACE_IS: { nsID* piid;
--- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -534,17 +534,17 @@ nsXPCWrappedJS* nsXPCWrappedJS::FindInherited(REFNSIID aIID) { NS_ASSERTION(!aIID.Equals(NS_GET_IID(nsISupports)), "bad call sequence"); for(nsXPCWrappedJS* cur = mRoot; cur; cur = cur->mNext) { bool found; if(NS_SUCCEEDED(cur->GetClass()->GetInterfaceInfo()-> - HasAncestor(&aIID, &found)) && found) + HasAncestor(&aIID, &found)) && found) return cur; } return nsnull; } NS_IMETHODIMP nsXPCWrappedJS::GetInterfaceInfo(nsIInterfaceInfo** info) @@ -653,17 +653,17 @@ NS_IMETHODIMP nsXPCWrappedJS::DebugDump(PRInt16 depth) { #ifdef DEBUG XPC_LOG_ALWAYS(("nsXPCWrappedJS @ %x with mRefCnt = %d", this, mRefCnt.get())); XPC_LOG_INDENT(); 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)); if(name) nsMemory::Free(name); char * iid = GetClass()->GetIID().ToString(); XPC_LOG_ALWAYS(("IID number is %s", iid ? iid : "invalid")); if(iid)
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -112,17 +112,17 @@ AutoScriptEvaluate::~AutoScriptEvaluate( // Note: We rely on the rule that if any JSContext in our JSRuntime has // private data that points to an nsISupports subclass, it has also set // the JSOPTION_PRIVATE_IS_NSISUPPORTS option. if (JS_GetOptions(mJSContext) & JSOPTION_PRIVATE_IS_NSISUPPORTS) { nsCOMPtr<nsIXPCScriptNotify> scriptNotify = do_QueryInterface(static_cast<nsISupports*> - (JS_GetContextPrivate(mJSContext))); + (JS_GetContextPrivate(mJSContext))); if(scriptNotify) scriptNotify->ScriptExecuted(); } if(mErrorReporterSet) JS_SetErrorReporter(mJSContext, NULL); } @@ -952,17 +952,17 @@ nsXPCWrappedJSClass::GetInterfaceTypeFro nsXPTCMiniVariant* nativeParams, nsID* result) { uint8 type_tag = type.TagPart(); if(type_tag == nsXPTType::T_INTERFACE) { if(NS_SUCCEEDED(GetInterfaceInfo()-> - GetIIDForParamNoAlloc(methodIndex, ¶m, result))) + GetIIDForParamNoAlloc(methodIndex, ¶m, result))) { return JS_TRUE; } } else if(type_tag == nsXPTType::T_INTERFACE_IS) { uint8 argnum; nsresult rv; @@ -1409,38 +1409,38 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra if(translator) { bool hideFirstParamFromJS = false; nsIID* newWrapperIID = nsnull; 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; } if(hideFirstParamFromJS) { NS_ERROR("HideFirstParamFromJS not supported"); goto pre_call_clean_up; } if(newThis) { jsval v; 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) { goto pre_call_clean_up; } thisObj = JSVAL_TO_OBJECT(v); if(!JS_WrapObject(cx, &thisObj)) @@ -1538,19 +1538,19 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra (const void**)&pv->val, datum_type, ¶m_iid, array_count, nsnull)) goto pre_call_clean_up; } 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 { if(!XPCConvert::NativeData2JS(ccx, &val, &pv->val, type, ¶m_iid, nsnull)) goto pre_call_clean_up; } @@ -1564,18 +1564,18 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra { retval = NS_ERROR_OUT_OF_MEMORY; goto pre_call_clean_up; } 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; } } *sp++ = OBJECT_TO_JSVAL(out_obj); } else *sp++ = val; @@ -1730,27 +1730,27 @@ pre_call_clean_up: pv = (nsXPTCMiniVariant*) &nativeParams[i].val.p; else pv = (nsXPTCMiniVariant*) nativeParams[i].val.p; if(param.IsRetval()) 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 if(type_tag == nsXPTType::T_INTERFACE) { if(NS_FAILED(GetInterfaceInfo()-> - GetIIDForParamNoAlloc(methodIndex, ¶m, - ¶m_iid))) + GetIIDForParamNoAlloc(methodIndex, ¶m, + ¶m_iid))) break; } if(!XPCConvert::JSData2Native(ccx, &pv->val, val, type, !param.IsDipper(), ¶m_iid, nsnull)) break; } @@ -1777,18 +1777,18 @@ pre_call_clean_up: type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS || type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS; pv = (nsXPTCMiniVariant*) nativeParams[i].val.p; 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 if(isArray) { if(NS_FAILED(mInfo->GetTypeForParam(methodIndex, ¶m, 1, &datum_type))) @@ -1820,19 +1820,19 @@ pre_call_clean_up: array_count, array_count, datum_type, ¶m_iid, nsnull)) break; } 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 { if(!XPCConvert::JSData2Native(ccx, &pv->val, val, type, JS_TRUE, ¶m_iid, nsnull)) break; @@ -1942,17 +1942,17 @@ nsXPCWrappedJSClass::DebugDump(PRInt16 d XPC_LOG_ALWAYS(("mDescriptors @ %x count = %d", mDescriptors, methodCount)); if(depth && mDescriptors && methodCount) { depth--; XPC_LOG_INDENT(); 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++; } XPC_LOG_OUTDENT(); #endif return NS_OK; }
--- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -951,19 +951,18 @@ XPCWrappedNative::Destroy() } mMaybeScope = nsnull; } // 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"); nsXPCClassInfo *classInfoHelper = nsnull; CallQueryInterface(classInfo, &classInfoHelper); if(classInfoHelper) { @@ -977,19 +976,18 @@ XPCWrappedNative::GatherProtoScriptableC sciProto.SetCallback(helper.forget()); sciProto.SetFlags(flags); sciProto.SetInterfacesBitmap(classInfoHelper->GetInterfacesBitmap()); return; } 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)); if(helper) { JSUint32 flags; rv = helper->GetScriptableFlags(&flags); if(NS_FAILED(rv)) @@ -998,21 +996,20 @@ XPCWrappedNative::GatherProtoScriptableC sciProto.SetCallback(helper.forget()); sciProto.SetFlags(flags); } } } // 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"); // Get the class scriptable helper (if present) if(classInfo) { GatherProtoScriptableCreateInfo(classInfo, sciProto); @@ -1031,63 +1028,63 @@ XPCWrappedNative::GatherScriptableCreate sciWrapper.SetCallback(helper.forget()); sciWrapper.SetFlags(flags); // A whole series of assertions to catch bad uses of scriptable flags on // 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)"); return sciWrapper; } return sciProto; } @@ -1216,17 +1213,17 @@ XPCWrappedNative::FinishInit(XPCCallCont } #ifdef XPC_CHECK_WRAPPER_THREADSAFETY NS_ASSERTION(mThread, "Should have been set at construction time!"); 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 // A hack for bug 517665, increase the probability for GC. JS_updateMallocCounter(ccx.GetJSContext(), 2 * sizeof(XPCWrappedNative)); return JS_TRUE; @@ -1568,21 +1565,20 @@ XPCWrappedNative::ReparentWrapperIfFound if(wrapper->mScriptableInfo && wrapper->mScriptableInfo == oldProto->GetScriptableInfo()) { // The new proto had better have the same JSClass stuff as // the old one! We maintain a runtime wide unique map of // 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(); } NS_ASSERTION(!newMap->Find(wrapper->GetIdentityObject()), "wrapper already in new scope!"); (void) newMap->Add(wrapper); @@ -1839,30 +1835,28 @@ XPCWrappedNative::ExtendSet(XPCCallConte DEBUG_ReportShadowedMembers(newSet, this, GetProto()); } return JS_TRUE; } 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++) { if(tearOff->GetInterface() == aInterface) { return tearOff; } } @@ -1886,18 +1880,17 @@ XPCWrappedNative::FindTearOff(XPCCallCon XPCWrappedNativeTearOffChunk* chunk; for(lastChunk = chunk = &mFirstChunk; chunk; lastChunk = chunk, chunk = chunk->mNextChunk) { 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++) { if(to->GetInterface() == aInterface) { if(needJSObject && !to->GetJSObject()) { AutoMarkingWrappedNativeTearOffPtr tearoff(ccx, to); @@ -2050,27 +2043,27 @@ XPCWrappedNative::InitTearOff(XPCCallCon if(HasProto()) { JSObject* proto = nsnull; JSObject* our_proto = GetProto()->GetJSProtoObject(); 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) { proto = proto->getProto(); found_our_proto = proto == our_proto; } NS_ASSERTION(found_our_proto, - "!!! xpconnect/xbl check - wrapper has extra proto"); + "!!! xpconnect/xbl check - wrapper has extra proto"); } else { NS_WARNING("!!! xpconnect/xbl check - wrapper has no proto"); } } #endif NS_RELEASE(obj); @@ -2102,21 +2095,20 @@ XPCWrappedNative::InitTearOff(XPCCallCon NS_RELEASE(obj); aTearOff->SetInterface(nsnull); return NS_ERROR_NO_INTERFACE; } } } 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); aTearOff->SetInterface(nsnull); return NS_ERROR_XPC_SECURITY_MANAGER_VETO; } } // We are relocked from here on... @@ -3832,26 +3824,26 @@ void DEBUG_CheckWrapperThreadSafety(cons if(proto && proto->ClassIsMainThreadOnly()) { // NS_IsMainThread is safe to call even after we've started shutting // down. if(!NS_IsMainThread()) { 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 NS_IMPL_THREADSAFE_ISUPPORTS1(XPCJSObjectHolder, nsIXPConnectJSObjectHolder) NS_IMETHODIMP XPCJSObjectHolder::GetJSObject(JSObject** aJSObj)
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -224,37 +224,36 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx } // It is a double wrapped object. Figure out if the caller // is allowed to see it. 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); iface = XPCNativeInterface:: GetNewOrUsed(ccx, &NS_GET_IID(nsIXPCWrappedJSObjectGetter)); if(iface) { jsid id = ccx.GetRuntime()-> GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT); 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; } } } *vp = OBJECT_TO_JSVAL(realObject); return JS_WrapValue(cx, vp); @@ -350,17 +349,17 @@ DefinePropertyIfFound(XPCCallContext& cc XPCWrappedNativeTearOff* to; JSObject* jso; nsresult rv = NS_OK; if(JSID_IS_STRING(id) && 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())) { AutoResolveName arn(ccx, id); if(resolved) *resolved = JS_TRUE; return JS_DefinePropertyById(ccx, obj, id, OBJECT_TO_JSVAL(jso), nsnull, nsnull, @@ -1165,17 +1164,17 @@ XPC_WN_Helper_NewResolve(JSContext *cx, { XPCWrappedNative* oldResolvingWrapper; JSBool allowPropMods = si->GetFlags().AllowPropModsDuringResolve(); if(allowPropMods) oldResolvingWrapper = ccx.SetResolvingWrapper(wrapper); rv = si->GetCallback()->NewResolve(wrapper, cx, obj, id, flags, - &obj2FromScriptable, &retval); + &obj2FromScriptable, &retval); if(allowPropMods) (void)ccx.SetResolvingWrapper(oldResolvingWrapper); } old = ccx.SetResolveName(old); NS_ASSERTION(old == id, "bad nest"); @@ -1679,22 +1678,21 @@ XPC_WN_GetterSetter(JSContext *cx, uintN return XPCWrappedNative::GetAttribute(ccx); } /***************************************************************************/ 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) return JS_FALSE; if(self->GetScriptableInfo() && self->GetScriptableInfo()->GetFlags().DontEnumStaticProps()) return JS_TRUE; @@ -1744,20 +1742,19 @@ XPC_WN_Shared_Proto_Trace(JSTracer *trc, TraceScopeJSObjects(trc, p->GetScope()); } /*****************************************************/ 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); if(!self) return JS_FALSE; XPCCallContext ccx(JS_CALLER, cx); if(!ccx.IsValid())
--- a/js/xpconnect/src/XPCWrappedNativeProto.cpp +++ b/js/xpconnect/src/XPCWrappedNativeProto.cpp @@ -83,20 +83,19 @@ XPCWrappedNativeProto::~XPCWrappedNative // Note that our weak ref to mScope is not to be trusted at this point. XPCNativeSet::ClearCacheEntryForClassInfo(mClassInfo); delete mScriptableInfo; } JSBool -XPCWrappedNativeProto::Init( - XPCCallContext& ccx, - JSBool isGlobal, - const XPCNativeScriptableCreateInfo* scriptableCreateInfo) +XPCWrappedNativeProto::Init(XPCCallContext& ccx, + JSBool isGlobal, + const XPCNativeScriptableCreateInfo* scriptableCreateInfo) { nsIXPCScriptable *callback = scriptableCreateInfo ? scriptableCreateInfo->GetCallback() : nsnull; if(callback) { mScriptableInfo = XPCNativeScriptableInfo::Construct(ccx, isGlobal, scriptableCreateInfo);
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -552,22 +552,19 @@ ASSERT_WrappedNativeProtoSetNotMarked(JS } // static void 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 static JSDHashOperator WrappedNativeTearoffSweeper(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number, void *arg) { @@ -864,17 +861,17 @@ WNProtoSecPolicyClearer(JSDHashTable *ta XPCWrappedNativeProto* proto = ((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value; *(proto->GetSecurityInfoAddr()) = nsnull; return JS_DHASH_NEXT; } 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()) *(wrapper->GetProto()->GetSecurityInfoAddr()) = nsnull; return JS_DHASH_NEXT; } // static @@ -911,19 +908,19 @@ WNProtoRemover(JSDHashTable *table, JSDH } void XPCWrappedNativeScope::RemoveWrappedNativeProtos() { XPCAutoLock al(mRuntime->GetMapLock()); mWrappedNativeProtoMap->Enumerate(WNProtoRemover, - GetRuntime()->GetDetachedWrappedNativeProtoMap()); + GetRuntime()->GetDetachedWrappedNativeProtoMap()); mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoRemover, - GetRuntime()->GetDetachedWrappedNativeProtoMap()); + GetRuntime()->GetDetachedWrappedNativeProtoMap()); } static PLDHashOperator TraceDOMPrototype(const char* aKey, JSObject* aData, void* aClosure) { JSTracer *trc = static_cast<JSTracer*>(aClosure); JS_CALL_OBJECT_TRACER(trc, aData, "DOM prototype"); return PL_DHASH_NEXT; @@ -990,40 +987,40 @@ XPCWrappedNativeScope::DebugDump(PRInt16 XPC_LOG_ALWAYS(("mNext @ %x", mNext)); XPC_LOG_ALWAYS(("mComponents @ %x", mComponents)); XPC_LOG_ALWAYS(("mGlobalJSObject @ %x", mGlobalJSObject)); XPC_LOG_ALWAYS(("mPrototypeJSObject @ %x", mPrototypeJSObject)); XPC_LOG_ALWAYS(("mPrototypeJSFunction @ %x", mPrototypeJSFunction)); 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()) { XPC_LOG_INDENT(); mWrappedNativeMap->Enumerate(WrappedNativeMapDumpEnumerator, &depth); XPC_LOG_OUTDENT(); } 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()) { XPC_LOG_INDENT(); mWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMapDumpEnumerator, &depth); XPC_LOG_OUTDENT(); } 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()) { XPC_LOG_INDENT(); mMainThreadWrappedNativeProtoMap->Enumerate(WrappedNativeProtoMapDumpEnumerator, &depth); XPC_LOG_OUTDENT(); } XPC_LOG_OUTDENT();
--- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -280,27 +280,27 @@ nsXPConnect::IsISupportsDescendant(nsIIn if(info) info->HasAncestor(&NS_GET_IID(nsISupports), &found); return found; } /***************************************************************************/ 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; } static nsresult FindInfo(InfoTester tester, const void* data, nsIInterfaceInfoSuperManager* iism, nsIInterfaceInfo** info) @@ -697,18 +697,17 @@ NoteJSChild(JSTracer *trc, void *thing, tracer->cb.NoteNextEdgeName(buffer); } else if (tracer->debugPrintIndex != (size_t)-1) { char buffer[200]; JS_snprintf(buffer, sizeof(buffer), "%s[%lu]", static_cast<const char *>(tracer->debugPrintArg), 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 tracer->cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, thing); } else if(kind != JSTRACE_STRING) { JS_TraceChildren(trc, thing, kind); @@ -2252,17 +2251,17 @@ nsXPConnect::ReleaseJSContext(JSContext #endif ccx->SetDestroyJSContextInDestructor(JS_TRUE); return NS_OK; } // else continue on and synchronously destroy the JSContext ... NS_ASSERTION(!tls->GetJSContextStack() || !tls->GetJSContextStack()-> - DEBUG_StackHasJSContext(aJSContext), + DEBUG_StackHasJSContext(aJSContext), "JSContext still in threadjscontextstack!"); } if(noGC) JS_DestroyContextNoGC(aJSContext); else JS_DestroyContext(aJSContext); return NS_OK; @@ -2310,38 +2309,38 @@ nsXPConnect::DebugDumpObject(nsISupports } nsIXPConnect* xpc; nsIXPCWrappedJSClass* wjsc; nsIXPConnectWrappedNative* wn; 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); NS_RELEASE(wjs); } else XPC_LOG_ALWAYS(("*** Could not dump the nsISupports @ %x", p)); #endif
--- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -307,17 +307,17 @@ typedef nsDataHashtable<xpc::PtrAndPrinc /***************************************************************************/ // Useful macros... #define XPC_STRING_GETTER_BODY(dest, src) \ NS_ENSURE_ARG_POINTER(dest); \ char* result; \ if(src) \ result = (char*) nsMemory::Clone(src, \ - sizeof(char)*(strlen(src)+1)); \ + sizeof(char)*(strlen(src)+1)); \ else \ result = nsnull; \ *dest = result; \ return (result || !src) ? NS_OK : NS_ERROR_OUT_OF_MEMORY #define WRAPPER_SLOTS (JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(1)) @@ -2725,19 +2725,18 @@ public: #endif inline void SweepTearOffs(); // Returns a string that shuld be free'd using JS_smprintf_free (or null). 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;} JSBool NeedsSOW() { return !!(mWrapperWord & NEEDS_SOW); } void SetNeedsSOW() { mWrapperWord |= NEEDS_SOW; } JSBool NeedsCOW() { return !!(mWrapperWord & NEEDS_COW); } void SetNeedsCOW() { mWrapperWord |= NEEDS_COW; } @@ -2817,24 +2816,23 @@ private: JSBool ExtendSet(XPCCallContext& ccx, XPCNativeInterface* aInterface); nsresult InitTearOff(XPCCallContext& ccx, XPCWrappedNativeTearOff* aTearOff, XPCNativeInterface* aInterface, 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 { XPCWrappedNativeScope* mMaybeScope; XPCWrappedNativeProto* mMaybeProto; }; XPCNativeSet* mSet;