mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1338086 - Remove useless else blocks in order to reduce complexity in dom/base/ r=Ehsan
MozReview-Commit-ID: 5sCNbqC4ew3 --HG-- extra : rebase_source : ca9b4b02d3f438cf7e907bf0c32623d7ab9e6bc9
This commit is contained in:
parent
92ed0479a5
commit
9a3ff09f1a
@ -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<nsIContent*>(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<typename StringType, typename CharType>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<nsIRunnable> task =
|
||||
new FullscreenTransitionTask(duration, aWindow, aFullscreen,
|
||||
widget, nullptr, transitionData);
|
||||
task->Run();
|
||||
return true;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> 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,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user