Bug 717147 input events which are fired after compositionupdate should be trusted events r=ehsan
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 13 Jan 2012 15:19:22 +0900
changeset 84400 1f64197c3878270bc26fb030b87b81fcf4bceb0e
parent 84381 8d4638feec54d4a48e62ba0339cf33080fd77367
child 84401 1a71337e5cf7b1443455ab68a9da65c747a1acd5
push id21848
push usermak77@bonardo.net
push dateSat, 14 Jan 2012 09:02:20 +0000
treeherdermozilla-central@27a7f197c6fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs717147
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 717147 input events which are fired after compositionupdate should be trusted events r=ehsan
editor/libeditor/base/nsEditorEventListener.cpp
widget/tests/test_input_events_on_deactive_window.xul
widget/tests/window_composition_text_querycontent.xul
--- a/editor/libeditor/base/nsEditorEventListener.cpp
+++ b/editor/libeditor/base/nsEditorEventListener.cpp
@@ -642,16 +642,20 @@ nsEditorEventListener::HandleText(nsIDOM
   textEvent->GetText(composedText);
   textRangeList = textEvent->GetInputRange();
 
   // if we are readonly or disabled, then do nothing.
   if (mEditor->IsReadonly() || mEditor->IsDisabled()) {
     return NS_OK;
   }
 
+  // Transfer the event's trusted-ness to our editor
+  nsCOMPtr<nsIDOMNSEvent> NSEvent = do_QueryInterface(aTextEvent);
+  nsAutoEditorKeypressOperation operation(mEditor, NSEvent);
+
   return mEditor->UpdateIMEComposition(composedText, textRangeList);
 }
 
 /**
  * Drag event implementation
  */
 
 nsresult
--- a/widget/tests/test_input_events_on_deactive_window.xul
+++ b/widget/tests/test_input_events_on_deactive_window.xul
@@ -166,17 +166,17 @@ function startTests()
         { "string": "\u3089",
           "clauses":
           [
             { "length": 1, "attr": nsIDOMWindowUtils.COMPOSITION_ATTR_RAWINPUT }
           ]
         },
         "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) {
       return;
     }
     ok(queryText.succeeded, "query text event failed");
     if (!queryText.succeeded) {
       return;
--- a/widget/tests/window_composition_text_querycontent.xul
+++ b/widget/tests/window_composition_text_querycontent.xul
@@ -1235,16 +1235,17 @@ function runCompositionEventTest()
     }
     if (stopPropagation) {
       aEvent.stopPropagation();
     }
   }
 
   function formEventHandlerForWindow(aEvent)
   {
+    ok(aEvent.isTrusted, "input events must be trusted events");
     windowEventCounts[aEvent.type]++;
     windowEventData[aEvent.type] = input.value;
   }
 
   function compositionEventHandlerForInput(aEvent)
   {
     inputEventCounts[aEvent.type]++;
     inputEventData[aEvent.type] = aEvent.data;