Bug 917322 part.10 Remove unnecessary synthesizeComposition(compositionstart) from all tests r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 28 Jan 2015 15:27:32 +0900
changeset 239581 f341e1c47a1a1e2f3883f0effdfdde717ae1ef31
parent 239580 0458d8e6291e3f2c4039fa02f874fba357f1637b
child 239582 49cd2b26b85dc26dd2a563500fbe3cab730798ce
push id500
push userjoshua.m.grant@gmail.com
push dateThu, 29 Jan 2015 01:48:36 +0000
reviewerssmaug
bugs917322
milestone38.0a1
Bug 917322 part.10 Remove unnecessary synthesizeComposition(compositionstart) from all tests r=smaug
editor/libeditor/tests/test_bug1026397.html
editor/libeditor/tests/test_bug697842.html
editor/libeditor/tests/test_bug795785.html
editor/libeditor/tests/test_contenteditable_text_input_handling.html
layout/base/tests/bug613807-1.html
toolkit/content/tests/chrome/file_autocomplete_with_composition.js
toolkit/content/tests/chrome/findbar_window.xul
widget/tests/test_assign_event_data.html
widget/tests/test_imestate.html
widget/tests/test_input_events_on_deactive_window.xul
widget/tests/window_composition_text_querycontent.xul
--- a/editor/libeditor/tests/test_bug1026397.html
+++ b/editor/libeditor/tests/test_bug1026397.html
@@ -41,17 +41,16 @@ function runTests()
     }
     input.selectionStart = input.selectionEnd = aCaretOffset;
     if (aAdditionalExplanation) {
       aAdditionalExplanation = " " + aAdditionalExplanation;
     } else {
       aAdditionalExplanation = "";
     }
 
-    synthesizeComposition({ type: "compositionstart" });
     synthesizeCompositionChange(
       { "composition":
         { "string": aInsertString,
           "clauses":
           [
             { "length": aInsertString.length, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
         },
--- a/editor/libeditor/tests/test_bug697842.html
+++ b/editor/libeditor/tests/test_bug697842.html
@@ -31,31 +31,37 @@ function runTests()
 {
   var editor = document.getElementById("editor");
   editor.focus();
 
   SimpleTest.executeSoon(function() {
     var composingString = "";
 
     function handler(aEvent) {
-      if (aEvent.type != "text") {
-        is(aEvent.data, composingString, "mismatch composition string");
+      switch (aEvent.type) {
+        case "compositionstart":
+          // Selected string at starting composition must be empty in this test.
+          is(aEvent.data, "", "mismatch selected string");
+          break;
+        case "compositionupdate":
+        case "compositionend":
+          is(aEvent.data, composingString, "mismatch composition string");
+          break;
+        default:
+          break;
       }
       aEvent.stopPropagation();
       aEvent.preventDefault();
     }
 
     editor.addEventListener("compositionstart", handler, true);
     editor.addEventListener("compositionend", handler, true);
     editor.addEventListener("compositionupdate", handler, true);
     editor.addEventListener("text", handler, true);
 
-    // start composition
-    synthesizeComposition({ type: "compositionstart" });
-
     // input first character
     composingString = "\u306B";
     synthesizeCompositionChange(
       { "composition":
         { "string": composingString,
           "clauses":
           [
             { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
--- a/editor/libeditor/tests/test_bug795785.html
+++ b/editor/libeditor/tests/test_bug795785.html
@@ -109,17 +109,16 @@ function doKeyEventTest(aElement, aEleme
 
 function doCompositionTest(aElement, aElementDescription, aCallback)
 {
   aElement.focus();
   aElement.scrollTop = 0;
   hitEventLoop(function () {
     is(aElement.scrollTop, 0,
        aElementDescription + "'s scrollTop isn't 0");
-    synthesizeComposition({ type: "compositionstart" });
     var str = "Web \u958b\u767a\u8005\u306e\u7686\u3055\u3093\u306f\u3001" +
               "Firefox \u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b HTML5" +
               " \u3084 CSS \u306e\u65b0\u6a5f\u80fd\u3092\u6d3b\u7528\u3059" +
               "\u308b\u3053\u3068\u3067\u3001\u9b45\u529b\u3042\u308b Web " +
               "\u30b5\u30a4\u30c8\u3084\u9769\u65b0\u7684\u306a Web \u30a2" +
               "\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3088\u308a" +
               "\u77ed\u6642\u9593\u3067\u7c21\u5358\u306b\u4f5c\u6210\u3067" +
               "\u304d\u307e\u3059\u3002";
--- a/editor/libeditor/tests/test_contenteditable_text_input_handling.html
+++ b/editor/libeditor/tests/test_contenteditable_text_input_handling.html
@@ -214,18 +214,16 @@ function runTests()
     testDispatchedKeyEvent(inputInEditor);
     testDispatchedKeyEvent(textareaInEditor);
 
     if (!aFocus._isEditable) {
       return;
     }
 
     // IME
-    // start composition
-    synthesizeComposition({ type: "compositionstart" });
     // input first character
     synthesizeCompositionChange(
       { "composition":
         { "string": "\u3089",
           "clauses":
           [
             { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
--- a/layout/base/tests/bug613807-1.html
+++ b/layout/base/tests/bug613807-1.html
@@ -41,19 +41,16 @@
   }
 
   addLoadEvent(function() {
     var area = document.getElementById('t');
     area.focus();
 
     var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
 
-    // start composition
-    synthesizeComposition({ type: "compositionstart" });
-
     // input raw characters
     synthesizeCompositionChange(
       { composition:
         { string: "\u306D",
           clauses: [
             { length: 1, attr: domWindowUtils.COMPOSITION_ATTR_RAWINPUT }
           ]
         },
--- a/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
+++ b/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
@@ -82,17 +82,16 @@ nsDoTestsForAutoCompleteWithComposition.
   _tests: [
     // Simple composition when popup hasn't been shown.
     // The autocomplete popup should not be shown during composition, but
     // after compositionend, the popup should be shown.
     { description: "compositionstart shouldn't open the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "M",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -123,17 +122,16 @@ nsDoTestsForAutoCompleteWithComposition.
       }, popup: true, value: "Mo", searchString: "Mo"
     },
     // If composition starts when popup is shown, the compositionstart event
     // should cause closing the popup.
     { description: "compositionstart should close the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("z", { type: "keydown" }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "z",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -163,17 +161,16 @@ nsDoTestsForAutoCompleteWithComposition.
         synthesizeKey("VK_RETURN", { type: "keyup" }, aWindow);
       }, popup: true, value: "Mozi", searchString: "Mozi"
     },
     // If composition is cancelled, the value shouldn't be changed.
     { description: "compositionstart should reclose the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("l", { type: "keydown" }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "l",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -221,17 +218,16 @@ nsDoTestsForAutoCompleteWithComposition.
     // But if composition replaces some characters and canceled, the search
     // string should be the latest value.
     { description: "compositionstart with selected string should close the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow);
         synthesizeKey("VK_LEFT", { shiftKey: true }, aWindow);
         synthesizeKey("z", { type: "keydown" }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "z",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -284,17 +280,16 @@ nsDoTestsForAutoCompleteWithComposition.
         synthesizeKey("VK_BACK_SPACE", {}, aWindow);
       }, popup: false, value: "", searchString: ""
     },
     // composition which is canceled shouldn't cause opening the popup.
     { description: "compositionstart shouldn't open the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "M",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -347,17 +342,16 @@ nsDoTestsForAutoCompleteWithComposition.
       }, popup: true, value: "", searchString: ""
     },
     // If popup is open at starting composition, the popup should be reopened
     // after composition anyway.
     { description: "compositionstart shouldn't open the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "M",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -413,17 +407,16 @@ nsDoTestsForAutoCompleteWithComposition.
     },
     // Even if the popup is closed, composition which is canceled should open
     // the popup if the value isn't empty.
     // XXX This might not be good behavior, but anyway, this is minor issue...
     { description: "compositionstart shouldn't open the popup",
       completeDefaultIndex: false,
       execute: function (aWindow) {
         synthesizeKey("z", { type: "keydown", shiftKey: true }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "z",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
@@ -476,17 +469,16 @@ nsDoTestsForAutoCompleteWithComposition.
         synthesizeKey("VK_BACK_SPACE", {}, aWindow);
       }, popup: false, value: "", searchString: ""
     },
     // Testing for nsIAutoCompleteInput.completeDefaultIndex being true.
     { description: "compositionstart shouldn't open the popup (completeDefaultIndex is true)",
       completeDefaultIndex: true,
       execute: function (aWindow) {
         synthesizeKey("m", { type: "keydown", shiftKey: true }, aWindow);
-        synthesizeComposition({ type: "compositionstart" }, aWindow);
         synthesizeCompositionChange(
           { "composition":
             { "string": "M",
               "clauses":
               [
                 { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
               ]
             },
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -249,17 +249,16 @@
         matchCaseCheckbox.click();
         clicked = true;
       }
 
       gFindBar._findField.inputField.focus();
 
       var searchStr = "text";
 
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeCompositionChange(
         { "composition":
           { "string": searchStr,
             "clauses":
             [
               { "length": searchStr.length, "attr": COMPOSITION_ATTR_RAWINPUT }
             ]
           },
--- a/widget/tests/test_assign_event_data.html
+++ b/widget/tests/test_assign_event_data.html
@@ -170,17 +170,16 @@ const kTests = [
     todoMismatch: [],
   },
   { description: "WidgetKeyboardEvent (keyup during composition)",
     targetID: "input-text", eventType: "keyup",
     dispatchEvent: function () {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
       synthesizeKey("a", { type: "keydown" });
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeCompositionChange({ "composition":
         { "string": "\u306D",
           "clauses":
           [
             { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
         },
         "caret": { "start": 1, "length": 0 }
@@ -193,17 +192,16 @@ const kTests = [
     },
     todoMismatch: [ ],
   },
   { description: "WidgetKeyboardEvent (keydown during composition)",
     targetID: "input-text", eventType: "keydown",
     dispatchEvent: function () {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeCompositionChange({ "composition":
         { "string": "\u306D",
           "clauses":
           [
             { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
         },
         "caret": { "start": 1, "length": 0 }
@@ -264,30 +262,28 @@ const kTests = [
     },
     todoMismatch: [],
   },
   { description: "WidgetTextEvent (text)",
     targetID: "input-text", eventType: "text",
     dispatchEvent: function () {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeComposition({ type: "compositioncommit", data: "\u306D" });
     },
     canRun: function () {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "WidgetCompositionEvent (compositionupdate)",
     targetID: "input-text", eventType: "compositionupdate",
     dispatchEvent: function () {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeComposition({ type: "compositioncommit", data: "\u30E9\u30FC\u30E1\u30F3" });
     },
     canRun: function () {
       return true;
     },
     todoMismatch: [ ],
   },
   { description: "InternalEditorInputEvent (input at key input)",
@@ -303,17 +299,16 @@ const kTests = [
     },
     todoMismatch: [],
   },
   { description: "InternalEditorInputEvent (input at composing)",
     targetID: "input-text", eventType: "input",
     dispatchEvent: function () {
       document.getElementById(this.targetID).value = "";
       document.getElementById(this.targetID).focus();
-      synthesizeComposition({ type: "compositionstart" });
       synthesizeCompositionChange({ "composition":
         { "string": "\u30E9\u30FC\u30E1\u30F3",
           "clauses":
           [
             { "length": 4, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
         },
         "caret": { "start": 4, "length": 0 }
--- a/widget/tests/test_imestate.html
+++ b/widget/tests/test_imestate.html
@@ -1231,19 +1231,16 @@ function runEditorFlagChangeTests()
   var editor =
     window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
       getInterface(Components.interfaces.nsIWebNavigation).
       QueryInterface(Components.interfaces.nsIDocShell).editor;
   var editorIMESupport =
     editor.QueryInterface(Components.interfaces.nsIEditorIMESupport);
   var flags = editor.flags;
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3078\u3093\u3057\u3093",
         "clauses":
         [
           { "length": 4, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
--- a/widget/tests/test_input_events_on_deactive_window.xul
+++ b/widget/tests/test_input_events_on_deactive_window.xul
@@ -149,32 +149,28 @@ function startTests()
     checkKeyEvents(false, false, true, false, "a keyup");
     clear();
     synthesizeKey("VK_BACK_SPACE", {});
     checkKeyEvents(true, true, true, true, "VK_BACK_SPACE key events");
     is(textarea.value, "", "textarea value isn't empty");
 
     // IME events
     clear();
-    // start composition
-    synthesizeComposition({ type: "compositionstart" });
-    checkCompositionEvents(true, false, false, false, "compositionstart");
-    clear();
     // input first character
     synthesizeCompositionChange(
       { "composition":
         { "string": "\u3089",
           "clauses":
           [
             { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
           ]
         },
         "caret": { "start": 1, "length": 0 }
       });
-    checkCompositionEvents(false, false, true, true, "composing");
+    checkCompositionEvents(true, false, true, true, "starting to compose");
     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
@@ -185,19 +185,16 @@ function checkRectContainsRect(aRect, aC
   return ret;
 }
 
 function runUndoRedoTest()
 {
   textarea.value = "";
   textarea.focus();
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input raw characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306D",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -227,37 +224,31 @@ function runUndoRedoTest()
         ]
       },
       "caret": { "start": 1, "length": 0 }
     });
 
   // commit
   synthesizeComposition({ type: "compositioncommitasis" });
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input raw characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u307E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
       "caret": { "start": 1, "length": 0 }
     });
 
   // cancel the composition
   synthesizeComposition({ type: "compositioncommit", data: "" });
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input raw characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3080",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -331,19 +322,16 @@ function runUndoRedoTest()
   synthesizeKey("e", {});
   synthesizeKey(" ", {});
   synthesizeKey("i", {});
   synthesizeKey("s", {});
   synthesizeKey(" ", {});
   synthesizeKey("a", {});
   synthesizeKey(" ", {});
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input raw characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3088",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -583,17 +571,16 @@ function runCompositionCommitAsIsTest()
 
   textarea.addEventListener("compositionupdate", handler, true);
   textarea.addEventListener("compositionend", handler, true);
   textarea.addEventListener("input", handler, true);
   textarea.addEventListener("text", handler, true);
 
   // compositioncommitasis with composing string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -607,17 +594,16 @@ function runCompositionCommitAsIsTest()
   is(result.compositionupdate, false, "runCompositionCommitAsIsTest: compositionupdate shouldn't be fired after dispatching compositioncommitasis #1");
   is(result.compositionend, true, "runCompositionCommitAsIsTest: compositionend should be fired after dispatching compositioncommitasis #1");
   is(result.text, true, "runCompositionCommitAsIsTest: text should be fired after dispatching compositioncommitasis because it's dispatched when there is composing string #1");
   is(result.input, true, "runCompositionCommitAsIsTest: input should be fired after dispatching compositioncommitasis #1");
   is(textarea.value, "\u3042", "runCompositionCommitAsIsTest: textarea doesn't have committed string #1");
 
   // compositioncommitasis with committed string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -642,17 +628,16 @@ function runCompositionCommitAsIsTest()
   is(result.compositionupdate, false, "runCompositionCommitAsIsTest: compositionupdate shouldn't be fired after dispatching compositioncommitasis #2");
   is(result.compositionend, true, "runCompositionCommitAsIsTest: compositionend should be fired after dispatching compositioncommitasis #2");
   is(result.text, false, "runCompositionCommitAsIsTest: text shouldn't be fired after dispatching compositioncommitasis because it's dispatched when there is already committed string #2");
   is(result.input, true, "runCompositionCommitAsIsTest: input should be fired after dispatching compositioncommitasis #2");
   is(textarea.value, "\u3042", "runCompositionCommitAsIsTest: textarea doesn't have committed string #2");
 
   // compositioncommitasis with committed string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -703,17 +688,16 @@ function runCompositionCommitTest()
 
   textarea.addEventListener("compositionupdate", handler, true);
   textarea.addEventListener("compositionend", handler, true);
   textarea.addEventListener("input", handler, true);
   textarea.addEventListener("text", handler, true);
 
   // compositioncommit with different composing string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -727,17 +711,16 @@ function runCompositionCommitTest()
   is(result.compositionupdate, true, "runCompositionCommitTest: compositionupdate should be fired after dispatching compositioncommit #1");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #1");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit because it's dispatched when there is compoing string #1");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #1");
   is(textarea.value, "\u3043", "runCompositionCommitTest: textarea doesn't have committed string #1");
 
   // compositioncommit with different committed string when there is already committed string
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -762,17 +745,16 @@ function runCompositionCommitTest()
   is(result.compositionupdate, true, "runCompositionCommitTest: compositionupdate should be fired after dispatching compositioncommit #2");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #2");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit #2");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #2");
   is(textarea.value, "\u3043", "runCompositionCommitTest: textarea doesn't have committed string #2");
 
   // compositioncommit with empty composition string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -797,17 +779,16 @@ function runCompositionCommitTest()
   is(result.compositionupdate, true, "runCompositionCommitTest: compositionupdate should be fired after dispatching compositioncommit #3");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #3");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit #3");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #3");
   is(textarea.value, "\u3043", "runCompositionCommitTest: textarea doesn't have committed string #3");
 
   // compositioncommit with non-empty composition string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -819,32 +800,30 @@ function runCompositionCommitTest()
   synthesizeComposition({ type: "compositioncommit", data: "" });
 
   is(result.compositionupdate, true, "runCompositionCommitTest: compositionupdate should be fired after dispatching compositioncommit #4");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #4");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit #4");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #4");
   is(textarea.value, "", "runCompositionCommitTest: textarea should be empty #4");
 
-  // compositioncommit immediately after compositionstart
+  // compositioncommit immediately without compositionstart
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
 
   clearResult();
   synthesizeComposition({ type: "compositioncommit", data: "\u3042" });
 
   is(result.compositionupdate, true, "runCompositionCommitTest: compositionupdate should be fired after dispatching compositioncommit #5");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #5");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit #5");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #5");
   is(textarea.value, "\u3042", "runCompositionCommitTest: textarea should be empty #5");
 
   // compositioncommit with same composition string.
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -858,17 +837,16 @@ function runCompositionCommitTest()
   is(result.compositionupdate, false, "runCompositionCommitTest: compositionupdate shouldn't be fired after dispatching compositioncommit #5");
   is(result.compositionend, true, "runCompositionCommitTest: compositionend should be fired after dispatching compositioncommit #5");
   is(result.text, true, "runCompositionCommitTest: text should be fired after dispatching compositioncommit because there was composition string #5");
   is(result.input, true, "runCompositionCommitTest: input should be fired after dispatching compositioncommit #5");
   is(textarea.value, "\u3042", "runCompositionCommitTest: textarea should have committed string #5");
 
   // compositioncommit with same composition string when there is committed string
   textarea.value = "";
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -911,19 +889,16 @@ function runCompositionTest()
 
   var caretRect = synthesizeQueryCaretRect(0);
   if (!checkQueryContentResult(caretRect,
         "runCompositionTest: synthesizeQueryCaretRect #0")) {
     return false;
   }
   caretRects[0] = caretRect;
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input first character
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3089",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -1283,20 +1258,17 @@ function runCompositionTest()
       !checkQueryContentResult(textRect4,
         "runCompositionTest: synthesizeQueryTextRect #1-13-2")) {
     return false;
   }
 
   checkRect(textRect3, textRect1, "runCompositionTest: textRect #1-13-1");
   checkRect(textRect4, textRect2, "runCompositionTest: textRect #1-13-2");
 
-  // restart composition
-  synthesizeComposition({ type: "compositionstart" });
-
-  // input characters
+  // restart composition and input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3057",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1373,18 +1345,16 @@ function runCompositionTest()
   var selectionSetTest = synthesizeSelectionSet(4, 7, false);
   ok(selectionSetTest, "runCompositionTest: selectionSetTest failed");
 
   if (!checkSelection(4, "\u3055\u884C\u3053\u3046\u3058\u3087\u3046", "runCompositionTest", "#3-1")) {
     return;
   }
 
   // start composition with selection
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u304A",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1440,18 +1410,16 @@ function runCompositionTest()
                     "runCompositionTest", "#3-5") ||
       !checkSelection(4, "", "runCompositionTest", "#3-5")) {
     return;
   }
 
   // bug 271815, some Chinese IMEs for Linux make empty composition string
   // and compty clause information when it lists up Chinese characters on
   // its candidate window.
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "",
         "clauses":
         [
           { "length": 0, "attr": 0 }
         ]
       },
@@ -1484,18 +1452,16 @@ function runCompositionTest()
   synthesizeComposition({ type: "compositioncommit", data: "\u6700" });
   if (!checkContent("\u30E9\u30FC\u30E1\u30F3\u6700",
                     "runCompositionTest", "#4-3") ||
       !checkSelection(5, "", "runCompositionTest", "#4-3")) {
     return;
   }
 
   // testing the canceling case
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "",
         "clauses":
         [
           { "length": 0, "attr": 0 }
         ]
       },
@@ -1514,18 +1480,16 @@ function runCompositionTest()
                     "runCompositionTest", "#4-6") ||
       !checkSelection(5, "", "runCompositionTest", "#4-6")) {
     return;
   }
 
   // testing whether the empty composition string deletes selected string.
   synthesizeKey("VK_LEFT", { shiftKey: true });
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "",
         "clauses":
         [
           { "length": 0, "attr": 0 }
         ]
       },
@@ -1549,18 +1513,16 @@ function runCompositionTest()
   if (!checkContent("\u30E9\u30FC\u30E1\u30F3",
                     "runCompositionTest", "#4-11") ||
       !checkSelection(4, "", "runCompositionTest", "#4-11")) {
     return;
   }
 
   // bug 23558, ancient Japanese IMEs on Window may send empty text event
   // twice at canceling composition.
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u6700",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1722,17 +1684,16 @@ function runCompositionEventTest()
   input.addEventListener("compositionupdate", compositionEventHandlerForInput,
                          true, true);
   input.addEventListener("input", formEventHandlerForInput,
                          true, true);
 
   // test for normal case
   initResults();
 
-  synthesizeComposition({ type: "compositionstart" });
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3089",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1857,18 +1818,16 @@ function runCompositionEventTest()
   is(inputEventData["input"], "\u3089\u30FC",
      kDescription + "value of input element wasn't modified (input) #3");
 
   // select the second character, then, data of composition start should be
   // the selected character.
   initResults();
   synthesizeKey("VK_LEFT", { shiftKey: true });
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3089",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1926,18 +1885,16 @@ function runCompositionEventTest()
      kDescription + "value of input element wasn't modified (input) #4");
 
   // preventDefault() should effect nothing.
   preventDefault = true;
 
   initResults();
   synthesizeKey("A", { accelKey: true }); // Select All
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306D",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -1997,18 +1954,16 @@ function runCompositionEventTest()
   prevnetDefault = false;
 
   // stopPropagation() should effect nothing (except event count)
   stopPropagation = true;
 
   initResults();
   synthesizeKey("A", { accelKey: true }); // Select All
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2371,18 +2326,16 @@ function runForceCommitTest()
   window.addEventListener("input", eventHandler, true);
   window.addEventListener("text", eventHandler, true);
 
   // Make the composition in textarea commit by click in the textarea
   textarea.focus();
   textarea.value = "";
 
   events = [];
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2424,18 +2377,16 @@ function runForceCommitTest()
   is(textarea.value, "\u306E",
      "runForceCommitTest: the textarea doesn't have the committed text #2");
 
   // Make the composition in textarea commit by click in another editor (input)
   textarea.focus();
   textarea.value = "";
   input.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2469,18 +2420,16 @@ function runForceCommitTest()
      "runForceCommitTest: the textarea doesn't have the committed text #3");
   is(input.value, "",
      "runForceCommitTest: the input has the committed text? #3");
 
   // Make the composition in textarea commit by blur()
   textarea.focus();
   textarea.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2511,18 +2460,16 @@ function runForceCommitTest()
   is(textarea.value, "\u306E",
      "runForceCommitTest: the textarea doesn't have the committed text #4");
 
   // Make the composition in textarea commit by input.focus()
   textarea.focus();
   textarea.value = "";
   input.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2557,18 +2504,16 @@ function runForceCommitTest()
   is(input.value, "",
      "runForceCommitTest: the input has the committed text? #5");
 
   // Make the composition in textarea commit by click in another document's editor
   textarea.focus();
   textarea.value = "";
   textareaInFrame.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2603,18 +2548,16 @@ function runForceCommitTest()
   is(textareaInFrame.value, "",
      "runForceCommitTest: the textarea in frame has the committed text? #6");
 
   // Make the composition in textarea commit by another document's editor's focus()
   textarea.focus();
   textarea.value = "";
   textareaInFrame.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2650,18 +2593,16 @@ function runForceCommitTest()
      "runForceCommitTest: the textarea in frame has the committed text? #7");
 
   // Make the composition in a textarea commit by click in another editable document
   textarea.focus();
   textarea.value = "";
   iframe2.contentDocument.body.innerHTML = "Text in the Body";
   var iframe2BodyInnerHTML = iframe2.contentDocument.body.innerHTML;
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2696,18 +2637,16 @@ function runForceCommitTest()
   is(iframe2.contentDocument.body.innerHTML, iframe2BodyInnerHTML,
      "runForceCommitTest: the editable document has the committed text? #8");
 
   // Make the composition in an editable document commit by click in it
   iframe2.contentWindow.focus();
   iframe2.contentDocument.body.innerHTML = "Text in the Body";
   iframe2BodyInnerHTML = iframe2.contentDocument.body.innerHTML;
 
-  synthesizeComposition({ type: "compositionstart" }, iframe2.contentWindow);
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2740,18 +2679,16 @@ function runForceCommitTest()
      "runForceCommitTest: the editable document doesn't have the committed text #9");
 
   // Make the composition in an editable document commit by click in another document's editor
   textarea.value = "";
   iframe2.contentWindow.focus();
   iframe2.contentDocument.body.innerHTML = "Text in the Body";
   iframe2BodyInnerHTML = iframe2.contentDocument.body.innerHTML;
 
-  synthesizeComposition({ type: "compositionstart" }, iframe2.contentWindow);
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2789,18 +2726,16 @@ function runForceCommitTest()
 
   // Make the composition in an editable document commit by click in the another editable document
   iframe2.contentWindow.focus();
   iframe2.contentDocument.body.innerHTML = "Text in the Body";
   iframe2BodyInnerHTML = iframe2.contentDocument.body.innerHTML;
   iframe3.contentDocument.body.innerHTML = "Text in the Body";
   iframe3BodyInnerHTML = iframe2.contentDocument.body.innerHTML;
 
-  synthesizeComposition({ type: "compositionstart" }, iframe2.contentWindow);
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2901,18 +2836,17 @@ function runIsComposingTest()
   textarea.value = "";
 
   // XXX These cases shouldn't occur in actual native key events because we
   //     don't dispatch key events while composition (bug 354358).
   description = "events before dispatching compositionstart";
   synthesizeKey("VK_LEFT", {});
 
   synthesizeKey("a", { type: "keydown" });
-  synthesizeComposition({ type: "compositionstart" });
-  description = "events after dispatching compositionstart";
+  description = "events after dispatching compositionchange";
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3042",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -2954,18 +2888,16 @@ function runRemoveContentTest(aCallback)
   textarea.addEventListener("compositionupdate", eventHandler, true);
   textarea.addEventListener("compositionend", eventHandler, true);
   textarea.addEventListener("input", eventHandler, true);
   textarea.addEventListener("text", eventHandler, true);
 
   textarea.focus();
   textarea.value = "";
 
-  synthesizeComposition({ type: "compositionstart" });
-
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u306E",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
       },
@@ -3051,19 +2983,16 @@ function runTestOnAnotherContext(aPanelO
   }
 
   var r = aPanelOrFrame.getBoundingClientRect();
   var parentRect = { "left": r.left, "top": r.top, "width": r.right - r.left,
                      "height": r.bottom - r.top };
   checkRectContainsRect(editorRect, parentRect, aTestName +
                         ": the editor rect coordinates are wrong");
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3078\u3093\u3057\u3093",
         "clauses":
         [
           { "length": 4, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -3192,19 +3121,16 @@ function runPanelTest()
 function runMaxLengthTest()
 {
   input.maxLength = 1;
   input.value = "";
   input.focus();
 
   var kDesc ="runMaxLengthTest";
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input first character
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3089",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -3391,19 +3317,16 @@ function runMaxLengthTest()
 
   // commit the composition string
   synthesizeComposition({ type: "compositioncommitasis" });
   if (!checkContent("\u30E9", kDesc, "#1-11") ||
       !checkSelection(1, "", kDesc, "#1-11")) {
     return;
   }
 
-  // restart composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u3057",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -3453,19 +3376,16 @@ function runMaxLengthTest()
     return;
   }
 
   // The input element whose content length is already maxlength and
   // the carest is at start of the content.
   input.value = "X";
   input.selectionStart = input.selectionEnd = 0;
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u9B54",
         "clauses":
         [
           { "length": 1, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]
@@ -3483,19 +3403,16 @@ function runMaxLengthTest()
 
   // The input text must be discarded. Then, the caret position shouldn't be
   // updated from its position at compositionstart.
   if (!checkContent("X", kDesc, "#4-2") ||
       !checkSelection(0, "", kDesc, "#4-2")) {
     return;
   }
 
-  // start composition
-  synthesizeComposition({ type: "compositionstart" });
-
   // input characters
   synthesizeCompositionChange(
     { "composition":
       { "string": "\u9B54\u6CD5",
         "clauses":
         [
           { "length": 2, "attr": COMPOSITION_ATTR_RAWINPUT }
         ]