Bug 1262661 - clear the MessageQueue after send. r=mconley, a=ritu
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Tue, 03 May 2016 22:38:36 +0200
changeset 332975 f183c8ff58dfdef3776e7274dfba582140c74439
parent 332974 ad804098d30c0b227c73e344c9addd9e5a7c3e09
child 332976 9d03f056f72832318a4328205d740862a0dc5bc0
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, ritu
bugs1262661
milestone48.0a2
Bug 1262661 - clear the MessageQueue after send. r=mconley, a=ritu
browser/components/sessionstore/content/content-sessionStore.js
--- a/browser/components/sessionstore/content/content-sessionStore.js
+++ b/browser/components/sessionstore/content/content-sessionStore.js
@@ -214,16 +214,23 @@ var SessionHistoryListener = {
     // We will likely only collect once since we are batching collection on
     // a delay.
     docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory.
       addSHistoryListener(this);
 
     // Collect data if we start with a non-empty shistory.
     if (!SessionHistory.isEmpty(docShell)) {
       this.collect();
+      // When a tab is detached from the window, for the new window there is a
+      // new SessionHistoryListener created. Normally it is empty at this point
+      // but in a test env. the initial about:blank might have a children in which
+      // case we fire off a history message here with about:blank in it. If we
+      // don't do it ASAP then there is going to be a browser swap and the parent
+      // will be all confused by that message.
+      MessageQueue.send();
     }
 
     // Listen for page title changes.
     addEventListener("DOMTitleChanged", this);
   },
 
   uninit: function () {
     let sessionHistory = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
@@ -708,16 +715,18 @@ var MessageQueue = {
         for (let histogramId of Object.keys(value)) {
           telemetry[histogramId] = value[histogramId];
         }
       } else {
         data[key] = value;
       }
     }
 
+    this._data.clear();
+
     durationMs = Date.now() - durationMs;
     telemetry.FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS = durationMs;
 
     try {
       // Send all data to the parent process.
       sendAsyncMessage("SessionStore:update", {
         data, telemetry, flushID,
         isFinal: options.isFinal || false,