Closed Bug 1175442 Opened 4 years ago Closed 4 years ago

nsContentUtils::SendKeyEvent() should take nsIWidget* rather than nsCOMPtr<nsIWidget> at its first argument

Categories

(Core :: User events and focus handling, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

nsContentUtils::SendKeyEvent() is defined as:

> 2360   static nsresult SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
> 2361                                const nsAString& aType,
> 2362                                int32_t aKeyCode,
> 2363                                int32_t aCharCode,
> 2364                                int32_t aModifiers,
> 2365                                uint32_t aAdditionalFlags,
> 2366                                bool* aDefaultActionTaken);

However, this means that the caller needs to create a local variable of nsCOMPtr<nsIWidget> if the caller has a pointer to an nsIWidget derived class. So, it should be nsIWidget* for allowing to accept all nsIWidget derived classes.
Attached patch PatchSplinter Review
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Attachment #8623627 - Flags: review?(bugs)
Attachment #8623627 - Flags: review?(bugs) → review+
Blocks: 1152479
Out of interest, what about SendMouseEvent?
(In reply to neil@parkwaycc.co.uk from comment #3)
> Out of interest, what about SendMouseEvent?

I'm not sure. It takes nsCOMPtr<nsIPresShell>, but its concrete class is only PresShell and I don't see such code which holds with nsRefPtr. But if some callers making nsCOMPtr<nsIPresShell> from raw pointer (nsIPresShell*), we should do that too.
https://hg.mozilla.org/mozilla-central/rev/328551ccf9ee
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.