From c83c4017160b4fc0ea5fea964f31a4abd921def5 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 13 Jan 2012 15:19:22 +0900 Subject: [PATCH] Bug 717147 input events which are fired after compositionupdate should be trusted events r=ehsan --- editor/libeditor/base/nsEditorEventListener.cpp | 4 ++++ widget/tests/test_input_events_on_deactive_window.xul | 2 +- widget/tests/window_composition_text_querycontent.xul | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/libeditor/base/nsEditorEventListener.cpp b/editor/libeditor/base/nsEditorEventListener.cpp index 18542adcba7..652470090a0 100644 --- a/editor/libeditor/base/nsEditorEventListener.cpp +++ b/editor/libeditor/base/nsEditorEventListener.cpp @@ -647,6 +647,10 @@ nsEditorEventListener::HandleText(nsIDOMEvent* aTextEvent) return NS_OK; } + // Transfer the event's trusted-ness to our editor + nsCOMPtr NSEvent = do_QueryInterface(aTextEvent); + nsAutoEditorKeypressOperation operation(mEditor, NSEvent); + return mEditor->UpdateIMEComposition(composedText, textRangeList); } diff --git a/widget/tests/test_input_events_on_deactive_window.xul b/widget/tests/test_input_events_on_deactive_window.xul index e847149141a..ebd9cadbd19 100644 --- a/widget/tests/test_input_events_on_deactive_window.xul +++ b/widget/tests/test_input_events_on_deactive_window.xul @@ -171,7 +171,7 @@ function startTests() }, "caret": { "start": 1, "length": 0 } }); - checkCompositionEvents(false, false, true, false, "composing"); + checkCompositionEvents(false, false, true, true, "composing"); var queryText = synthesizeQueryTextContent(0, 100); ok(queryText, "query text event result is null"); if (!queryText) { diff --git a/widget/tests/window_composition_text_querycontent.xul b/widget/tests/window_composition_text_querycontent.xul index fdb8ebed8b5..9053ade633b 100644 --- a/widget/tests/window_composition_text_querycontent.xul +++ b/widget/tests/window_composition_text_querycontent.xul @@ -1240,6 +1240,7 @@ function runCompositionEventTest() function formEventHandlerForWindow(aEvent) { + ok(aEvent.isTrusted, "input events must be trusted events"); windowEventCounts[aEvent.type]++; windowEventData[aEvent.type] = input.value; }