[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 18/34: Bug 1753298 - Improve error handling in BaseMediaResource::ModifyLoadFlags. r=padenot, a=dsmith
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9esr-11.0-1
in repository tor-browser.
commit adbcbe5ad63ba5fdbd1da8790a13ba08624de696
Author: Matthew Gregan <kinetik@xxxxxxxx>
AuthorDate: Sat Apr 16 05:30:17 2022 +0000
Bug 1753298 - Improve error handling in BaseMediaResource::ModifyLoadFlags. r=padenot,a=dsmith
Differential Revision: https://phabricator.services.mozilla.com/D143863
---
dom/media/BaseMediaResource.cpp | 17 ++++++++++-------
dom/media/BaseMediaResource.h | 2 +-
dom/media/ChannelMediaResource.cpp | 2 +-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dom/media/BaseMediaResource.cpp b/dom/media/BaseMediaResource.cpp
index 181668f4dc270..e5ba50109a1f9 100644
--- a/dom/media/BaseMediaResource.cpp
+++ b/dom/media/BaseMediaResource.cpp
@@ -136,24 +136,25 @@ void BaseMediaResource::SetLoadInBackground(bool aLoadInBackground) {
} else {
loadFlags &= ~nsIRequest::LOAD_BACKGROUND;
}
- ModifyLoadFlags(loadFlags);
+ Unused << NS_WARN_IF(NS_FAILED(ModifyLoadFlags(loadFlags)));
}
}
-void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
+nsresult BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
nsCOMPtr<nsILoadGroup> loadGroup;
nsresult rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
MOZ_ASSERT(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
- nsresult status;
- mChannel->GetStatus(&status);
-
bool inLoadGroup = false;
if (loadGroup) {
+ nsresult status;
+ mChannel->GetStatus(&status);
+
rv = loadGroup->RemoveRequest(mChannel, nullptr, status);
- if (NS_SUCCEEDED(rv)) {
- inLoadGroup = true;
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
}
+ inLoadGroup = true;
}
rv = mChannel->SetLoadFlags(aFlags);
@@ -163,6 +164,8 @@ void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags) {
rv = loadGroup->AddRequest(mChannel, nullptr);
MOZ_ASSERT(NS_SUCCEEDED(rv), "AddRequest() failed!");
}
+
+ return NS_OK;
}
} // namespace mozilla
diff --git a/dom/media/BaseMediaResource.h b/dom/media/BaseMediaResource.h
index 3c2e2419a82b2..29cde01e8c59c 100644
--- a/dom/media/BaseMediaResource.h
+++ b/dom/media/BaseMediaResource.h
@@ -127,7 +127,7 @@ class BaseMediaResource : public MediaResource,
// Set the request's load flags to aFlags. If the request is part of a
// load group, the request is removed from the group, the flags are set, and
// then the request is added back to the load group.
- void ModifyLoadFlags(nsLoadFlags aFlags);
+ nsresult ModifyLoadFlags(nsLoadFlags aFlags);
RefPtr<MediaResourceCallback> mCallback;
diff --git a/dom/media/ChannelMediaResource.cpp b/dom/media/ChannelMediaResource.cpp
index ce35987e79747..7643ed249f0ff 100644
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -339,7 +339,7 @@ nsresult ChannelMediaResource::OnStopRequest(nsIRequest* aRequest,
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!");
if (loadFlags & nsIRequest::LOAD_BACKGROUND) {
- ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND);
+ Unused << NS_WARN_IF(NS_FAILED(ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND)));
}
// Note that aStatus might have succeeded --- this might be a normal close
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits