Bug 1193762 part 4 - Avoid nsCOMPtr in ternary operator; r=froydnj

This commit is contained in:
Aryeh Gregor 2016-05-01 21:29:22 +03:00
parent c3a56bf17e
commit 585263dafa
7 changed files with 39 additions and 9 deletions

View File

@ -159,7 +159,10 @@ public:
// nullptr if the import is not yet ready.
nsIDocument* GetImport()
{
return mReady ? mDocument : nullptr;
if (!mReady) {
return nullptr;
}
return mDocument;
}
// There is only one referring link that is marked as primary link per
@ -170,7 +173,10 @@ public:
// a new import link is added to the manager.
nsINode* GetMainReferrer()
{
return mLinks.IsEmpty() ? nullptr : mLinks[mMainReferrer];
if (mLinks.IsEmpty()) {
return nullptr;
}
return mLinks[mMainReferrer];
}
// An import is not only blocked by its import children, but also

View File

@ -52,7 +52,10 @@ public:
static nsIGlobalObject* IncumbentGlobal() {
ScriptSettingsStackEntry *entry = Top();
return entry ? entry->mGlobalObject : nullptr;
if (!entry) {
return nullptr;
}
return entry->mGlobalObject;
}
static ScriptSettingsStackEntry* EntryPoint() {
@ -70,7 +73,10 @@ public:
static nsIGlobalObject* EntryGlobal() {
ScriptSettingsStackEntry *entry = EntryPoint();
return entry ? entry->mGlobalObject : nullptr;
if (!entry) {
return nullptr;
}
return entry->mGlobalObject;
}
};

View File

@ -2085,7 +2085,10 @@ nsIScriptContext *
nsGlobalWindow::GetScriptContext()
{
nsGlobalWindow* outer = GetOuterWindowInternal();
return outer ? outer->mContext : nullptr;
if (!outer) {
return nullptr;
}
return outer->mContext;
}
JSObject *

View File

@ -548,7 +548,10 @@ nsXMLHttpRequest::GetResponseXML(ErrorResult& aRv)
mWarnAboutSyncHtml = false;
LogMessage("HTMLSyncXHRWarning", GetOwner());
}
return (XML_HTTP_REQUEST_DONE & mState) ? mResponseXML : nullptr;
if (!(XML_HTTP_REQUEST_DONE & mState)) {
return nullptr;
}
return mResponseXML;
}
/*

View File

@ -324,7 +324,11 @@ nsEditorEventListener::GetFocusedRootContent()
nsIDocument* composedDoc = focusedContent->GetComposedDoc();
NS_ENSURE_TRUE(composedDoc, nullptr);
return composedDoc->HasFlag(NODE_IS_EDITABLE) ? nullptr : focusedContent;
if (composedDoc->HasFlag(NODE_IS_EDITABLE)) {
return nullptr;
}
return focusedContent;
}
bool

View File

@ -465,7 +465,10 @@ public:
inline nsIXPCFunctionThisTranslator* Find(REFNSIID iid)
{
auto entry = static_cast<Entry*>(mTable.Search(&iid));
return entry ? entry->value : nullptr;
if (!entry) {
return nullptr;
}
return entry->value;
}
inline nsIXPCFunctionThisTranslator* Add(REFNSIID iid,

View File

@ -191,7 +191,12 @@ public:
*/
static void EndSwapDocShells(nsISupports* aSupports, void*);
nsIWidget* GetWidget() override { return mInnerView ? mWidget : nullptr; }
nsIWidget* GetWidget() override {
if (!mInnerView) {
return nullptr;
}
return mWidget;
}
/**
* Adjust the plugin's idea of its size, using aSize as its new size.