diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index f91542069534..d6bcba949147 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -1105,9 +1105,8 @@ nsContentUtils::ParseHTMLInteger(const nsAString& aValue, if (!value.isValid()) { result |= eParseHTMLInteger_Error | eParseHTMLInteger_ErrorOverflow; break; - } else { - foundValue = true; } + foundValue = true; } else if (*iter == char16_t('%')) { ++iter; result |= eParseHTMLInteger_IsPercent; @@ -4942,22 +4941,20 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, bool aDeep, return static_cast(aNode)->AppendTextTo(aResult, aFallible); } - else if (aDeep) { + if (aDeep) { return AppendNodeTextContentsRecurse(aNode, aResult, aFallible); } - else { - for (nsIContent* child = aNode->GetFirstChild(); - child; - child = child->GetNextSibling()) { - if (child->IsNodeOfType(nsINode::eTEXT)) { - bool ok = child->AppendTextTo(aResult, fallible); - if (!ok) { - return false; - } + + for (nsIContent* child = aNode->GetFirstChild(); + child; + child = child->GetNextSibling()) { + if (child->IsNodeOfType(nsINode::eTEXT)) { + bool ok = child->AppendTextTo(aResult, fallible); + if (!ok) { + return false; } } } - return true; } @@ -5756,9 +5753,8 @@ nsContentUtils::GetCurrentJSContextForThread() MOZ_ASSERT(IsInitialized()); if (MOZ_LIKELY(NS_IsMainThread())) { return GetCurrentJSContext(); - } else { - return workers::GetCurrentThreadJSContext(); } + return workers::GetCurrentThreadJSContext(); } template @@ -8690,9 +8686,11 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal, permissionManager->TestPermissionFromPrincipal(aPrincipal, "cookie", &perm); if (perm == nsIPermissionManager::DENY_ACTION) { return StorageAccess::eDeny; - } else if (perm == nsICookiePermission::ACCESS_SESSION) { + } + if (perm == nsICookiePermission::ACCESS_SESSION) { return std::min(access, StorageAccess::eSessionScoped); - } else if (perm == nsIPermissionManager::ALLOW_ACTION) { + } + if (perm == nsIPermissionManager::ALLOW_ACTION) { return access; } diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index bef0f96d807f..68f61f95096f 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -3707,10 +3707,8 @@ nsDOMWindowUtils::GetOMTAStyle(nsIDOMElement* aElement, cssValue->GetCssText(text, rv); aResult.Assign(text); return rv.StealNSResult(); - } else { - aResult.Truncate(); } - + aResult.Truncate(); return NS_OK; } diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index ebccf50c8598..1520dd882da9 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -802,9 +802,8 @@ nsFrameMessageManager::PrivateNoteIntentionalCrash() if (XRE_IsContentProcess()) { mozilla::NoteIntentionalCrash("tab"); return NS_OK; - } else { - return NS_ERROR_NOT_IMPLEMENTED; } + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index f379dcac707b..27a54099e13a 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6825,13 +6825,12 @@ MakeWidgetFullscreen(nsGlobalWindow* aWindow, FullscreenReason aReason, // most of the widget will be selected. if (!performTransition) { return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, nullptr); - } else { - nsCOMPtr task = - new FullscreenTransitionTask(duration, aWindow, aFullscreen, - widget, nullptr, transitionData); - task->Run(); - return true; } + nsCOMPtr task = + new FullscreenTransitionTask(duration, aWindow, aFullscreen, + widget, nullptr, transitionData); + task->Run(); + return true; } nsresult @@ -14550,10 +14549,9 @@ nsGlobalWindow::CreateImageBitmap(const ImageBitmapSource& aImage, if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout, aRv); - } else { - aRv.Throw(NS_ERROR_TYPE_ERR); - return nullptr; } + aRv.Throw(NS_ERROR_TYPE_ERR); + return nullptr; } // Helper called by methods that move/resize the window, diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index ad9c8dad30c3..02b28b6a13d2 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -1392,11 +1392,11 @@ nsImageLoadingContent::GetRegisteredFlagForRequest(imgIRequest* aRequest) { if (aRequest == mCurrentRequest) { return &mCurrentRequestRegistered; - } else if (aRequest == mPendingRequest) { - return &mPendingRequestRegistered; - } else { - return nullptr; } + if (aRequest == mPendingRequest) { + return &mPendingRequestRegistered; + } + return nullptr; } void diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 0c8144d9113c..f81f5d4e4a58 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -237,7 +237,8 @@ CheckPluginStopEvent::Run() LOG(("OBJLC [%p]: CheckPluginStopEvent - superseded in layout flush", this)); return NS_OK; - } else if (content->GetPrimaryFrame()) { + } + if (content->GetPrimaryFrame()) { LOG(("OBJLC [%p]: CheckPluginStopEvent - frame gained in layout flush", this)); objLC->mPendingCheckPluginStopEvent = nullptr; @@ -1033,10 +1034,9 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, } if (MakePluginListener()) { return mFinalListener->OnStartRequest(aRequest, nullptr); - } else { - NS_NOTREACHED("Failed to create PluginStreamListener, aborting channel"); - return NS_BINDING_ABORTED; } + NS_NOTREACHED("Failed to create PluginStreamListener, aborting channel"); + return NS_BINDING_ABORTED; } // Otherwise we should be state loading, and call LoadObject with the channel @@ -1069,7 +1069,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1); mContentBlockingEnabled = true; return NS_ERROR_FAILURE; - } else if (status == NS_ERROR_TRACKING_URI) { + } + if (status == NS_ERROR_TRACKING_URI) { mContentBlockingEnabled = true; return NS_ERROR_FAILURE; }