Closed Bug 372665 Opened 17 years ago Closed 17 years ago

Crash [@ PresShell::ScrollFrameIntoView] when focusing br during pageload

Categories

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

x86
Windows XP
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: martijn.martijn, Assigned: smaug)

References

Details

(Keywords: crash, testcase)

Crash Data

Attachments

(2 files, 2 obsolete files)

Attached file testcase
See testcase, you need to download the testcase locally to get the crash, because of the use of enhanced privileges.

Talkback ID: TB29934294Z
0x00000000
PresShell::ScrollFrameIntoView  [mozilla/layout/base/nspresshell.cpp, line 4017]
nsGenericElement::SetFocus  [mozilla/content/base/src/nsgenericelement.cpp, line 2133]
nsEventStateManager::ShiftFocusInternal  [mozilla/content/events/src/nseventstatemanager.cpp, line 3356]
nsEventStateManager::ShiftFocus  [mozilla/content/events/src/nseventstatemanager.cpp, line 3193]
nsEventStateManager::PostHandleEvent  [mozilla/content/events/src/nseventstatemanager.cpp, line 2237]
0x026a5360
0x8b57f685
Attached patch shows where the problem is (obsolete) — Splinter Review
I might even propose this as a fix, because the method is
ScrollFrameIntoView(nsIFrame *aFrame, ...) - if aFrame gets deleted
before scrolling, the method should not, IMO, do anything.
Perhaps for other cases we need ScrollContentIntoView(nsIContent* aContent, ...)
But why does FlushPendingNotifications(Flush_OnlyReflow) delete anything...
It looks to me like all callers would be OK with this becoming ScrollContentIntoView followed by applying this logic to the primary frame for the content. That would in fact simplify many callers.
(and of course we could hold a strong reference to the content and avoid using nsWeakFrame)
Comment on attachment 257385 [details] [diff] [review]
proposed patch

Ok, I'll make a new patch.
Attachment #257385 - Flags: superreview?(roc)
Attachment #257385 - Flags: review?(roc)
Maybe like this.
There are still some cases which need ScrollFrameIntoView and
and some cases where that just makes the code more readable, IMO.
But usually using ScrollContentIntoView makes code work more 
consistently.
I've also made presShell to be a strong ref in all cases where
ScrollContentIntoView is called.

If flushing removes presShell from document, that removes also
primaryframe and ScrollContentIntoView returns NS_ERROR_NULL_POINTER.
Attachment #257349 - Attachment is obsolete: true
Attachment #257385 - Attachment is obsolete: true
Attachment #257453 - Flags: review?(roc)
Who still needs to call ScrollFrameIntoView and why can't they call ScrollContentIntoView instead?
Some code in Accessibility, and some code in event listener manager
needs frames anyway, so I didn't want to change that.
Form elements use also (via layoututils) ScrollFrameIntoView.
Maybe a follow-up bug/patch to remove the rest of the uses of 
ScrollFrameIntoView - all those cases which aren't as trivial (and which 
need more testing) as in the current patch ?
Comment on attachment 257453 [details] [diff] [review]
ScrollContentIntoView

Yeah, OK. Let's do that followup bug though.
Attachment #257453 - Flags: superreview+
Attachment #257453 - Flags: review?(roc)
Attachment #257453 - Flags: review+
Blocks: 372797
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Verified fixed, using:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a3pre) Gecko/20070324 Minefield/3.0a3pre

(In reply to comment #10)
> (From update of attachment 257453 [details] [diff] [review])
> Yeah, OK. Let's do that followup bug though.

Was there a follow-up bug filed? Should there a follow-up bug be filed?

Status: RESOLVED → VERIFIED
(In reply to comment #11)
> Was there a follow-up bug filed? Should there a follow-up bug be filed?
> 

bug 372797

Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Assignee: events → Olli.Pettay
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Crash Signature: [@ PresShell::ScrollFrameIntoView]
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

Created:
Updated:
Size: