зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1874010: Use NS_WARN_IF instead of MOZ_ALWAYS_SUCCEEDS for nsIURI creation error r=places-reviewers,mak
Differential Revision: https://phabricator.services.mozilla.com/D198517
This commit is contained in:
Родитель
d95f0435ca
Коммит
68fc95df81
|
@ -1115,14 +1115,14 @@ NotifyIconObservers::Run() {
|
|||
|
||||
nsCOMPtr<nsIURI> iconURI;
|
||||
if (!mIcon.spec.IsEmpty()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(iconURI), mIcon.spec));
|
||||
if (iconURI) {
|
||||
if (!NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(iconURI), mIcon.spec)))) {
|
||||
// Notify observers only if something changed.
|
||||
if (mIcon.status & ICON_STATUS_SAVED ||
|
||||
mIcon.status & ICON_STATUS_ASSOCIATED) {
|
||||
nsCOMPtr<nsIURI> pageURI;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(pageURI), mPage.spec));
|
||||
if (pageURI) {
|
||||
if (!NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(pageURI), mPage.spec)))) {
|
||||
// Invalide page-icon image cache, since the icon is about to change.
|
||||
nsFaviconService* favicons = nsFaviconService::GetFaviconService();
|
||||
MOZ_ASSERT(favicons);
|
||||
|
|
|
@ -582,8 +582,8 @@ class NotifyManyVisitsObservers : public Runnable {
|
|||
PRTime now = PR_Now();
|
||||
for (uint32_t i = 0; i < mPlaces.Length(); ++i) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), mPlaces[i].spec));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(uri), mPlaces[i].spec)))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
AddPlaceForNotify(mPlaces[i], events);
|
||||
|
@ -673,14 +673,14 @@ class NotifyPlaceInfoCallback : public Runnable {
|
|||
bool hasValidURIs = true;
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
if (!mPlace.referrerSpec.IsEmpty()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_NewURI(getter_AddRefs(referrerURI), mPlace.referrerSpec));
|
||||
hasValidURIs = !!referrerURI;
|
||||
hasValidURIs = !NS_WARN_IF(NS_FAILED(
|
||||
NS_NewURI(getter_AddRefs(referrerURI), mPlace.referrerSpec)));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), mPlace.spec));
|
||||
hasValidURIs = hasValidURIs && !!uri;
|
||||
hasValidURIs =
|
||||
hasValidURIs &&
|
||||
!NS_WARN_IF(NS_FAILED(NS_NewURI(getter_AddRefs(uri), mPlace.spec)));
|
||||
|
||||
nsCOMPtr<mozIPlaceInfo> place;
|
||||
if (mIsSingleVisit) {
|
||||
|
@ -1413,9 +1413,7 @@ void NotifyEmbedVisit(VisitData& aPlace,
|
|||
MOZ_ASSERT(NS_IsMainThread(), "Must be called on the main thread!");
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), aPlace.spec));
|
||||
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(NS_FAILED(NS_NewURI(getter_AddRefs(uri), aPlace.spec)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4202,13 +4202,12 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
|||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIURI> uri, faviconUri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), faviconEvent->mUrl));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(NS_FAILED(
|
||||
NS_NewURI(getter_AddRefs(uri), faviconEvent->mUrl)))) {
|
||||
continue;
|
||||
}
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_NewURI(getter_AddRefs(faviconUri), faviconEvent->mFaviconUrl));
|
||||
if (!faviconUri) {
|
||||
if (NS_WARN_IF(NS_FAILED(NS_NewURI(getter_AddRefs(faviconUri),
|
||||
faviconEvent->mFaviconUrl)))) {
|
||||
continue;
|
||||
}
|
||||
OnIconChanged(uri, faviconUri, faviconEvent->mPageGuid);
|
||||
|
@ -4221,8 +4220,8 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), visit->mUrl));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(uri), visit->mUrl)))) {
|
||||
continue;
|
||||
}
|
||||
OnVisit(uri, static_cast<int64_t>(visit->mVisitId),
|
||||
|
@ -4240,8 +4239,8 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
|||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (item->mItemType == nsINavBookmarksService::TYPE_BOOKMARK) {
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), item->mUrl));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(uri), item->mUrl)))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -4410,8 +4409,8 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), titleEvent->mUrl));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(uri), titleEvent->mUrl)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4430,8 +4429,8 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), removeEvent->mUrl));
|
||||
if (!uri) {
|
||||
if (NS_WARN_IF(
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(uri), removeEvent->mUrl)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче