Bug 1023565 - Remove setTimeout() when restoring contentEditable values. r=smacleod, a=sledru
authorTim Taubert <ttaubert@mozilla.com>
Wed, 28 Jan 2015 15:06:19 +0100
changeset 243594 9ecb9e803a81
parent 243593 40c010f30f39
child 243595 cf270a9a66ad
push id4406
push userryanvm@gmail.com
push date2015-01-29 21:23 +0000
treeherdermozilla-beta@cf270a9a66ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmacleod, sledru
bugs1023565
milestone36.0
Bug 1023565 - Remove setTimeout() when restoring contentEditable values. r=smacleod, a=sledru
toolkit/modules/sessionstore/FormData.jsm
--- a/toolkit/modules/sessionstore/FormData.jsm
+++ b/toolkit/modules/sessionstore/FormData.jsm
@@ -4,17 +4,16 @@
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["FormData"];
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 
-Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://gre/modules/XPathGenerator.jsm");
 
 /**
  * Returns whether the given URL very likely has input
  * fields that contain serialized session store data.
  */
 function isRestorationPage(url) {
   return url == "about:sessionrestore" || url == "about:welcomeback";
@@ -257,27 +256,20 @@ let FormDataInternal = {
     }
 
     if ("xpath" in data) {
       let retrieveNode = xpath => XPathGenerator.resolve(doc, xpath);
       this.restoreManyInputValues(data.xpath, retrieveNode);
     }
 
     if ("innerHTML" in data) {
-      // We know that the URL matches data.url right now, but the user
-      // may navigate away before the setTimeout handler runs. We do
-      // a simple comparison against savedURL to check for that.
-      let savedURL = doc.documentURI;
-
-      setTimeout(() => {
-        if (doc.body && doc.designMode == "on" && doc.documentURI == savedURL) {
-          doc.body.innerHTML = data.innerHTML;
-          this.fireEvent(doc.body, "input");
-        }
-      });
+      if (doc.body && doc.designMode == "on") {
+        doc.body.innerHTML = data.innerHTML;
+        this.fireEvent(doc.body, "input");
+      }
     }
   },
 
   /**
    * Iterates the given form data, retrieving nodes for all the keys and
    * restores their appropriate values.
    *
    * @param data (object)