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

NEW
Assigned to

Status

()

Core
DOM
8 years ago
7 years ago

People

(Reporter: Jesse Ruderman, Assigned: Away for a while)

Tracking

(Blocks: 1 bug, {assertion, testcase})

Trunk
x86
Mac OS X
assertion, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

366 bytes, text/html
Details
(Reporter)

Description

8 years ago
Created attachment 441693 [details]
testcase

###!!! 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
(Reporter)

Comment 1

8 years ago
The testcase only triggers the assertion if the browser window does *not* have focus.  It reloads itself after 2 seconds to make testing easier.

Comment 2

8 years ago
Created attachment 456861 [details]
slightly simpler testcase

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

Comment 3

8 years ago
Created attachment 457113 [details]
the right testcase
Attachment #456861 - Attachment is obsolete: true
(Assignee)

Updated

8 years ago
Assignee: nobody → ehsan
(Reporter)

Comment 4

7 years ago
WFM?
(Assignee)

Comment 5

7 years ago
(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.
(Reporter)

Comment 6

7 years ago
Oh, I missed comment 1 ;)
You need to log in before you can comment on or make changes to this bug.