Closed Bug 518546 Opened 15 years ago Closed 15 years ago

Noticeable delay when typing in the address bar (Snow Leopard)

Categories

(Firefox :: General, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: joelr, Assigned: joelr)

References

Details

Attachments

(2 files)

Try opening a new tab, switching to the address bar and holding down a key for a couple of seconds.

The delay almost disappears after a couple of seconds but try holding down the backspace key and you will see the delay again once there are 2-3 letters left.
I think this might be related to the tons of CoreGraphics call failures dumping to stdout/stderr when this happens. Seems like something is wrong with the awesome bar window, it never comes up during this typing.

I also got a shutdown crash in sqlite, so something could be wrong with the database.
Assignee: nobody → joelr
Thu Sep 24 19:52:12 biggie.local firefox-bin[37220] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Thu Sep 24 19:52:12 biggie.local firefox-bin[37220] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

Breakpoint 1, 0x00007fff84888997 in CGErrorBreakpoint ()
(gdb) where
#0  0x00007fff84888997 in CGErrorBreakpoint ()
#1  0x00007fff849121b7 in CGSGlobalErrorv ()
#2  0x00007fff84732085 in _CGSFindSharedWindow ()
#3  0x00007fff84720907 in _CGSWindowByID ()
#4  0x00007fff847ac62d in CGSGetWindowEventMask ()
#5  0x00007fff810a308e in _NSEnableMouseMovedEventsForWindow ()
#6  0x00007fff810a3014 in -[NSWindow setAcceptsMouseMovedEvents:] ()
#7  0x000000010140b284 in nsCocoaWindow::Show (this=0x11c490420, bState=1) at ../../../../mozilla-central/widget/src/cocoa/nsCocoaWindow.mm:666
#8  0x0000000100a6cd7d in nsView::NotifyEffectiveVisibilityChanged (this=0x11c471d40, aEffectivelyVisible=1) at ../../../mozilla-central/view/src/nsView.cpp:454
#9  0x0000000100a6cdfa in nsView::SetVisibility (this=<value temporarily unavailable, due to optimizations>, aVisibility=<value temporarily unavailable, due to optimizations>) at ../../../mozilla-central/view/src/nsView.cpp:473
#10 0x0000000100a73cc8 in nsViewManager::IsViewInserted () at /Users/joelr/Work/mozilla/mozilla-central/view/src/nsViewManager.cpp:1522
#11 0x0000000100a73cc8 in nsViewManager::SetViewVisibility (this=0x116df8700, aView=0x11c471d40, aVisible=nsViewVisibility_kShow) at ../../../mozilla-central/view/src/nsViewManager.cpp:1524
#12 0x0000000100697942 in nsMenuPopupFrame::AdjustView (this=0x10414be50) at ../../../../../mozilla-central/layout/xul/base/src/nsMenuPopupFrame.cpp:378
#13 0x00000001006a4365 in ~nsRect [inlined] () at /Users/joelr/Work/mozilla/debug/dist/include/nsRect.h:215
#14 0x00000001006a4365 in nsPopupSetFrame::DoLayout (this=<value temporarily unavailable, due to optimizations>, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsPopupSetFrame.cpp:215
#15 0x00000001006641db in nsBox::EndLayout () at /Users/joelr/Work/mozilla/mozilla-central/layout/xul/base/src/nsBox.cpp:543
#16 0x00000001006641db in nsIFrame::Layout (this=0x10430afe8, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsBox.cpp:545
#17 0x000000010066cc23 in nsSprocketLayout::Layout (this=0x117a9b270, aBox=0x1042c1b70, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsSprocketLayout.cpp:523
#18 0x00000001006678eb in nsBoxLayoutState::SetLayoutFlags () at /Users/joelr/Work/mozilla/mozilla-central/layout/xul/base/src/nsBoxLayoutState.h:938
#19 0x00000001006678eb in nsBoxFrame::DoLayout (this=0x831a907effffffff, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsBoxFrame.cpp:940
#20 0x00000001006641db in nsBox::EndLayout () at /Users/joelr/Work/mozilla/mozilla-central/layout/xul/base/src/nsBox.cpp:543
#21 0x00000001006641db in nsIFrame::Layout (this=0x1042c1b70, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsBox.cpp:545
#22 0x000000010066e26f in nsStackLayout::Layout (this=<value temporarily unavailable, due to optimizations>, aBox=0x1042c1a18, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsStackLayout.cpp:342
#23 0x00000001006678eb in nsBoxLayoutState::SetLayoutFlags () at /Users/joelr/Work/mozilla/mozilla-central/layout/xul/base/src/nsBoxLayoutState.h:938
#24 0x00000001006678eb in nsBoxFrame::DoLayout (this=0x831a907effffffff, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsBoxFrame.cpp:940
#25 0x00000001006641db in nsBox::EndLayout () at /Users/joelr/Work/mozilla/mozilla-central/layout/xul/base/src/nsBox.cpp:543
#26 0x00000001006641db in nsIFrame::Layout (this=0x1042c1a18, aState=@0x7fff5fbfb8c0) at ../../../../../mozilla-central/layout/xul/base/src/nsBox.cpp:545
#27 0x000000010066810e in nsBoxFrame::Reflow (this=0x1042c1a18, aPresContext=<value temporarily unavailable, due to optimizations>, aDesiredSize=@0x7fff5fbfbc30, aReflowState=@0x7fff5fbfbb40, aStatus=@0x7fff5fbfbed8) at ../../../../../mozilla-central/layout/xul/base/src/nsBoxFrame.cpp:749
#28 0x0000000100460b38 in nsContainerFrame::ReflowChild (this=<value temporarily unavailable, due to optimizations>, aKidFrame=0x1042c1a18, aPresContext=0x116df7900, aDesiredSize=@0x7fff5fbfbc30, aReflowState=@0x7fff5fbfbb40, aX=0, aY=0, aFlags=0, aStatus=@0x7fff5fbfbed8, aTracker=0x0) at ../../../mozilla-central/layout/generic/nsContainerFrame.cpp:792
#29 0x00000001005141a2 in ViewportFrame::Reflow (this=0x1042c1488, aPresContext=0x116df7900, aDesiredSize=@0x7fff5fbfbe20, aReflowState=@0x7fff5fbfbd30, aStatus=@0x7fff5fbfbed8) at ../../../mozilla-central/layout/generic/nsViewportFrame.cpp:285
#30 0x0000000100410ccc in PresShell::DoReflow (this=0x116df92d0, target=0x1042c1488, aInterruptible=1) at ../../../mozilla-central/layout/base/nsPresShell.cpp:7278
#31 0x000000010041b68e in PresShell::ProcessReflowCommands (this=0x116df92d0, aInterruptible=1) at ../../../mozilla-central/layout/base/nsPresShell.cpp:7408
#32 0x000000010042b4cd in PresShell::FlushPendingNotifications (this=0x116df92d0, aType=<value temporarily unavailable, due to optimizations>) at ../../../mozilla-central/layout/base/nsPresShell.cpp:4885
#33 0x0000000100a79518 in nsCOMPtr<nsIViewManager>::get () at /Users/joelr/Work/mozilla/debug/dist/include/nsCOMPtr.h:974
#34 0x0000000100a79518 in nsCOMPtr<nsIViewManager>::operator nsIViewManager* () at ../../../mozilla-central/view/src/nsViewManager.cpp:790
#35 0x0000000100a79518 in nsIViewManager::UpdateViewBatch::EndUpdateViewBatch () at /Users/joelr/Work/mozilla/debug/dist/include/nsIViewManager.h:372
#36 0x0000000100a79518 in nsViewManager::DispatchEvent (this=0x116df8700, aEvent=0x7fff5fbfc330, aView=0x116df8780, aStatus=<value temporarily unavailable, due to optimizations>) at nsIViewManager.h:975
#37 0x0000000100a6b537 in ~nsCOMPtr [inlined] () at /Users/joelr/Work/mozilla/debug/dist/include/nsCOMPtr.h:167
#38 0x0000000100a6b537 in HandleEvent (aEvent=0x7fff5fbfc330) at ../../../mozilla-central/view/src/nsView.cpp:167
#39 0x0000000101416433 in nsChildView::DispatchEvent (this=0x116df8820, event=0x7fff5fbfc330, aStatus=@0x7fff5fbfc2bc) at ../../../../mozilla-central/widget/src/cocoa/nsChildView.mm:1986
#40 0x000000010140db75 in nsChildView::DispatchWindowEvent (this=<value temporarily unavailable, due to optimizations>, event=<value temporarily unavailable, due to optimizations>) at ../../../../mozilla-central/widget/src/cocoa/nsChildView.mm:1994
#41 0x0000000101418ad9 in -[ChildView drawRect:] (self=0x116df8920, _cmd=<value temporarily unavailable, due to optimizations>, aRect={origin = {x = 266, y = 12}, size = {width = 2, height = 15}}) at ../../../../mozilla-central/widget/src/cocoa/nsChildView.mm:2711
#42 0x00007fff80ff443a in -[NSView _drawRect:clip:] ()
#43 0x00007fff80ff1c10 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#44 0x00007fff80ff259b in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#45 0x00007fff80ff259b in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#46 0x00007fff80ff11f3 in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#47 0x00007fff80feda97 in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#48 0x00007fff80f67237 in -[NSView displayIfNeeded] ()
#49 0x00007fff80f620e3 in _handleWindowNeedsDisplay ()
#50 0x00007fff87c18437 in __CFRunLoopDoObservers ()
#51 0x00007fff87bf46e4 in __CFRunLoopRun ()
#52 0x00007fff87bf403f in CFRunLoopRunSpecific ()
#53 0x00007fff8626bc4e in RunCurrentEventLoopInMode ()
#54 0x00007fff8626b9b1 in ReceiveNextEventCommon ()
#55 0x00007fff8626b90c in BlockUntilNextEventMatchingListInMode ()
#56 0x00007fff80f37520 in _DPSNextEvent ()
#57 0x00007fff80f36e89 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#58 0x00007fff80efca7d in -[NSApplication run] ()
#59 0x0000000101401723 in nsAppShell::Run (this=0x103858780) at ../../../../mozilla-central/widget/src/cocoa/nsAppShell.mm:766
#60 0x00000001010feeee in nsAppStartup::Run (this=0x103865200) at ../../../../../mozilla-central/toolkit/components/startup/src/nsAppStartup.cpp:182
#61 0x0000000100021e5f in XRE_main (argc=<value temporarily unavailable, due to optimizations>, argv=<value temporarily unavailable, due to optimizations>, aAppData=<value temporarily unavailable, due to optimizations>) at ../../../mozilla-central/toolkit/xre/nsAppRunner.cpp:3418
#62 0x0000000100001072 in main (argc=5, argv=0x7fff5fbff2c0) at ../../../mozilla-central/browser/app/nsBrowserApp.cpp:156
Setting the window id back to windowNumber does not appear to take hold after we set it to -1

http://mxr.mozilla.org/mozilla-central/source/widget/src/cocoa/nsCocoaWindow.mm#633

First, I'll investigate whether -1 is needed at all.
> First, I'll investigate whether -1 is needed at all.

You might also check whether removing popup windows from the window cache (on window hide) and adding them back (on window show) is still necessary.

This was needed to fix an Apple bug (as explained in the comments).  But it may no longer be necessary.  Search on "window cache" in nsCocoaWindow::Show().
Another wild guess: Maybe this is related to the fact that we're showing the window during drawRect:. Does the patch in bug 517804 fix it?
One more thing:

Currently the declaration of the [NSWindow _setWindowNumber:] method is as follows (in nsCocoaWindow.h) -- it's aNumber parameter is in 'int'.

- (void)_setWindowNumber:(int)aNumber;

But this should probably be changed as follows to accommodate 64-bit mode:

- (void)_setWindowNumber:(NSInteger)aNumber;

The documented [NSWindow windowNumber] method is now defined as follows:

- (NSInteger)windowNumber;
In other words, the call to [NSWindow _setWindowNumber:] might have been failing because it was sending its 'aNumber' parameter ('-1') as an 'int' even in 64-bit mode, and not sign-extending it to a 'long long'.
I'm putting an ifdef in to make it NSInteger on x86-64 and putting that -1 back. Will report results.
Is the following enough?

#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) &&  __LP64__
You don't need the macro.  NSInteger already is a macro, which is interpreted differently in 32-bit mode and 64-bit mode.

> int windowNumber = [mWindow windowNumber];

This will of course also need to be changed to:

NSInteger windowNumber = [mWindow windowNumber];
> You don't need the macro.

You don't need the #ifdef.
I have a hunch that the #ifdef will be needed for 10.4 but I may be wrong.
> I have a hunch that the #ifdef will be needed for 10.4

I don't think so.  We've long used NSInteger and NSUInteger in the code, and we'd have heard about it if they didn't compile on 10.4.

For that matter I've long used the 10.4 SDK on 10.5, with no problems.
NSInteger is right on the money and I don't see any CG errors now.

The promotion of -1 was just fine. Grabbing
the window id into an int and promoting it back to long long when setting it
back wasn't.
None of my saved tabs load after my recent pull but that's a different matter :D.
Don't forget to post your patch :-)
Will post a patch... just as soon as I figure out how to produce a proper one for hg using 'git diff' :D.

Waiting for the hg clone of mozilla-central to finish.
Attachment #402689 - Flags: review?(smichaud)
Attachment #402689 - Flags: review?(smichaud) → review+
Keywords: checkin-needed
The auto-completion drop-down window does come up when I type a letter.
pushed to mozilla-central

http://hg.mozilla.org/mozilla-central/rev/cb9c62cc27dc
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: