Closed Bug 1651578 Opened 4 years ago Closed 4 years ago

Missing "else" in nsMozIconURI::QueryInterface()

Categories

(Core :: Graphics: ImageLib, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: izbyshev, Assigned: ckerschb)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

@Christoph: I think the code still executes as expected, but since the macros add the else it would be consistent.

Flags: needinfo?(ckerschb)
Severity: -- → S4
Priority: -- → P4

I'm not familiar with XPCOM and FF codebase, but without else foundInterface is always overwritten by subsequent if/else statements. So even if it's not a bug, it looks strange.

I don't think the missing else is a bug. Taking a closer look, the following statement:

if (aIID.Equals(kThisIconURIImplementationCID))
foundInterface = static_cast<nsIURI*>(this);
NS_INTERFACE_MAP_ENTRY(nsIMozIconURI)

When following the macro translation chain of NS_IMPL_QUERY_BODY will be translated to.

if (aIID.Equals(kThisIconURIImplementationCID))
foundInterface = static_cast<nsIURI*>(this);
if (aIID.Equals(NS_GET_IID(_interface)))
foundInterface = static_cast<_interface*>(this);
else

In other words, having an if instead of an else if will not influence the result here.

However, I realized we have a duplicate entry for NS_INTERFACE_MAP_ENTRY(nsIMozIconURI) which I think was a mistake of Bug 1583044. Since we are already on it, we can add that else statement so it's more consistent with other code in the tree, e..g within NullPrincipalURI.

Assignee: nobody → ckerschb
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(ckerschb)
Pushed by mozilla@christophkerschbaumer.com:
https://hg.mozilla.org/integration/autoland/rev/6d0ef7321d81
Eliminate duplicate entry of nsIMozIconURI within nsIconURI and add and 'else' to be concistent with other code in the tree. r=valentin
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: