Bug 1450055 - Part 3. Update mochitests since focus event listener is system group. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 08 Jan 2019 16:50:14 +0900
changeset 510115 a6cc9b822c1c1051961f8a293bc3e0331b8739d6
parent 510114 85fda059ef060d64b39848b3897e313e1e9b4900
child 510116 26808f3dc0feb87880648c54ba23495d00457287
child 510131 16819308720e1aa1228ff31f84bd233599fb5e23
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1450055
milestone66.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 1450055 - Part 3. Update mochitests since focus event listener is system group. r=masayuki The focus event listener in editor is system group, so synthesizeKey and/or synthesizeMouse doesn't work on focus event since editor doesn't initialize selection yet. So use setTimeout to work synthesizeKey and etc well. Differential Revision: https://phabricator.services.mozilla.com/D15926
layout/base/tests/bug1097242-1.html
layout/base/tests/bug1109968-1.html
layout/base/tests/bug1109968-2.html
layout/base/tests/bug1123067-1.html
layout/base/tests/bug1123067-ref.html
layout/base/tests/bug1237236-2-ref.html
layout/base/tests/bug1258308-2-ref.html
layout/base/tests/bug1259949-2-ref.html
layout/base/tests/bug1423331-1.html
layout/base/tests/bug1423331-2.html
layout/base/tests/bug989012-1.html
layout/base/tests/bug989012-2.html
layout/base/tests/bug989012-3.html
--- a/layout/base/tests/bug1097242-1.html
+++ b/layout/base/tests/bug1097242-1.html
@@ -1,18 +1,22 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
   <script>
-    function test() {
-      focus();
-      synthesizeMouseAtCenter(document.querySelector("span"), {});
-    }
     function focused() {
       document.documentElement.removeAttribute("class");
     }
   </script>
-  <body onload="setTimeout(test, 0)">
+  <body>
     <div contenteditable spellcheck="false" onfocus="focused()"
       style="outline: none">foo<span contenteditable=false
       style="-moz-user-select: none">bar</span>baz</div>
+    <script>
+      SimpleTest.waitForFocus(() => {
+        SimpleTest.executeSoon(() => {
+          synthesizeMouseAtCenter(document.querySelector("span"), {});
+        });
+      });
+    </script>
   </body>
 </html>
--- a/layout/base/tests/bug1109968-1.html
+++ b/layout/base/tests/bug1109968-1.html
@@ -1,14 +1,14 @@
 <html class="reftest-wait">
   <head>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<div contenteditable="false"><a href="#">bar</a></div>baz</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<div contenteditable="false"><a href="#">bar</a></div>baz</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug1109968-2.html
+++ b/layout/base/tests/bug1109968-2.html
@@ -1,14 +1,14 @@
 <html class="reftest-wait">
   <head>
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<div contenteditable="false"><img src="image_rgrg-256x256.png" width="10" height="10"></div>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<div contenteditable="false"><img src="image_rgrg-256x256.png" width="10" height="10"></div>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug1123067-1.html
+++ b/layout/base/tests/bug1123067-1.html
@@ -24,15 +24,15 @@
     </script>
     <style>
         div { -moz-user-select:none; }
         div:focus { outline:1px solid black; }
     </style>
 </head>
 <body>
 
-<div id="test1" contenteditable="true" spellcheck="false" onfocus="test()">This text is NOT selectable.</div>
+<div id="test1" contenteditable="true" spellcheck="false" onfocus="setTimeout(test, 0)">This text is NOT selectable.</div>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1123067-ref.html
+++ b/layout/base/tests/bug1123067-ref.html
@@ -19,15 +19,15 @@
         }
     </script>
     <style>
         div:focus { outline:1px solid black; }
     </style>
 </head>
 <body>
 
-<div id="test1" contenteditable="true" spellcheck="false" onfocus="test()">This text is NOT selectable.</div>
+<div id="test1" contenteditable="true" spellcheck="false" onfocus="setTimeout(test, 0)">This text is NOT selectable.</div>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1237236-2-ref.html
+++ b/layout/base/tests/bug1237236-2-ref.html
@@ -14,16 +14,16 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abc
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abc
 def</pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1258308-2-ref.html
+++ b/layout/base/tests/bug1258308-2-ref.html
@@ -14,17 +14,17 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abc
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abc
 def
 ghi</pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1259949-2-ref.html
+++ b/layout/base/tests/bug1259949-2-ref.html
@@ -14,17 +14,17 @@
         function runTests() {
           document.querySelector('pre').focus();
           document.body.offsetHeight;
         }
     </script>
 </head>
 <body>
 
-<pre contenteditable tabindex=1 onfocus="test1()" spellcheck="false">abcdef
+<pre contenteditable tabindex=1 onfocus="setTimeout(test1, 0)" spellcheck="false">abcdef
 
 </pre>
 
 <script>
 SimpleTest.waitForFocus(runTests);
 </script>
 </body>
 </html>
--- a/layout/base/tests/bug1423331-1.html
+++ b/layout/base/tests/bug1423331-1.html
@@ -12,15 +12,17 @@
 }
 #editable::before {
   content: "Write here";
 }
 </style>
 <div id="editable" contenteditable></div>
 <script>
 SimpleTest.waitForFocus(function() {
-  let div = document.getElementById("editable");
-  synthesizeMouseAtCenter(div, {});
-  synthesizeMouseAtCenter(div, {});
-  document.documentElement.className ="";
+  SimpleTest.executeSoon(() => {
+    let div = document.getElementById("editable");
+    synthesizeMouseAtCenter(div, {});
+    synthesizeMouseAtCenter(div, {});
+    document.documentElement.className ="";
+  });
 });
 </script>
 </html>
--- a/layout/base/tests/bug1423331-2.html
+++ b/layout/base/tests/bug1423331-2.html
@@ -12,16 +12,18 @@
 }
 #editable:empty::before {
   content: "Write here";
 }
 </style>
 <div id="editable" contenteditable></div>
 <script>
 SimpleTest.waitForFocus(function() {
-  let div = document.getElementById("editable");
-  synthesizeMouseAtCenter(div, {});
-  synthesizeMouseAtCenter(div, {});
-  sendString("xxx");
-  document.documentElement.className = "";
+  SimpleTest.executeSoon(() => {
+    let div = document.getElementById("editable");
+    synthesizeMouseAtCenter(div, {});
+    synthesizeMouseAtCenter(div, {});
+    sendString("xxx");
+    document.documentElement.className = "";
+  });
 });
 </script>
 </html>
--- a/layout/base/tests/bug989012-1.html
+++ b/layout/base/tests/bug989012-1.html
@@ -1,15 +1,15 @@
 <html class="reftest-wait">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<img alt="IMAGE">bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<img alt="IMAGE">bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug989012-2.html
+++ b/layout/base/tests/bug989012-2.html
@@ -4,17 +4,17 @@
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <style>
       span:before {
         content: "IMAGE";
       }
     </style>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<span></span>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<span></span>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);
--- a/layout/base/tests/bug989012-3.html
+++ b/layout/base/tests/bug989012-3.html
@@ -6,17 +6,17 @@
       img {
         border: solid 1px red;
         mid-width: 1em;
         display: inline-block;
       }
     </style>
   </head>
   <body onload="start()">
-    <div onfocus="done()" contenteditable>foo<img>bar</div>
+    <div onfocus="setTimeout(done, 0)" contenteditable>foo<img>bar</div>
     <script>
       var div = document.querySelector("div");
       function start() {
         div.focus();
       }
       function done() {
         var sel = getSelection();
         sel.collapse(div, 0);