Closed
Bug 552237
Opened 13 years ago
Closed 13 years ago
Move to FocusManager
Categories
(Camino Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: chris, Assigned: chris)
Details
(Whiteboard: [cm192test])
Attachments
(2 files, 2 obsolete files)
9.78 KB,
patch
|
stuart.morgan+bugzilla
:
superreview+
|
Details | Diff | Splinter Review |
712 bytes,
patch
|
stuart.morgan+bugzilla
:
superreview+
|
Details | Diff | Splinter Review |
nsIFocusController is out, and nsIFocusManager is in. There are a few places where we need to move to the new paradigm.
Assignee | ||
Comment 1•13 years ago
|
||
Use nsIFocusManager. Pretty much just an API change, with some Gecko macros thrown in for good measure.
Assignee: nobody → trendyhendy2000
Status: NEW → ASSIGNED
Attachment #432485 -
Flags: review?(nick.kreeger)
Updated•13 years ago
|
Attachment #432485 -
Attachment is patch: true
Attachment #432485 -
Attachment mime type: application/octet-stream → text/plain
Updated•13 years ago
|
Attachment #432485 -
Flags: review?(nick.kreeger) → review+
Comment 2•13 years ago
|
||
Comment on attachment 432485 [details] [diff] [review] Fix v1.1 Looks straight forward.
Assignee | ||
Updated•13 years ago
|
Attachment #432485 -
Flags: superreview?(stuart.morgan+bugzilla)
Assignee | ||
Comment 3•13 years ago
|
||
Turns out it's easy to hang the browser with Fix v1.1. SRT: 1. Open http://caminobrowser.org/help/ 2. Cmd-click on the "Camino forum" link to open it in a new foreground tab 3. When loaded, press spacebar The problem comes from the fact that GetFocusedWindow() always returns NS_OK, even when the focused window is null. NS_ENSURE_SUCCESS always succeeds, and we end up dereferencing a null pointer. This new patch uses NS_ENSURE_TRUE instead. It also removes the useless check after calling GetDesignMode.
Attachment #432485 -
Attachment is obsolete: true
Attachment #432967 -
Flags: superreview?(stuart.morgan+bugzilla)
Attachment #432485 -
Flags: superreview?(stuart.morgan+bugzilla)
Comment 4•13 years ago
|
||
Yeah, that's the sort of thing that has encouraged me to always ignore rv and check pointers instead :P
Comment 5•13 years ago
|
||
Comment on attachment 432967 [details] [diff] [review] Fix v1.2 >+#include "nsServiceManagerUtils.h" Add this in alphabetical order, like the rest of the includes already are (or is there a broken core header dependency that you are working around?) >+ nsCOMPtr<nsIDOMElement> focusedElement; >+ rv = fm->GetFocusedElement(getter_AddRefs(focusedElement)); >+ NS_ENSURE_SUCCESS(rv, nsnull); Guess what else always returns NS_OK! Although in this case it shouldn't matter it's (currently at least) only used for a do_QI New rule, now that I've been reminded why I didn't like this style: if you want to have NS_ENSURE_SUCCESS checks on everything for extra debug info, that's fine, but any pointer you are going to dereference must be explicitly checked, because that can never lie. It would be great if you could make a patch for your other recent changes that used this pattern, as I'm now concerned we may have introduced latent or edge-cases crashers. >+ if (designMode.EqualsLiteral("on")) >+ isFocused = YES; It's weird to mix the early-return style you've switched to with an only-return-at-the-end top level structure. I'm fine with the early return, but make it consistent throughout the method: change all other instances of |isFocused = foo;| to |return foo;|, remove the variable, and make the last statement |return NO;|
Attachment #432967 -
Flags: superreview?(stuart.morgan+bugzilla) → superreview-
(In reply to comment #5) > because that can never lie. It would be great if you could make a patch for > your other recent changes that used this pattern, as I'm now concerned we may > have introduced latent or edge-cases crashers. Bug 553864.
Assignee | ||
Comment 7•13 years ago
|
||
Fix with added macros and sr comments addressed.
Attachment #432967 -
Attachment is obsolete: true
Attachment #434091 -
Flags: superreview?(stuart.morgan+bugzilla)
Comment 8•13 years ago
|
||
Comment on attachment 434091 [details] [diff] [review] Fix v1.3 sr=smorgan. Thanks for reworking the checks, and sorry I didn't remember some important details when you first asked about the macro use!
Attachment #434091 -
Flags: superreview?(stuart.morgan+bugzilla) → superreview+
Comment 9•13 years ago
|
||
Actually, one more thing that just occurred to me: have you tested that everything you are ENSURE-ing is an error condition? For example: + nsCOMPtr<nsIEditingSession> editSession = do_GetInterface(docshell, &rv); + NS_ENSURE_SUCCESS(rv, NULL); If there's no edit in progress, can this be NULL without that being an error? Or + fm->GetFocusedElement(getter_AddRefs(focusedElement)); + NS_ENSURE_TRUE(focusedElement, nsnull); when nothing is focused? We don't want error spew every time we check for a condition that just doesn't happen to be true.
Assignee | ||
Comment 10•13 years ago
|
||
The editSession object is fine, but focusedElement can frequently be null. This followup patch just returns nsnull in that case, without logging.
Attachment #434752 -
Flags: superreview?(stuart.morgan+bugzilla)
Comment on attachment 434091 [details] [diff] [review] Fix v1.3 Pushed this to the test repo: http://hg.mozilla.org/users/alqahira_ardisson.org/camino-1.9.2-test/rev/606940ab4576 We now build out of the box :-)
Comment 12•13 years ago
|
||
Comment on attachment 434752 [details] [diff] [review] Followup to deal with focusedElement sr=smorgan
Attachment #434752 -
Flags: superreview?(stuart.morgan+bugzilla) → superreview+
Follow-up landed in the test repo: http://hg.mozilla.org/users/alqahira_ardisson.org/camino-1.9.2-test/rev/7801cdbe96a0
And I forgot to mark I had landed these :(
Whiteboard: [cm192test]
http://hg.mozilla.org/camino/rev/5b0a589f113f and, for the follow-up, http://hg.mozilla.org/camino/rev/777a3f1aa248
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•