Closed Bug 1688120 Opened 5 years ago Closed 4 years ago

XPCNativeInterface::NewInstance control flow could be improved

Categories

(Core :: XPConnect, task, P5)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: pbone, Assigned: pbone)

References

Details

Attachments

(3 files)

The control flow here https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCWrappedNativeInfo.cpp#206 isn't obvious (using a failed flag and and null/non-null-ness of obj. This function would be easier to read and would lead to less bugs like Bug 1686825 if it did return nullptr on failure with ScopeExit https://searchfox.org/mozilla-central/source/mfbt/ScopeExit.h

Severity: -- → N/A
Priority: -- → P5
Assignee: nobody → pbone
Status: NEW → ASSIGNED

Improve the control flow for early exits in NewInstance().

Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8c4499f7d11b Improve control-flow XPCNativeInterface::NewInstance r=peterv https://hg.mozilla.org/integration/autoland/rev/579413331263 Move some variable declarations closer to their uses r=peterv https://hg.mozilla.org/integration/autoland/rev/77247863a2ea Remove UB due to unnecessary integer conversion r=peterv
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: