Bug 1022403 - Fix intermittent browser_sessionHistory.js timeouts by making sure the weak shistory listener isn't GC'ed before we saw the notification. r=smacleod, a=test-only
authorTim Taubert <ttaubert@mozilla.com>
Wed, 04 Mar 2015 16:45:27 +0100
changeset 250275 f64d1d504422
parent 250274 33176406bcfe
child 250276 52600b8172cf
push id4533
push userryanvm@gmail.com
push date2015-03-06 18:38 +0000
treeherdermozilla-beta@f64d1d504422 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmacleod, test-only
bugs1022403
milestone37.0
Bug 1022403 - Fix intermittent browser_sessionHistory.js timeouts by making sure the weak shistory listener isn't GC'ed before we saw the notification. r=smacleod, a=test-only
browser/components/sessionstore/test/content.js
--- a/browser/components/sessionstore/test/content.js
+++ b/browser/components/sessionstore/test/content.js
@@ -20,20 +20,17 @@ gFrameTree.addObserver({
     sendAsyncMessage("ss-test:onFrameTreeReset");
   },
 
   onFrameTreeCollected: function () {
     sendAsyncMessage("ss-test:onFrameTreeCollected");
   }
 });
 
-
-docShell.QueryInterface(Ci.nsIWebNavigation).
-  sessionHistory.addSHistoryListener({
-
+let historyListener = {
   OnHistoryNewEntry: function () {
     sendAsyncMessage("ss-test:OnHistoryNewEntry");
   },
 
   OnHistoryGoBack: function () {
     sendAsyncMessage("ss-test:OnHistoryGoBack");
     return true;
   },
@@ -61,17 +58,20 @@ docShell.QueryInterface(Ci.nsIWebNavigat
   OnHistoryReplaceEntry: function () {
     sendAsyncMessage("ss-test:OnHistoryReplaceEntry");
   },
 
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsISHistoryListener,
     Ci.nsISupportsWeakReference
   ])
-});
+};
+
+docShell.QueryInterface(Ci.nsIWebNavigation).
+  sessionHistory.addSHistoryListener(historyListener);
 
 /**
  * This frame script is only loaded for sessionstore mochitests. It enables us
  * to modify and query docShell data when running with multiple processes.
  */
 
 addEventListener("hashchange", function () {
   sendAsyncMessage("ss-test:hashchange");