Hmm, it's strange. Why sometimes failed to set focus? (or to set caret position in the div element?)
Sometimes I've seen weird behavior when you focus the contentWindow of an iframe but not the iframe itself. Could you please submit a patch to focus the iframe itself before focusing the contentWindow?
All of them failed at testing editor 4, I'll investigate it.
Created attachment 610470 [details] [diff] [review] Patch I think that I misunderstood the Element.focus() behavior. It shouldn't work with non-editing host element. But the test sets focus to its window, that causes sometimes working fine. I'm still not sure why it fails randomly, however, I think that setting focus to the editing host and setting caret position by document.getSelection().collapse(), it works fine. I tested on try server: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=1765e9b2e142
(In reply to TinderboxPushlog Robot from comment #37) > philor > https://tbpl.mozilla.org/php/getParsedLog.php?id=10480734&tree=Mozilla- > Inbound > Rev3 WINNT 5.1 mozilla-inbound pgo test mochitests-3/5 on 2012-03-29 12:29:47 This is before the landing.
(In reply to TinderboxPushlog Robot from comment #35) > philor > https://tbpl.mozilla.org/php/getParsedLog.php?id=10477412&tree=Mozilla- > Inbound > Rev3 WINNT 5.1 mozilla-inbound debug test mochitests-3/5 on 2012-03-29 > 10:10:45 This is also before the landing. If we saw this failure on m-i after now, the patch failed to fix this bug.