Comment 129 for bug 134813

Revision history for this message
In , Cristian Klein (cristiklein) wrote :

(In reply to comment #52)
> (In reply to comment #44)
> > Created an attachment (id=420945) [details] [details]
> > Mochitest for this bug.
> >
> > This test contains a textarea with three lines of misspelled words. Using only
> > synthesized keyboard events it tries to correct the word in the middle. At the
> > end, it checks whether the content of the textarea is the expected one.
> >
> > This test requires focus, or else, it won't even finish. :(
>
> EventUtils has "waitForFocus" for that.
>
> + /* Correct "hellow" */
> + synthesizeMouse(ta, 0, 0, { type : "contextmenu" });
> + synthesizeKey("VK_DOWN", {})
> + synthesizeKey("VK_ENTER", {})
>
> This is a bit of a problem, it will break if someone changes the layout of the
> context menu.
>
> I think what you really care about here is the coordinates in the contextmenu
> event. I think the right thing to do is to check the clientX/clientY
> coordinates in the event. The tricky part is to make sure that your test fails
> without the patch, and passes with the patch.

Hello,

I think that what I really care about is the word on which the oncontextmenu occurred, as can be deduced from rangeParent and rangeOffset (this is what inlineSpellChecking uses). Unfortunately I have been unable to access this information. No matter what attribute I try to access on rangeParent, I get errors like:

Error: Permission denied to access property 'data' from a non-chrome context

Any pointers?