Backed out 2 changesets (bug 1337392) for test_browserElement_inproc_SetInputMethodActive.html failures a=backout
authorWes Kocher <wkocher@mozilla.com>
Thu, 23 Mar 2017 10:52:38 -0700
changeset 557116 c4f5a1f6d6769a1670d457fe9fd968b19c06bfd0
parent 557115 26252ef9b45f6dd9d854dd6a08399d2e54d80470
child 557117 ee46acc0eeb2c3590cc6baa15f1f8fddfc5fff4c
push id52662
push userbmo:tom@mozilla.com
push dateThu, 06 Apr 2017 15:15:31 +0000
reviewersbackout
bugs1337392
milestone52.0.2
backs out36953ede0e593b908ec590fdc1c5ab76f30b71f1
cf8216fc3b25ad8cb2bd2b687c5cdc9a9d68a8dd
Backed out 2 changesets (bug 1337392) for test_browserElement_inproc_SetInputMethodActive.html failures a=backout Backed out changeset 36953ede0e59 (bug 1337392) Backed out changeset cf8216fc3b25 (bug 1337392)
accessible/tests/mochitest/jsat/test_content_text.html
accessible/tests/mochitest/states/test_inputs.html
devtools/client/netmonitor/test/browser_net_resend.js
dom/html/test/test_bug613019.html
editor/libeditor/tests/test_bug850043.html
layout/base/tests/bug1082486-1.html
layout/base/tests/bug646382-1-ref.html
layout/base/tests/bug646382-2-ref.html
layout/base/tests/bug664087-1-ref.html
layout/base/tests/bug664087-2-ref.html
layout/base/tests/bug956530-1.html
layout/base/tests/input-maxlength-invalid-change.html
layout/base/tests/input-maxlength-ui-invalid-change.html
layout/base/tests/input-maxlength-ui-valid-change.html
layout/base/tests/input-maxlength-valid-change.html
layout/base/tests/input-minlength-invalid-change.html
layout/base/tests/input-minlength-ui-invalid-change.html
layout/base/tests/input-minlength-ui-valid-change.html
layout/base/tests/input-minlength-valid-change.html
layout/base/tests/textarea-maxlength-invalid-change.html
layout/base/tests/textarea-maxlength-ui-invalid-change.html
layout/base/tests/textarea-maxlength-ui-valid-change.html
layout/base/tests/textarea-maxlength-valid-change.html
layout/base/tests/textarea-minlength-invalid-change.html
layout/base/tests/textarea-minlength-ui-invalid-change.html
layout/base/tests/textarea-minlength-ui-valid-change.html
layout/base/tests/textarea-minlength-valid-change.html
layout/forms/nsTextControlFrame.cpp
layout/forms/test/bug287446_subframe.html
layout/forms/test/test_bug353539.html
layout/forms/test/test_bug534785.html
layout/reftests/bugs/240933-1.html
widget/tests/test_native_key_bindings_mac.html
--- a/accessible/tests/mochitest/jsat/test_content_text.html
+++ b/accessible/tests/mochitest/jsat/test_content_text.html
@@ -63,26 +63,26 @@
              { android_todo: true /* Bug 980512 */})],
 
           // Editable text tests.
           [ContentMessages.focusSelector('textarea'),
            new ExpectedAnnouncement('editing'),
            new ExpectedEditState({
             editing: true,
             multiline: true,
-            atStart: true,
-            atEnd: false
+            atStart: false,
+            atEnd: true
            }),
            new ExpectedCursorChange(
             ['Please refrain from Mayoneggs during this salmonella scare.',
              {string: 'textarea'}]),
-           new ExpectedTextSelectionChanged(0, 0)
+           new ExpectedTextSelectionChanged(59, 59)
           ],
           [ContentMessages.activateCurrent(10),
-           new ExpectedTextCaretChanged(0, 10),
+           new ExpectedTextCaretChanged(10, 59),
            new ExpectedEditState({ editing: true,
              multiline: true,
              atStart: false,
              atEnd: false }),
            new ExpectedTextSelectionChanged(10, 10)],
           [ContentMessages.activateCurrent(20),
            new ExpectedTextCaretChanged(10, 20),
            new ExpectedTextSelectionChanged(20, 20)
--- a/accessible/tests/mochitest/states/test_inputs.html
+++ b/accessible/tests/mochitest/states/test_inputs.html
@@ -102,17 +102,16 @@
       testStates(valid[i] + "2", 0, 0, STATE_INVALID);
     }
 
     ////////////////////////////////////////////////////////////////////////////
     // 'invalid' state
     // (per spec, min/maxlength validity is affected by interactive edits)
     var mininp = document.getElementById("minlength");
     mininp.focus();
-    mininp.setSelectionRange(mininp.value.length, mininp.value.length);
     synthesizeKey("VK_BACK_SPACE", {});
     ok(!mininp.validity.valid,
        "input should be invalid after interactive edits");
     testStates(mininp, STATE_INVALID);
     // inputs currently cannot be made longer than maxlength interactively,
     // so we're not testing that case.
 
     ////////////////////////////////////////////////////////////////////////////
--- a/devtools/client/netmonitor/test/browser_net_resend.js
+++ b/devtools/client/netmonitor/test/browser_net_resend.js
@@ -109,42 +109,39 @@ add_task(function* () {
    */
   function* editCustomForm() {
     panelWin.focus();
 
     let query = document.getElementById("custom-query-value");
     let queryFocus = once(query, "focus", false);
     // Bug 1195825: Due to some unexplained dark-matter with promise,
     // focus only works if delayed by one tick.
-    query.setSelectionRange(query.value.length, query.value.length);
     executeSoon(() => query.focus());
     yield queryFocus;
 
     // add params to url query string field
     type(["VK_RETURN"]);
     type(ADD_QUERY);
 
     let headers = document.getElementById("custom-headers-value");
     let headersFocus = once(headers, "focus", false);
-    headers.setSelectionRange(headers.value.length, headers.value.length);
     headers.focus();
     yield headersFocus;
 
     // add a header
     type(["VK_RETURN"]);
     type(ADD_HEADER);
 
     // add a User-Agent header, to check if default headers can be modified
     // (there will be two of them, first gets overwritten by the second)
     type(["VK_RETURN"]);
     type(ADD_UA_HEADER);
 
     let postData = document.getElementById("custom-postdata-value");
     let postFocus = once(postData, "focus", false);
-    postData.setSelectionRange(postData.value.length, postData.value.length);
     postData.focus();
     yield postFocus;
 
     // add to POST data
     type(ADD_POSTDATA);
   }
 
   /*
--- a/dom/html/test/test_bug613019.html
+++ b/dom/html/test/test_bug613019.html
@@ -22,17 +22,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 613019 **/
 
 function testInteractivityOfMaxLength(elem) {
   // verify that user interactivity is necessary for validity state to apply.
   is(elem.value, "Test", "Element has incorrect starting value.");
   is(elem.validity.tooLong, false, "Element should not be tooLong.");
 
-  elem.setSelectionRange(elem.value.length, elem.value.length)
   elem.focus();
 
   synthesizeKey("VK_BACK_SPACE", {});
   is(elem.value, "Tes", "Element value was not changed correctly.");
   is(elem.validity.tooLong, true, "Element should still be tooLong.");
 
   synthesizeKey("VK_BACK_SPACE", {});
   is(elem.value, "Te", "Element value was not changed correctly.");
@@ -43,17 +42,16 @@ function testInteractivityOfMaxLength(el
      "Element should not be tooLong after non-interactive value change.");
 }
 
 function testInteractivityOfMinLength(elem) {
   // verify that user interactivity is necessary for validity state to apply.
   is(elem.value, "Test", "Element has incorrect starting value.");
   is(elem.validity.tooLong, false, "Element should not be tooShort.");
 
-  elem.setSelectionRange(elem.value.length, elem.value.length)
   elem.focus();
 
   synthesizeKey("e", {});
   is(elem.value, "Teste", "Element value was not changed correctly.");
   is(elem.validity.tooShort, true, "Element should still be tooShort.");
 
   synthesizeKey("d", {});
   is(elem.value, "Tested", "Element value was not changed correctly.");
--- a/editor/libeditor/tests/test_bug850043.html
+++ b/editor/libeditor/tests/test_bug850043.html
@@ -25,17 +25,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 </pre>
 <script>
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(() => {
   let fm = SpecialPowers.Cc["@mozilla.org/focus-manager;1"].
     getService(SpecialPowers.Ci.nsIFocusManager);
 
   let element = document.getElementById("textarea");
-  element.setSelectionRange(element.value.length, element.value.length);
   element.focus();
   is(SpecialPowers.unwrap(fm.focusedElement), element, "failed to move focus");
 
   synthesizeKey("VK_END", { });
   synthesizeKey("a", { });
   is(element.value, "b\u{9080}\u{e010f}\u{8fba}\u{e0101}a", "a isn't last character");
 
   synthesizeKey("VK_BACK_SPACE", { });
--- a/layout/base/tests/bug1082486-1.html
+++ b/layout/base/tests/bug1082486-1.html
@@ -10,16 +10,18 @@
        outline: none;
      }
      </style>
   </head>
   <body onload="focusInput();">
     <script>
       function focusInput() {
         var inp = document.getElementById('i');
+        inp.selectionStart = 0;
+        inp.selectionEnd = 0;
         inp.focus();
       }
     </script>
 
     <a target="_blank" href="https://bugzil.la/1082486">Mozilla Bug 1082486</a>
 
     <!-- The caret will not be seen when the input is focused. -->
     <input id='i' value="abcdefghd" style="text-indent: -10px">
--- a/layout/base/tests/bug646382-1-ref.html
+++ b/layout/base/tests/bug646382-1-ref.html
@@ -2,16 +2,18 @@
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   </head>
   <body onload="start()">
     <textarea onfocus="done()" style="-moz-appearance: none">س</textarea>
     <script>
       var textarea = document.querySelector("textarea");
       function start() {
+        textarea.selectionStart = 0;
+        textarea.selectionEnd = 0;
         textarea.focus();
       }
       function done() {
         document.documentElement.removeAttribute("class");
       }
     </script>
   </body>
 </html>
--- a/layout/base/tests/bug646382-2-ref.html
+++ b/layout/base/tests/bug646382-2-ref.html
@@ -1,14 +1,16 @@
 <html class="reftest-wait">
   <body onload="start()">
     <textarea dir="rtl" onfocus="done()" style="-moz-appearance: none">s</textarea>
     <script>
       var textarea = document.querySelector("textarea");
       function start() {
+        textarea.selectionStart = 0;
+        textarea.selectionEnd = 0;
         textarea.focus();
       }
       function done() {
         document.documentElement.removeAttribute("class");
       }
     </script>
   </body>
 </html>
--- a/layout/base/tests/bug664087-1-ref.html
+++ b/layout/base/tests/bug664087-1-ref.html
@@ -4,16 +4,18 @@
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
     <textarea rows="3" onfocus="done()" spellcheck="false" style="-moz-appearance: none">אב
 ג</textarea>
     <script>
       var textarea = document.querySelector("textarea");
       function start() {
+        textarea.selectionStart = 0;
+        textarea.selectionEnd = 0;
         textarea.focus();
       }
       function done() {
         synthesizeKey("VK_LEFT", {});
         synthesizeKey("VK_LEFT", {});
         document.documentElement.removeAttribute("class");
       }
     </script>
--- a/layout/base/tests/bug664087-2-ref.html
+++ b/layout/base/tests/bug664087-2-ref.html
@@ -4,16 +4,18 @@
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
     <textarea dir="rtl" onfocus="done()" spellcheck="false" style="-moz-appearance: none">ab
 c</textarea>
     <script>
       var textarea = document.querySelector("textarea");
       function start() {
+        textarea.selectionStart = 0;
+        textarea.selectionEnd = 0;
         textarea.focus();
       }
       function done() {
         synthesizeKey("VK_RIGHT", {});
         synthesizeKey("VK_RIGHT", {});
         document.documentElement.removeAttribute("class");
       }
     </script>
--- a/layout/base/tests/bug956530-1.html
+++ b/layout/base/tests/bug956530-1.html
@@ -6,19 +6,18 @@
     background: none;
     border: none;
     outline: none;
   }
   </style>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
   <script>
     function test() {
+      focus();
       var i = document.querySelector("input");
-      i.setSelectionRange(i.value.length,i.value.length);
-      focus();
       synthesizeMouseAtCenter(i, {});
       setTimeout(function() {
         synthesizeMouseAtCenter(document.body, {});
         setTimeout(function() {
           synthesizeMouseAtCenter(i, {});
         }, 0);
       }, 0);
     }
--- a/layout/base/tests/input-maxlength-invalid-change.html
+++ b/layout/base/tests/input-maxlength-invalid-change.html
@@ -6,20 +6,20 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" maxlength="2" value="fooo">
   </body>
 </html>
+
--- a/layout/base/tests/input-maxlength-ui-invalid-change.html
+++ b/layout/base/tests/input-maxlength-ui-invalid-change.html
@@ -6,20 +6,20 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" maxlength="2" value="fooo">
   </body>
 </html>
+
--- a/layout/base/tests/input-maxlength-ui-valid-change.html
+++ b/layout/base/tests/input-maxlength-ui-valid-change.html
@@ -6,23 +6,23 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
         input.blur();
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" maxlength="3" value="foooo">
   </body>
 </html>
+
--- a/layout/base/tests/input-maxlength-valid-change.html
+++ b/layout/base/tests/input-maxlength-valid-change.html
@@ -6,23 +6,23 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
         input.blur();
         input.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" maxlength="3" value="foooo">
   </body>
 </html>
+
--- a/layout/base/tests/input-minlength-invalid-change.html
+++ b/layout/base/tests/input-minlength-invalid-change.html
@@ -6,20 +6,20 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('o', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" minlength="4" value="fo">
   </body>
 </html>
+
--- a/layout/base/tests/input-minlength-ui-invalid-change.html
+++ b/layout/base/tests/input-minlength-ui-invalid-change.html
@@ -6,20 +6,20 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('o', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" minlength="4" value="fo">
   </body>
 </html>
+
--- a/layout/base/tests/input-minlength-ui-valid-change.html
+++ b/layout/base/tests/input-minlength-ui-valid-change.html
@@ -6,23 +6,23 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('o', {}); // so that it becomes invalid first
         input.blur();
         input.focus();
         synthesizeKey('o', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" minlength="3" value="f">
   </body>
 </html>
+
--- a/layout/base/tests/input-minlength-valid-change.html
+++ b/layout/base/tests/input-minlength-valid-change.html
@@ -6,23 +6,23 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var input = document.getElementById('input');
-        input.setSelectionRange(input.value.length, input.value.length)
         input.focus();
         synthesizeKey('o', {}); // so that it becomes invalid first
         input.blur();
         input.focus();
         synthesizeKey('o', {});
         input.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <input id="input" minlength="3" value="f">
   </body>
 </html>
+
--- a/layout/base/tests/textarea-maxlength-invalid-change.html
+++ b/layout/base/tests/textarea-maxlength-invalid-change.html
@@ -6,20 +6,20 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" maxlength="2">fooo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-maxlength-ui-invalid-change.html
+++ b/layout/base/tests/textarea-maxlength-ui-invalid-change.html
@@ -6,20 +6,20 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" maxlength="2">fooo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-maxlength-ui-valid-change.html
+++ b/layout/base/tests/textarea-maxlength-ui-valid-change.html
@@ -6,23 +6,23 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
         textarea.blur();
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" maxlength="3">foooo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-maxlength-valid-change.html
+++ b/layout/base/tests/textarea-maxlength-valid-change.html
@@ -6,23 +6,23 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {}); // so that it becomes invalid first
         textarea.blur();
         textarea.focus();
         synthesizeKey('VK_BACK_SPACE', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" maxlength="3">foooo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-minlength-invalid-change.html
+++ b/layout/base/tests/textarea-minlength-invalid-change.html
@@ -6,20 +6,20 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('o', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" minlength="4">fo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-minlength-ui-invalid-change.html
+++ b/layout/base/tests/textarea-minlength-ui-invalid-change.html
@@ -6,20 +6,20 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { box-shadow:none; background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('o', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" minlength="4">fo</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-minlength-ui-valid-change.html
+++ b/layout/base/tests/textarea-minlength-ui-valid-change.html
@@ -6,23 +6,23 @@
       :-moz-ui-valid { background-color:green; }
       :-moz-ui-invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('o', {}); // so that it becomes invalid first
         textarea.blur();
         textarea.focus();
         synthesizeKey('o', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" minlength="3">f</textarea>
   </body>
 </html>
+
--- a/layout/base/tests/textarea-minlength-valid-change.html
+++ b/layout/base/tests/textarea-minlength-valid-change.html
@@ -6,23 +6,23 @@
       :valid { background-color:green; }
       :invalid { background-color:red; }
       * { background-color:white; }
     </style>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <script>
       function runTest() {
         var textarea = document.getElementById('textarea');
-        textarea.setSelectionRange(textarea.value.length, textarea.value.length)
         textarea.focus();
         synthesizeKey('o', {}); // so that it becomes invalid first
         textarea.blur();
         textarea.focus();
         synthesizeKey('o', {});
         textarea.blur(); // to hide the caret
         document.documentElement.className='';
       }
     </script>
   </head>
   <body onload="runTest()">
     <textarea id="textarea" minlength="3">f</textarea>
   </body>
 </html>
+
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -299,28 +299,23 @@ nsTextControlFrame::EnsureEditorInitiali
     nsresult rv = txtCtrl->CreateEditor();
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_STATE(weakFrame.IsAlive());
 
     // Set mEditorHasBeenInitialized so that subsequent calls will use the
     // editor.
     mEditorHasBeenInitialized = true;
 
-    if (weakFrame.IsAlive()) {
-      int32_t position = 0;
+    nsAutoString val;
+    txtCtrl->GetTextEditorValue(val, true);
+    int32_t length = val.Length();
 
-      // Set the selection to the end of the text field (bug 1287655),
-      // but only if the contents has changed (bug 1337392).
-      if (txtCtrl->ValueChanged()) {
-        nsAutoString val;
-        txtCtrl->GetTextEditorValue(val, true);
-        position = val.Length();
-      }
-
-      SetSelectionEndPoints(position, position);
+    // Set the selection to the end of the text field. (bug 1287655)
+    if (weakFrame.IsAlive()) {
+      SetSelectionEndPoints(length, length);
     }
   }
   NS_ENSURE_STATE(weakFrame.IsAlive());
   return NS_OK;
 }
 
 nsresult
 nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
--- a/layout/forms/test/bug287446_subframe.html
+++ b/layout/forms/test/bug287446_subframe.html
@@ -13,26 +13,27 @@
 
       window.addEventListener("message",
         function(evt) {
           var t = $("target");
           if (evt.data == "start") {
             doIs(t.value, "Test", "Shouldn't have lost our initial value");
             t.focus();
             sendString("Foo");
-            doIs(t.value, "FooTest", "Typing should work");
+            doIs(t.value, "TestFoo", "Typing should work");
             window.parent.postMessage("c", "*");
           } else {
             doIs(evt.data, "continue", "Unexpected message");
-            doIs(t.value, "FooTest", "Shouldn't have lost our typed value");
+            doIs(t.value, "TestFoo", "Shouldn't have lost our typed value");
             sendString("Bar");
-            doIs(t.value, "FooBarTest", "Typing should still work");
+            doIs(t.value, "TestFooBar", "Typing should still work");
             window.parent.postMessage("f", "*");
           }
         },
         "false");
-
+      
     </script>
   </head>
   <body>
     <input id="target" value="Test">
   </body>
 </html>
+           
--- a/layout/forms/test/test_bug353539.html
+++ b/layout/forms/test/test_bug353539.html
@@ -22,27 +22,29 @@ https://bugzilla.mozilla.org/show_bug.cg
   we're
   using
   for
   testing
   purposes
   </textarea>
 </p>
 <div id="content" style="display: none">
-
+  
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 353539 **/
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
   var area = document.getElementById("area");
 
   is(area.scrollTop, 0, "The textarea should not be scrolled initially");
+  area.selectionStart = 0;
+  area.selectionEnd = 0;
   area.focus();
   setTimeout(function() {
     is(area.scrollTop, 0, "The textarea's insertion point should not be scrolled into view");
 
     SimpleTest.finish();
   }, 0);
 });
 
--- a/layout/forms/test/test_bug534785.html
+++ b/layout/forms/test/test_bug534785.html
@@ -28,27 +28,27 @@ SimpleTest.waitForExplicitFinish();
 
 SimpleTest.waitForFocus(function() {
   var i = document.querySelector("input");
   i.addEventListener("focus", function() {
     is(i.value, "test", "Sanity check");
 
     is(document.activeElement, i, "Should be focused before frame reconstruction");
     synthesizeKey("1", {});
-    is(i.value, "1test", "Can accept keyboard events before frame reconstruction");
+    is(i.value, "test1", "Can accept keyboard events before frame reconstruction");
 
     // force frame reconstruction
     i.style.display = "none";
     document.offsetHeight;
     i.style.display = "";
     document.offsetHeight;
 
     is(document.activeElement, i, "Should be focused after frame reconstruction");
     synthesizeKey("2", {});
-    is(i.value, "12test", "Can accept keyboard events after frame reconstruction");
+    is(i.value, "test12", "Can accept keyboard events after frame reconstruction");
 
     // Make sure reframing happens gracefully
     var reframeDiv = document.getElementById("reframe");
     var textAreaWithoutValue = reframeDiv.querySelectorAll("textarea")[0];
     var textAreaWithValue = reframeDiv.querySelectorAll("textarea")[1];
     var inputWithoutValue = reframeDiv.querySelectorAll("input")[0];
     var inputWithValue = reframeDiv.querySelectorAll("input")[1];
     reframeDiv.style.display = "none";
--- a/layout/reftests/bugs/240933-1.html
+++ b/layout/reftests/bugs/240933-1.html
@@ -7,13 +7,13 @@
 
 </textarea>
 <textarea id="tb">
 
 abc
 
 </textarea>
 
-<div id="coords1">0</div>
-<div id="coords2">0</div>
+<div id="coords1">6</div>
+<div id="coords2">6</div>
 
 </body>
 </html>
--- a/widget/tests/test_native_key_bindings_mac.html
+++ b/widget/tests/test_native_key_bindings_mac.html
@@ -93,16 +93,20 @@
       Nullam pellentesque rip the couch iaculis rhoncus nibh, give me fish orci
       turpis purr sleep on your face quis nunc bibendum.">
 
     <script type="text/javascript;version=1.8">
       SimpleTest.waitForExplicitFinish();
 
       let synthesizedKeys = [];
       let expectations = [];
+      
+      let textarea = document.getElementById("textarea");
+      textarea.selectionStart = 0;
+      textarea.selectionEnd = 0;
 
       // Move to beginning of line
       synthesizedKeys.push([KEYBOARD_LAYOUT_EN_US, MAC_VK_LeftArrow,
                             {ctrlKey: true}, "\uf702", "\uf702"]);
       expectations.push({
         editable: [0, 0],
         textarea: [0, 0],
         input:    [0, 0]