Bug 1257366 - Try setting designMode again. r=gbrown, a=test-only
authorJim Chen <nchen@mozilla.com>
Wed, 22 Feb 2017 23:10:18 -0500
changeset 492869 98f9ac8d96054321882345dc9c5016332c621f31
parent 492868 1175a6a517a66b2b856bd725beb66f09d71d04b0
child 492870 8d44efe8389de41697165532de6feaa405b39231
push id47617
push userbmo:rail@mozilla.com
push dateFri, 03 Mar 2017 03:42:47 +0000
reviewersgbrown, test-only
bugs1257366
milestone52.0
Bug 1257366 - Try setting designMode again. r=gbrown, a=test-only If the first set designMode call fails, schedule another call for a later time.
mobile/android/tests/browser/robocop/robocop_input.html
--- a/mobile/android/tests/browser/robocop/robocop_input.html
+++ b/mobile/android/tests/browser/robocop/robocop_input.html
@@ -14,17 +14,22 @@
     <p>Hiding input: <input id="hiding-input" type="text"></p>
     <script type="application/javascript;version=1.8" src="robocop_head.js"></script>
     <script type="application/javascript;version=1.8">
       let input = document.getElementById("input");
       let textArea = document.getElementById("text-area");
       let contentEditable = document.getElementById("content-editable");
 
       let designMode = document.getElementById("design-mode");
-      designMode.contentDocument.designMode = "on";
+      try {
+        designMode.contentDocument.designMode = "on";
+      } catch (e) {
+        // Setting designMode above sometimes fails, so try again later.
+        setTimeout(function() { designMode.contentDocument.designMode = "on" }, 0);
+      }
 
       // Spatial navigation interferes with design-mode key event tests.
       SpecialPowers.setBoolPref("snav.enabled", false);
 
       // An input that resets the editor on every input by resetting the value property.
       let resetting_input = document.getElementById("resetting-input");
       resetting_input.addEventListener('input', function() {
         this.value = this.value;