Closed Bug 302962 Opened 19 years ago Closed 19 years ago

When creating a new tab in Camino, gecko steals focus from the url bar (early activate/deactivate fails)

Categories

(Core :: DOM: Navigation, defect, P1)

PowerPC
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: sfraser_bugs, Assigned: sfraser_bugs)

References

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

When you make a new (empty) tab in recent camino builds, we focus the URL bar
explicitly, but the content area the steals focus from it, so you're left having
to refocus the url bar. This changed recently (I'm not sure why).

Some debugging shows that when we focus the URL bar, we are correctly
deactivating the content (via nsIWebBrowserFocus::Deactivate()), but this
happens early in loading, before we have a pres shell. Because of this,
nsWebBrowser::Deactivate() drops the deactivate on the floor.

I think this is wrong. If nsWebBrowser can get at a focus controller, it should
always pass on the Activate/Deactivate calls, even if we don't have a pres shell
yet. Currently nsGlobalWindow::Activate() NS_WARNS in that case, but it seems
legitimate to remove that.
Attached patch PatchSplinter Review
This patch simply removes the checks for non-null pres shell from the
nsWebBrowser Activate/Deactivate calls, and removes the NS_WARNING from
nsGlobalWindow if Activate() is called when the pres shell is null.
Attachment #191213 - Flags: superreview?(bryner)
Attachment #191213 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
Keywords: regression
Priority: -- → P1
Target Milestone: --- → Camino0.9
A regression window for this would be useful.
Comment on attachment 191213 [details] [diff] [review]
Patch

So... I'm not really qualified to review this; I have no real idea what any of
our focus code does.  That said, the nsGlobalWindow change is basically a no-op
(see http://lxr.mozilla.org/seamonkey/source/xpcom/glue/nsDebug.h#225).
Attachment #191213 - Flags: review?(bzbarsky) → review?(bryner)
One question I do have -- why was the check we're removing there in the first place?
The check was there to avoid an assertion in nsGlobalWindow::Activate (as noted
by the comment), which was then changed to a warning, which I here remove.
We already force the docshell to create an about:blank content viewer when you
ask for random things like the document, or call GetInterface with certain IIDs.
 I think we should instead make this more consistent so that it calls
EnsureContentViewer from GetPresContext, which will make sure that the pres
shell is non-null.
*** Bug 303295 has been marked as a duplicate of this bug. ***
Attached patch Patch to nsDochShell (obsolete) — Splinter Review
This patch changes nsDocShell::GetPresContext() to call EnsureContentViewer(),
as suggested by bryner.

This patch is independent of the previous one, which I think is still valid.
Attachment #191656 - Flags: review?(bryner)
This patch doesn't spit out assertions if GetPresContext() is called when the
docshell is being destroyed.
Attachment #191656 - Attachment is obsolete: true
Attachment #191662 - Flags: review?(bryner)
Attachment #191662 - Flags: review?(bryner) → review+
Attachment #191656 - Flags: review?(bryner)
Attachment #191213 - Flags: superreview?(bryner)
Attachment #191213 - Flags: superreview+
Attachment #191213 - Flags: review?(bryner)
Attachment #191213 - Flags: review+
Attachment #191662 - Flags: superreview+
Attachment #191213 - Flags: approval1.8b4?
Comment on attachment 191662 [details] [diff] [review]
Revised nsDocShell patch

This fixes a serious focus issue in Camino.
Attachment #191662 - Flags: approval1.8b4?
Attachment #191662 - Flags: approval1.8b4? → approval1.8b4+
Comment on attachment 191213 [details] [diff] [review]
Patch

Was this patch replaced by the other one, or do we need this one as well?
Attachment #191213 - Flags: approval1.8b4? → approval1.8b4+
Fixed.

Since the fix is in core, I'm going to move this bug to Core in case people want
to search for it.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Component: Page Layout → Embedding: Docshell
Flags: review+
Product: Camino → Core
Resolution: --- → FIXED
Summary: When creating a new tab, gecko steals focus from the url bar → When creating a new tab, gecko steals focus from the url bar (early activate/deactivate fails)
Target Milestone: Camino0.9 → mozilla1.8beta4
Version: unspecified → Trunk
Summary: When creating a new tab, gecko steals focus from the url bar (early activate/deactivate fails) → When creating a new tab in Camino, gecko steals focus from the url bar (early activate/deactivate fails)
(In reply to comment #13)
> is this related to bug 210373?

GtkMozEmbed doesn't use nsIWebBrowserFocus, and instead sets the focus
controller's active state directly, and [de]activates the nsIPIDOMWindow. See
http://lxr.mozilla.org/seamonkey/source/embedding/browser/gtk/src/EmbedPrivate.cpp#731
ToplevelFocus[In|Out] and ChildFocus[In|Out]. So it's probably not related. Bug
226708 discusses the origins of the problems with gtkmozembed focus.
It looks like the docShell changes caused a slight increase in pageload time on
btek (930 -> 940ms).

Bryner, do you still think that eagerly doing EnsureContentViewer is the right
thing?
It also increased Txul and Ts, see e.g. comet, monkey or luna.
Backing out the docShell change brought the numbers back down (and isn't
actually required to fix the bug). Should we leave it out?
This also increased leak numers on brad, and the backout brought them back to
where they were before...
I backed out the nsDocShell.cpp patch above The bug remains fixed, even without
this change.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: