mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
backout 2bb432c47170 for debug asserts
This commit is contained in:
parent
76f06ac016
commit
4d16e0db71
@ -161,6 +161,7 @@
|
||||
#include "nsIJARChannel.h"
|
||||
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsISelectionDisplay.h"
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
// Helper Classes
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "prmem.h"
|
||||
#include "jsapi.h" // for JSAutoRequest
|
||||
#include "jsdbgapi.h" // for JS_ClearWatchPointsForObject
|
||||
#include "jsfriendapi.h" // for JS_GetGlobalForFrame
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
#include "nsDOMScriptObjectHolder.h"
|
||||
#include "prmem.h"
|
||||
#include "WrapperFactory.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
@ -4105,18 +4106,24 @@ public:
|
||||
|
||||
protected:
|
||||
JSContext *mContext;
|
||||
FallibleTArray<jsval> mArgv;
|
||||
jsval *mArgv;
|
||||
uint32_t mArgc;
|
||||
};
|
||||
|
||||
nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc, jsval *argv,
|
||||
nsresult *prv) :
|
||||
mContext(aContext)
|
||||
mContext(aContext),
|
||||
mArgv(nullptr),
|
||||
mArgc(argc)
|
||||
{
|
||||
// copy the array - we don't know its lifetime, and ours is tied to xpcom
|
||||
// refcounting. Alloc zero'd array so cleanup etc is safe.
|
||||
if (!mArgv.EnsureLengthAtLeast(argc)) {
|
||||
*prv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
if (argc) {
|
||||
mArgv = (jsval *) PR_CALLOC(argc * sizeof(jsval));
|
||||
if (!mArgv) {
|
||||
*prv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Callers are allowed to pass in a null argv even for argc > 0. They can
|
||||
@ -4141,10 +4148,13 @@ nsJSArgArray::~nsJSArgArray()
|
||||
void
|
||||
nsJSArgArray::ReleaseJSObjects()
|
||||
{
|
||||
if (!mArgv.IsEmpty())
|
||||
if (mArgv) {
|
||||
PR_DELETE(mArgv);
|
||||
}
|
||||
if (mArgc > 0) {
|
||||
mArgc = 0;
|
||||
NS_DROP_JS_OBJECTS(this, nsJSArgArray);
|
||||
|
||||
mArgv.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// QueryInterface implementation for nsJSArgArray
|
||||
@ -4157,10 +4167,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsJSArgArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSArgArray)
|
||||
uint32_t length = tmp->mArgv.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (JSVAL_IS_GCTHING(tmp->mArgv[i])) {
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(JSVAL_TO_GCTHING(tmp->mArgv[i]),
|
||||
jsval *argv = tmp->mArgv;
|
||||
if (argv) {
|
||||
jsval *end;
|
||||
for (end = argv + tmp->mArgc; argv < end; ++argv) {
|
||||
if (JSVAL_IS_GCTHING(*argv))
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(JSVAL_TO_GCTHING(*argv),
|
||||
"mArgv[i]")
|
||||
}
|
||||
}
|
||||
@ -4178,15 +4190,15 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsJSArgArray)
|
||||
nsresult
|
||||
nsJSArgArray::GetArgs(uint32_t *argc, void **argv)
|
||||
{
|
||||
*argv = (void *)mArgv.Elements();
|
||||
*argc = mArgv.Length();
|
||||
*argv = (void *)mArgv;
|
||||
*argc = mArgc;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIArray impl
|
||||
NS_IMETHODIMP nsJSArgArray::GetLength(uint32_t *aLength)
|
||||
{
|
||||
*aLength = mArgv.Length();
|
||||
*aLength = mArgc;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -4194,7 +4206,7 @@ NS_IMETHODIMP nsJSArgArray::GetLength(uint32_t *aLength)
|
||||
NS_IMETHODIMP nsJSArgArray::QueryElementAt(uint32_t index, const nsIID & uuid, void * *result)
|
||||
{
|
||||
*result = nullptr;
|
||||
if (index >= mArgv.Length())
|
||||
if (index >= mArgc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (uuid.Equals(NS_GET_IID(nsIVariant)) || uuid.Equals(NS_GET_IID(nsISupports))) {
|
||||
|
@ -191,7 +191,7 @@ ArchiveReaderZipEvent::Exec()
|
||||
}
|
||||
|
||||
// Read the name:
|
||||
nsAutoArrayPtr<char> filename(new char[filenameLen + 1]);
|
||||
char* filename = (char*)PR_Malloc(filenameLen + 1);
|
||||
rv = inputStream->Read(filename, filenameLen, &ret);
|
||||
if (NS_FAILED(rv) || ret != filenameLen) {
|
||||
return RunShare(NS_ERROR_UNEXPECTED);
|
||||
@ -204,6 +204,8 @@ ArchiveReaderZipEvent::Exec()
|
||||
mFileList.AppendElement(new ArchiveZipItem(filename, centralStruct, mOptions));
|
||||
}
|
||||
|
||||
PR_Free(filename);
|
||||
|
||||
// Ignore the rest
|
||||
seekableStream->Seek(nsISeekableStream::NS_SEEK_CUR, extraLen + commentLen);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsDependentString.h"
|
||||
#include "prmem.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user