Bug 1288736 - Add some missing rv.SuppressException(), r=smaug

This commit is contained in:
Andrea Marchesini 2016-07-22 16:50:10 +02:00
parent 50904b3bab
commit 60ab8339e0
28 changed files with 66 additions and 12 deletions

View File

@ -324,6 +324,7 @@ private:
ErrorResult rv;
mFormData->Append(name, *file, dummy, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
}

View File

@ -924,7 +924,9 @@ BlobImplFile::GetType(nsAString& aType)
ErrorResult rv;
runnable->Dispatch(rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
return;
}

View File

@ -1803,9 +1803,12 @@ nsContentUtils::IsControlledByServiceWorker(nsIDocument* aDocument)
ErrorResult rv;
bool controlled = swm->IsControlled(aDocument, rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
return !rv.Failed() && controlled;
return controlled;
}
/* static */

View File

@ -792,6 +792,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
retval[i].Read(aCx, &ret, rv);
if (rv.Failed()) {
MOZ_ASSERT(false, "Unable to read structured clone in SendMessage");
rv.SuppressException();
return NS_ERROR_UNEXPECTED;
}

View File

@ -99,6 +99,7 @@ BroadcastChannelChild::RecvNotify(const ClonedMessageData& aData)
ErrorResult rv;
cloneData.Read(cx, &value, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return true;
}
}
@ -112,8 +113,8 @@ BroadcastChannelChild::RecvNotify(const ClonedMessageData& aData)
ErrorResult rv;
RefPtr<MessageEvent> event =
MessageEvent::Constructor(mBC, NS_LITERAL_STRING("message"), init, rv);
if (rv.Failed()) {
NS_WARNING("Failed to create a MessageEvent object.");
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return true;
}

View File

@ -91,6 +91,7 @@ CropAndCopyDataSourceSurface(DataSourceSurface* aSurface, const IntRect& aCropRe
ErrorResult error;
const IntRect positiveCropRect = FixUpNegativeDimension(aCropRect, error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}
@ -1106,6 +1107,7 @@ DecodeBlob(Blob& aBlob)
ErrorResult error;
aBlob.Impl()->GetInternalStream(getter_AddRefs(stream), error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}

View File

@ -1958,6 +1958,7 @@ public:
nsCOMPtr<nsIInputStream> stream;
mBlob->GetInternalStream(getter_AddRefs(stream), rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return Reject(POST_ERROR_EVENT_UNKNOWN);
}
@ -2070,6 +2071,7 @@ public:
nsCOMPtr<nsIInputStream> stream;
mBlob->GetInternalStream(getter_AddRefs(stream), rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return Reject(POST_ERROR_EVENT_UNKNOWN);
}

View File

@ -41,7 +41,9 @@ BeforeAfterKeyboardEvent::Constructor(
new BeforeAfterKeyboardEvent(aOwner, nullptr, nullptr);
ErrorResult rv;
event->InitWithKeyboardEventInit(aOwner, aType, aParam, rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
event->mEvent->AsBeforeAfterKeyboardEvent()->mEmbeddedCancelled =
aParam.mEmbeddedCancelled;

View File

@ -1286,7 +1286,9 @@ DataTransfer::SetDataWithPrincipalFromOtherProcess(const nsAString& aFormat,
RefPtr<DataTransferItem> item =
mItems->SetDataWithPrincipal(format, aData, aIndex, aPrincipal,
/* aInsertOnly = */ false, aHidden, rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
}
}

View File

@ -2536,6 +2536,7 @@ WriteOp::Init(FileHandle* aFileHandle)
ErrorResult rv;
blobImpl->GetInternalStream(getter_AddRefs(inputStream), rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}

View File

@ -84,12 +84,14 @@ FileSystemBase::GetRealPath(BlobImpl* aFile, nsIFile** aPath) const
ErrorResult rv;
aFile->GetMozFullPathInternal(filePath, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(filePath),
true, aPath);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}

View File

@ -35,6 +35,7 @@ FileSystemRequestParent::~FileSystemRequestParent()
MOZ_ASSERT(mFileSystem); \
mTask = name##TaskParent::Create(mFileSystem, p, this, rv); \
if (NS_WARN_IF(rv.Failed())) { \
rv.SuppressException(); \
return false; \
} \
break; \

View File

@ -150,6 +150,7 @@ FileSystemTaskChildBase::Start()
ErrorResult rv;
FileSystemParams params = GetRequestParams(serialization, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return;
}

View File

@ -508,7 +508,9 @@ GetDOMFileOrDirectoryName(const OwningFileOrDirectory& aData,
MOZ_ASSERT(aData.IsDirectory());
ErrorResult rv;
aData.GetAsDirectory()->GetName(aName, rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
}
}

View File

@ -859,6 +859,7 @@ CreateBlobImpl(const nsTArray<BlobData>& aBlobDatas,
}
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return nullptr;
}
@ -4394,6 +4395,7 @@ BlobParent::RecvGetFilePath(nsString* aFilePath)
ErrorResult rv;
mBlobImpl->GetMozFullPathInternal(filePath, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}

View File

@ -3335,6 +3335,7 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
ErrorResult rv;
aInitialData->Write(jsapi.cx(), init, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
}

View File

@ -220,6 +220,7 @@ TabChildBase::DispatchMessageManagerMessage(const nsAString& aMessageName,
ErrorResult rv;
data.Write(cx, json, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return;
}
}

View File

@ -157,6 +157,7 @@ public:
AudioBuffer::Create(context, mNumberOfChannels, mLength, mSampleRate,
mBuffer.forget(), rv);
if (rv.Failed()) {
rv.SuppressException();
return;
}

View File

@ -432,6 +432,7 @@ private:
aNode->BufferSize(), context->SampleRate(),
mInputBuffer.forget(), rv);
if (rv.Failed()) {
rv.SuppressException();
return nullptr;
}
}

View File

@ -274,7 +274,10 @@ TCPSocketParent::RecvStartTLS()
NS_ENSURE_TRUE(mSocket, true);
ErrorResult rv;
mSocket->UpgradeToSecure(rv);
NS_ENSURE_FALSE(rv.Failed(), true);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
return true;
}
@ -292,7 +295,10 @@ TCPSocketParent::RecvResume()
NS_ENSURE_TRUE(mSocket, true);
ErrorResult rv;
mSocket->Resume(rv);
NS_ENSURE_FALSE(rv.Failed(), true);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
return true;
}

View File

@ -116,7 +116,9 @@ PerformanceObserver::Notify()
ErrorResult rv;
mCallback->Call(this, *list, *this, rv);
NS_WARN_IF(rv.Failed());
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
mQueuedEntries.Clear();
}

View File

@ -31,6 +31,7 @@ MMICall::MMICall(nsPIDOMWindowInner* aWindow, const nsAString& aServiceCode)
ErrorResult rv;
RefPtr<Promise> promise = Promise::Create(global, rv);
if (rv.Failed()) {
rv.SuppressException();
return;
}

View File

@ -238,6 +238,7 @@ TVTuner::CreateSimulatedMediaStream()
ElementCreationOptions options;
RefPtr<Element> element = doc->CreateElement(VIDEO_TAG, options, error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}
@ -253,11 +254,13 @@ TVTuner::CreateSimulatedMediaStream()
mediaElement->SetAutoplay(true, error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}
mediaElement->SetLoop(true, error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}
@ -293,6 +296,7 @@ TVTuner::CreateSimulatedMediaStream()
mediaElement->SetSrc(currentVideoBlobUrl, error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}
@ -300,6 +304,7 @@ TVTuner::CreateSimulatedMediaStream()
// http://www.w3.org/TR/mediacapture-fromelement/
RefPtr<DOMMediaStream> stream = mediaElement->MozCaptureStream(error);
if (NS_WARN_IF(error.Failed())) {
error.SuppressException();
return nullptr;
}

View File

@ -1565,6 +1565,7 @@ CacheCreator::DeleteCache()
// running.
RefPtr<Promise> promise = mCacheStorage->Delete(mCacheName, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return;
}

View File

@ -760,6 +760,7 @@ public:
RefPtr<ExtendableMessageEvent> event = ExtendableMessageEvent::Constructor(
aTarget, NS_LITERAL_STRING("message"), init, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
event->SetSource(client);
@ -6571,6 +6572,7 @@ WorkerPrivate::ConnectMessagePort(JSContext* aCx,
ErrorResult rv;
RefPtr<MessagePort> port = MessagePort::Create(globalScope, aIdentifier, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}

View File

@ -45,7 +45,13 @@ nsXULTemplateResultSetXML::HasMoreElements(bool *aResult)
// nodes, so just return false in this case.
ErrorResult rv;
uint32_t length = mResults->GetSnapshotLength(rv);
*aResult = !rv.Failed() && mPosition < length;
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
*aResult = false;
return NS_OK;
}
*aResult = mPosition < length;
return NS_OK;
}

View File

@ -59,6 +59,7 @@ nsAutoWindowStateHelper::DispatchEventToChrome(const char* aEventName)
ErrorResult rv;
RefPtr<Event> event = doc->CreateEvent(NS_LITERAL_STRING("Events"), rv);
if (rv.Failed()) {
rv.SuppressException();
return false;
}
event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), true, true);

View File

@ -267,6 +267,7 @@ nsFileControlFrame::DnDListener::IsValidDropData(nsIDOMDataTransfer* aDOMDataTra
ErrorResult rv;
RefPtr<DOMStringList> types = dataTransfer->GetTypes(rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}