Open Bug 561940 Opened 14 years ago Updated 2 years ago

"ASSERTION: setting focus to a node from the wrong document" with <input type=file>, contentEditable

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: assertion, testcase)

Attachments

(1 file, 2 obsolete files)

Attached file testcase (obsolete) —
###!!! ASSERTION: setting focus to a node from the wrong document: '!aNode || aNode->GetCurrentDoc() == mDoc', file /Users/jruderman/mozilla-central/dom/base/nsGlobalWindow.cpp, line 6931
The testcase only triggers the assertion if the browser window does *not* have focus.  It reloads itself after 2 seconds to make testing easier.
Attached file slightly simpler testcase (obsolete) —
This testcase doesn't reload. What's happening here:

1. The <input type="file"> is focused with focus()
2. This causes the focus to be placed on the anonymous button inside it.
3. Setting contentEditable and flushing changes (by retrieving offsetHeight) causes the focused anonymous button to be removed from the document. Presumably, the anonymous content is regenerated. If I change the timeout, I can visibly see the focus ring disappear from the button when this happens.
4. However, the focus manager is not notified of content removal so assumes the button is still focused.

I assume somewhere code needs to be added to notify the focus manager when focused anonymous content is removed. I don't know where that would be.

Note that various warnings appear:

WARNING: NS_ENSURE_TRUE(mDoneSetup) failed: file /builds/moz2/working/editor/composer/src/nsEditingSession.cpp, line 561
WARNING: NS_ENSURE_TRUE(mBoundFrame) failed: file /builds/moz2/working/content/html/content/src/nsTextEditorState.cpp, line 1326
WARNING: NS_ENSURE_TRUE(mBoundFrame) failed: file /builds/moz2/working/content/html/content/src/nsTextEditorState.cpp, line 1326
Attachment #441693 - Attachment is obsolete: true
Attached file the right testcase
Attachment #456861 - Attachment is obsolete: true
Assignee: nobody → ehsan
WFM?
(In reply to comment #4)
> WFM?

Does it not trigger the assertion for you?  It does for me, if the browser window is not focused, as stated in comment 1.
Oh, I missed comment 1 ;)
Component: DOM → DOM: Core & HTML
Assignee: ehsan → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: