Closed Bug 506637 Opened 15 years ago Closed 15 years ago

nsFocusController::GetControllers does not handle a null nsIFocusManager* fm well

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, crash)

Attachments

(1 file)

94 nsFocusController::GetControllers(nsIControllers** aResult)
95 {
99   nsCOMPtr<nsIDOMElement> focusedElement;
100   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
101   if (fm)
102     fm->GetFocusedElement(getter_AddRefs(focusedElement));

here we carefully checked for a null focusmanager, if it was null, then focusedElement will not be set to non null

so this condition will be false:
104   if (focusedElement) {
131   }
132   else {
and off we go to try to get a window:
133     nsCOMPtr<nsIDOMWindow> focusedWindow;
... from the null focus manager:
134     fm->GetFocusedWindow(getter_AddRefs(focusedWindow));
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #390911 - Flags: review?(Olli.Pettay)
Attachment #390911 - Flags: review?(Olli.Pettay) → review+
Flags: wanted1.9.2?
http://hg.mozilla.org/mozilla-central/rev/ddf35389f5a4
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
I believe this issue exists on 1.9.2 as well? Crash fix, wanted?
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: