Open Bug 2089970 Opened 18 days ago Updated 18 days ago

Remove the dead aDragEvent null checks in nsBaseDragSession::InitWith*

Categories

(Core :: Widget, task)

task

Tracking

()

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

InitWithImage, InitWithSelection and InitWithRemoteImage each compute mSessionIsAsyncSynthesizedForTests = aDragEvent && .... The IDL says the drag event must be supplied and the callers already dereference it, so aDragEvent && is dead in all three. Replace it with a MOZ_ASSERT(aDragEvent) and drop the null test (one patch for the three functions).

Current code:

  mSessionIsAsyncSynthesizedForTests =
      aDragEvent &&
      aDragEvent->WidgetEventPtr()->mFlags.mIsAsyncSynthesizedForTests;

Link to the code:
https://searchfox.org/firefox-main/source/widget/nsBaseDragService.cpp

To verify the fix:

./mach build
./mach test widget/tests --headless

This was reported by Coverity Scan (CIDs 1695917, 1695919, 1695922). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Severity: -- → N/A
You need to log in before you can comment on or make changes to this bug.