Bug 1217307 - Remove some unnecessary null checks in rest of dom/. r=njn
This commit is contained in:
@@ -848,7 +848,6 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
|
|||||||
*aFormSubmission = new nsFSURLEncoded(charset, method, doc,
|
*aFormSubmission = new nsFSURLEncoded(charset, method, doc,
|
||||||
aOriginatingElement);
|
aOriginatingElement);
|
||||||
}
|
}
|
||||||
NS_ENSURE_TRUE(*aFormSubmission, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,8 +298,6 @@ nsJSONWriter::Write(const char16_t *aBuffer, uint32_t aLength)
|
|||||||
|
|
||||||
if (!mDidWrite) {
|
if (!mDidWrite) {
|
||||||
mBuffer = new char16_t[JSON_STREAM_BUFSIZE];
|
mBuffer = new char16_t[JSON_STREAM_BUFSIZE];
|
||||||
if (!mBuffer)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
mDidWrite = true;
|
mDidWrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,9 +479,6 @@ nsresult
|
|||||||
NS_NewJSON(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
NS_NewJSON(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
||||||
{
|
{
|
||||||
nsJSON* json = new nsJSON();
|
nsJSON* json = new nsJSON();
|
||||||
if (!json)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
NS_ADDREF(json);
|
NS_ADDREF(json);
|
||||||
*aResult = json;
|
*aResult = json;
|
||||||
|
|
||||||
|
|||||||
@@ -410,8 +410,6 @@ nsresult nsJSChannel::Init(nsIURI *aURI)
|
|||||||
|
|
||||||
// Create the nsIStreamIO layer used by the nsIStreamIOChannel.
|
// Create the nsIStreamIO layer used by the nsIStreamIOChannel.
|
||||||
mIOThunk = new nsJSThunk();
|
mIOThunk = new nsJSThunk();
|
||||||
if (!mIOThunk)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
// Create a stock input stream channel...
|
// Create a stock input stream channel...
|
||||||
// Remember, until AsyncOpen is called, the script will not be evaluated
|
// Remember, until AsyncOpen is called, the script will not be evaluated
|
||||||
@@ -1129,8 +1127,6 @@ nsJSProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|||||||
return NS_ERROR_NO_AGGREGATION;
|
return NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
||||||
nsJSProtocolHandler* ph = new nsJSProtocolHandler();
|
nsJSProtocolHandler* ph = new nsJSProtocolHandler();
|
||||||
if (!ph)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
NS_ADDREF(ph);
|
NS_ADDREF(ph);
|
||||||
nsresult rv = ph->Init();
|
nsresult rv = ph->Init();
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|||||||
@@ -640,9 +640,6 @@ InitMediaCache()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gMediaCache = new MediaCache();
|
gMediaCache = new MediaCache();
|
||||||
if (!gMediaCache)
|
|
||||||
return;
|
|
||||||
|
|
||||||
nsresult rv = gMediaCache->Init();
|
nsresult rv = gMediaCache->Init();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
delete gMediaCache;
|
delete gMediaCache;
|
||||||
|
|||||||
@@ -549,8 +549,6 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mListener = new Listener(this);
|
mListener = new Listener(this);
|
||||||
NS_ENSURE_TRUE(mListener, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
if (aStreamListener) {
|
if (aStreamListener) {
|
||||||
*aStreamListener = mListener;
|
*aStreamListener = mListener;
|
||||||
NS_ADDREF(*aStreamListener);
|
NS_ADDREF(*aStreamListener);
|
||||||
|
|||||||
@@ -582,9 +582,6 @@ nsNPAPIPluginInstance::NewStreamFromPlugin(const char* type, const char* target,
|
|||||||
nsIOutputStream* *result)
|
nsIOutputStream* *result)
|
||||||
{
|
{
|
||||||
nsPluginStreamToFile* stream = new nsPluginStreamToFile(target, mOwner);
|
nsPluginStreamToFile* stream = new nsPluginStreamToFile(target, mOwner);
|
||||||
if (!stream)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
return stream->QueryInterface(kIOutputStreamIID, (void**)result);
|
return stream->QueryInterface(kIOutputStreamIID, (void**)result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2227,9 +2227,6 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
|||||||
|
|
||||||
pluginTag = new nsPluginTag(&info, fileModTime, fromExtension);
|
pluginTag = new nsPluginTag(&info, fileModTime, fromExtension);
|
||||||
pluginFile.FreePluginInfo(info);
|
pluginFile.FreePluginInfo(info);
|
||||||
if (!pluginTag)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
pluginTag->mLibrary = library;
|
pluginTag->mLibrary = library;
|
||||||
uint32_t state;
|
uint32_t state;
|
||||||
rv = pluginTag->GetBlocklistState(&state);
|
rv = pluginTag->GetBlocklistState(&state);
|
||||||
@@ -3319,8 +3316,6 @@ nsPluginHost::EnsurePrivateDirServiceProvider()
|
|||||||
if (!mPrivateDirServiceProvider) {
|
if (!mPrivateDirServiceProvider) {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
mPrivateDirServiceProvider = new nsPluginDirServiceProvider();
|
mPrivateDirServiceProvider = new nsPluginDirServiceProvider();
|
||||||
if (!mPrivateDirServiceProvider)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
nsCOMPtr<nsIDirectoryService> dirService(do_GetService(kDirectoryServiceContractID, &rv));
|
nsCOMPtr<nsIDirectoryService> dirService(do_GetService(kDirectoryServiceContractID, &rv));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@@ -1150,9 +1150,6 @@ void nsPluginInstanceOwner::AddToCARefreshTimer() {
|
|||||||
|
|
||||||
if (!sCARefreshListeners) {
|
if (!sCARefreshListeners) {
|
||||||
sCARefreshListeners = new nsTArray<nsPluginInstanceOwner*>();
|
sCARefreshListeners = new nsTArray<nsPluginInstanceOwner*>();
|
||||||
if (!sCARefreshListeners) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sCARefreshListeners->Contains(this)) {
|
if (sCARefreshListeners->Contains(this)) {
|
||||||
@@ -1163,9 +1160,6 @@ void nsPluginInstanceOwner::AddToCARefreshTimer() {
|
|||||||
|
|
||||||
if (!sCATimer) {
|
if (!sCATimer) {
|
||||||
sCATimer = new nsCOMPtr<nsITimer>();
|
sCATimer = new nsCOMPtr<nsITimer>();
|
||||||
if (!sCATimer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sCARefreshListeners->Length() == 1) {
|
if (sCARefreshListeners->Length() == 1) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||||
*aPluginNativeWindow = new nsPluginNativeWindowPLATFORM();
|
*aPluginNativeWindow = new nsPluginNativeWindowPLATFORM();
|
||||||
return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||||
*aPluginNativeWindow = new nsPluginNativeWindowGtk();
|
*aPluginNativeWindow = new nsPluginNativeWindowGtk();
|
||||||
return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow **aPluginNativeWindow)
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||||
*aPluginNativeWindow = new nsPluginNativeWindowQt();
|
*aPluginNativeWindow = new nsPluginNativeWindowQt();
|
||||||
return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||||
|
|||||||
@@ -575,13 +575,11 @@ nsPluginNativeWindowWin::GetPluginWindowEvent(HWND aWnd, UINT aMsg, WPARAM aWPar
|
|||||||
if (!mCachedPluginWindowEvent)
|
if (!mCachedPluginWindowEvent)
|
||||||
{
|
{
|
||||||
event = new PluginWindowEvent();
|
event = new PluginWindowEvent();
|
||||||
if (!event) return nullptr;
|
|
||||||
mCachedPluginWindowEvent = event;
|
mCachedPluginWindowEvent = event;
|
||||||
}
|
}
|
||||||
else if (mCachedPluginWindowEvent->InUse())
|
else if (mCachedPluginWindowEvent->InUse())
|
||||||
{
|
{
|
||||||
event = new PluginWindowEvent();
|
event = new PluginWindowEvent();
|
||||||
if (!event) return nullptr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -739,8 +737,7 @@ nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
|
|||||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||||
|
|
||||||
*aPluginNativeWindow = new nsPluginNativeWindowWin();
|
*aPluginNativeWindow = new nsPluginNativeWindowWin();
|
||||||
|
return NS_OK;
|
||||||
return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||||
|
|||||||
@@ -735,12 +735,7 @@ nsPluginStreamListenerPeer::RequestRead(NPByteRange* rangeList)
|
|||||||
} else {
|
} else {
|
||||||
nsWeakPtr weakpeer =
|
nsWeakPtr weakpeer =
|
||||||
do_GetWeakReference(static_cast<nsISupportsWeakReference*>(this));
|
do_GetWeakReference(static_cast<nsISupportsWeakReference*>(this));
|
||||||
nsPluginByteRangeStreamListener *brrListener =
|
converter = new nsPluginByteRangeStreamListener(weakpeer);
|
||||||
new nsPluginByteRangeStreamListener(weakpeer);
|
|
||||||
if (brrListener)
|
|
||||||
converter = brrListener;
|
|
||||||
else
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mPendingRequests += numRequests;
|
mPendingRequests += numRequests;
|
||||||
|
|||||||
@@ -2161,9 +2161,6 @@ PluginInstanceChild::FlashThrottleMessage(HWND aWnd,
|
|||||||
// that's done in Destroy.
|
// that's done in Destroy.
|
||||||
FlashThrottleAsyncMsg* task = new FlashThrottleAsyncMsg(this,
|
FlashThrottleAsyncMsg* task = new FlashThrottleAsyncMsg(this,
|
||||||
aWnd, aMsg, aWParam, aLParam, isWindowed);
|
aWnd, aMsg, aWParam, aLParam, isWindowed);
|
||||||
if (!task)
|
|
||||||
return;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mAsyncCallMutex);
|
MutexAutoLock lock(mAsyncCallMutex);
|
||||||
mPendingAsyncCalls.AppendElement(task);
|
mPendingAsyncCalls.AppendElement(task);
|
||||||
|
|||||||
@@ -1533,11 +1533,6 @@ PluginInstanceParent::GetActorForNPObject(NPObject* aObject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
actor = new PluginScriptableObjectParent(LocalObject);
|
actor = new PluginScriptableObjectParent(LocalObject);
|
||||||
if (!actor) {
|
|
||||||
NS_ERROR("Out of memory!");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SendPPluginScriptableObjectConstructor(actor)) {
|
if (!SendPPluginScriptableObjectConstructor(actor)) {
|
||||||
NS_WARNING("Failed to send constructor message!");
|
NS_WARNING("Failed to send constructor message!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -778,8 +778,6 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
|||||||
|
|
||||||
// set up our our instance data
|
// set up our our instance data
|
||||||
InstanceData* instanceData = new InstanceData;
|
InstanceData* instanceData = new InstanceData;
|
||||||
if (!instanceData)
|
|
||||||
return NPERR_OUT_OF_MEMORY_ERROR;
|
|
||||||
instanceData->npp = instance;
|
instanceData->npp = instance;
|
||||||
instanceData->streamMode = NP_ASFILEONLY;
|
instanceData->streamMode = NP_ASFILEONLY;
|
||||||
instanceData->testFunction = FUNCTION_NONE;
|
instanceData->testFunction = FUNCTION_NONE;
|
||||||
|
|||||||
@@ -175,9 +175,6 @@ MulticastDNSDeviceProvider::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mWrappedListener = new DNSServiceWrappedListener();
|
mWrappedListener = new DNSServiceWrappedListener();
|
||||||
if (NS_WARN_IF(!mWrappedListener)) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv = mWrappedListener->SetListener(this)))) {
|
if (NS_WARN_IF(NS_FAILED(rv = mWrappedListener->SetListener(this)))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ nsXBLProtoImplMethod::AppendBodyText(const nsAString& aText)
|
|||||||
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
||||||
if (!uncompiledMethod) {
|
if (!uncompiledMethod) {
|
||||||
uncompiledMethod = new nsXBLUncompiledMethod();
|
uncompiledMethod = new nsXBLUncompiledMethod();
|
||||||
if (!uncompiledMethod)
|
|
||||||
return;
|
|
||||||
SetUncompiledMethod(uncompiledMethod);
|
SetUncompiledMethod(uncompiledMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +70,6 @@ nsXBLProtoImplMethod::AddParameter(const nsAString& aText)
|
|||||||
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
||||||
if (!uncompiledMethod) {
|
if (!uncompiledMethod) {
|
||||||
uncompiledMethod = new nsXBLUncompiledMethod();
|
uncompiledMethod = new nsXBLUncompiledMethod();
|
||||||
if (!uncompiledMethod)
|
|
||||||
return;
|
|
||||||
SetUncompiledMethod(uncompiledMethod);
|
SetUncompiledMethod(uncompiledMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +85,6 @@ nsXBLProtoImplMethod::SetLineNumber(uint32_t aLineNumber)
|
|||||||
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
|
||||||
if (!uncompiledMethod) {
|
if (!uncompiledMethod) {
|
||||||
uncompiledMethod = new nsXBLUncompiledMethod();
|
uncompiledMethod = new nsXBLUncompiledMethod();
|
||||||
if (!uncompiledMethod)
|
|
||||||
return;
|
|
||||||
SetUncompiledMethod(uncompiledMethod);
|
SetUncompiledMethod(uncompiledMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +162,6 @@ nsXBLProtoImplMethod::CompileMember(AutoJSAPI& jsapi, const nsString& aClassStr,
|
|||||||
char** args = nullptr;
|
char** args = nullptr;
|
||||||
if (paramCount > 0) {
|
if (paramCount > 0) {
|
||||||
args = new char*[paramCount];
|
args = new char*[paramCount];
|
||||||
if (!args)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
// Add our parameters to our args array.
|
// Add our parameters to our args array.
|
||||||
int32_t argPos = 0;
|
int32_t argPos = 0;
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ struct nsXBLUncompiledMethod {
|
|||||||
|
|
||||||
void AddParameter(const nsAString& aText) {
|
void AddParameter(const nsAString& aText) {
|
||||||
nsXBLParameter* param = new nsXBLParameter(aText);
|
nsXBLParameter* param = new nsXBLParameter(aText);
|
||||||
if (!param)
|
|
||||||
return;
|
|
||||||
if (!mParameters)
|
if (!mParameters)
|
||||||
mParameters = param;
|
mParameters = param;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -197,9 +197,6 @@ void
|
|||||||
nsXBLResourceLoader::AddResource(nsIAtom* aResourceType, const nsAString& aSrc)
|
nsXBLResourceLoader::AddResource(nsIAtom* aResourceType, const nsAString& aSrc)
|
||||||
{
|
{
|
||||||
nsXBLResource* res = new nsXBLResource(aResourceType, aSrc);
|
nsXBLResource* res = new nsXBLResource(aResourceType, aSrc);
|
||||||
if (!res)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!mResourceList)
|
if (!mResourceList)
|
||||||
mResourceList = res;
|
mResourceList = res;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user