Open Bug 2089957 Opened 17 days ago

Remove the dead aElement null check in UpdateFocusWithinState (nsFocusManager.cpp)

Categories

(Core :: DOM: Core & HTML, 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.

All three callers of the static UpdateFocusWithinState pass a non-null element (each checks it first), so aElement && in the condition below is dead. Drop it.

Current code:

  Document* document = aElement->GetComposedDoc();
  if (aElement && document) {
    if (nsPIDOMWindowOuter* window = document->GetWindow()) {

Link to the code:
https://searchfox.org/firefox-main/source/dom/base/nsFocusManager.cpp

To verify the fix:

./mach build
./mach test dom/base/test --headless

This was reported by Coverity Scan (CID 1679492). 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.

You need to log in before you can comment on or make changes to this bug.