Bug 1150529 - Remove code for expired telemetry histograms r=Yoric
authorTim Taubert <ttaubert@mozilla.com>
Sat, 02 May 2015 09:56:39 +0200
changeset 272236 f392bbb834961737b529b3b9253466a45e116a12
parent 272235 21fdba79d6bdb74e2e81608d3af9d499d65443c8
child 272237 d6e5fb263125dd6001cef011000b3a70cac8fc5f
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1150529
milestone40.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 1150529 - Remove code for expired telemetry histograms r=Yoric
browser/components/sessionstore/SessionFile.jsm
browser/components/sessionstore/SessionSaver.jsm
browser/components/sessionstore/SessionStore.jsm
browser/components/sessionstore/SessionWorker.js
browser/components/sessionstore/test/browser.ini
browser/components/sessionstore/test/browser_telemetry.js
toolkit/components/telemetry/Histograms.json
--- a/browser/components/sessionstore/SessionFile.jsm
+++ b/browser/components/sessionstore/SessionFile.jsm
@@ -67,32 +67,16 @@ this.SessionFile = {
   },
   /**
    * Write the contents of the session file, asynchronously.
    */
   write: function (aData) {
     return SessionFileInternal.write(aData);
   },
   /**
-   * Gather telemetry statistics.
-   *
-   *
-   * Most of the work is done off the main thread but there is a main
-   * thread cost involved to send data to the worker thread. This method
-   * should therefore be called only when we know that it will not disrupt
-   * the user's experience, e.g. on idle-daily.
-   *
-   * @return {Promise}
-   * @promise {object} An object holding all the information to be submitted
-   * to Telemetry.
-   */
-  gatherTelemetry: function(aData) {
-    return SessionFileInternal.gatherTelemetry(aData);
-  },
-  /**
    * Wipe the contents of the session file, asynchronously.
    */
   wipe: function () {
     return SessionFileInternal.wipe();
   },
 
   /**
    * Return the paths to the files used to store, backup, etc.
@@ -263,71 +247,48 @@ let SessionFileInternal = {
       maxUpgradeBackups: Preferences.get(PREF_MAX_UPGRADE_BACKUPS, 3),
       maxSerializeBack: Preferences.get(PREF_MAX_SERIALIZE_BACK, 10),
       maxSerializeForward: Preferences.get(PREF_MAX_SERIALIZE_FWD, -1)
     }]);
 
     return result;
   }),
 
-  gatherTelemetry: function(aStateString) {
-    return Task.spawn(function() {
-      let msg = yield SessionWorker.post("gatherTelemetry", [aStateString]);
-      this._recordTelemetry(msg.telemetry);
-      throw new Task.Result(msg.telemetry);
-    }.bind(this));
-  },
-
   write: function (aData) {
     if (RunState.isClosed) {
       return Promise.reject(new Error("SessionFile is closed"));
     }
 
     let isFinalWrite = false;
     if (RunState.isClosing) {
       // If shutdown has started, we will want to stop receiving
       // write instructions.
       isFinalWrite = true;
       RunState.setClosed();
     }
 
-    let refObj = {};
-    let name = "FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS";
-
-    let promise = new Promise(resolve => {
-      // Start measuring main thread impact.
-      TelemetryStopwatch.start(name, refObj);
-
-      let performShutdownCleanup = isFinalWrite &&
-        !sessionStartup.isAutomaticRestoreEnabled();
+    let performShutdownCleanup = isFinalWrite &&
+      !sessionStartup.isAutomaticRestoreEnabled();
 
-      let options = {isFinalWrite, performShutdownCleanup};
-
-      try {
-        resolve(SessionWorker.post("write", [aData, options]));
-      } finally {
-        // Record how long we stopped the main thread.
-        TelemetryStopwatch.finish(name, refObj);
-      }
-    });
+    let options = {isFinalWrite, performShutdownCleanup};
+    let promise = SessionWorker.post("write", [aData, options]);
 
     // Wait until the write is done.
     promise = promise.then(msg => {
       // Record how long the write took.
       this._recordTelemetry(msg.telemetry);
 
       if (msg.result.upgradeBackup) {
         // We have just completed a backup-on-upgrade, store the information
         // in preferences.
         Services.prefs.setCharPref(PREF_UPGRADE_BACKUP,
           Services.appinfo.platformBuildID);
       }
     }, err => {
       // Catch and report any errors.
-      TelemetryStopwatch.cancel(name, refObj);
       console.error("Could not write session state file ", err, err.stack);
       // By not doing anything special here we ensure that |promise| cannot
       // be rejected anymore. The shutdown/cleanup code at the end of the
       // function will thus always be executed.
     });
 
     // Ensure that we can write sessionstore.js cleanly before the profile
     // becomes unaccessible.
--- a/browser/components/sessionstore/SessionSaver.jsm
+++ b/browser/components/sessionstore/SessionSaver.jsm
@@ -241,30 +241,23 @@ let SessionSaverInternal = {
     // Write to disk.
     this._saveState();
   },
 
   /**
    * Write the given state object to disk.
    */
   _writeState: function (state) {
-    stopWatchStart("WRITE_STATE_LONGEST_OP_MS");
-
     // We update the time stamp before writing so that we don't write again
     // too soon, if saving is requested before the write completes. Without
     // this update we may save repeatedly if actions cause a runDelayed
     // before writing has completed. See Bug 902280
     this.updateLastSaveTime();
 
     // Write (atomically) to a session file, using a tmp file. Once the session
     // file is successfully updated, save the time stamp of the last save and
     // notify the observers.
-    let promise = SessionFile.write(state);
-    stopWatchFinish("WRITE_STATE_LONGEST_OP_MS");
-
-    promise = promise.then(() => {
+    return SessionFile.write(state).then(() => {
       this.updateLastSaveTime();
       notify(null, "sessionstore-state-write-complete");
     }, console.error);
-
-    return promise;
   },
 };
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -25,17 +25,16 @@ const NOTIFY_TAB_RESTORED = "sessionstor
 const MAX_CONCURRENT_TAB_RESTORES = 3;
 
 // global notifications observed
 const OBSERVING = [
   "browser-window-before-show", "domwindowclosed",
   "quit-application-requested", "browser-lastwindow-close-granted",
   "quit-application", "browser:purge-session-history",
   "browser:purge-domain-data",
-  "gather-telemetry",
   "idle-daily",
 ];
 
 // XUL Window properties to (re)store
 // Restored in restoreDimensions()
 const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
 
 // Hideable window features to (re)store
@@ -98,19 +97,16 @@ const CLOSED_MESSAGES = new Set([
 ]);
 
 // These are tab events that we listen to.
 const TAB_EVENTS = [
   "TabOpen", "TabClose", "TabSelect", "TabShow", "TabHide", "TabPinned",
   "TabUnpinned"
 ];
 
-// The number of milliseconds in a day
-const MS_PER_DAY = 1000.0 * 60.0 * 60.0 * 24.0;
-
 Cu.import("resource://gre/modules/Services.jsm", this);
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 Cu.import("resource://gre/modules/TelemetryTimestamps.jsm", this);
 Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
 Cu.import("resource://gre/modules/osfile.jsm", this);
 Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", this);
 Cu.import("resource://gre/modules/Promise.jsm", this);
 Cu.import("resource://gre/modules/Task.jsm", this);
@@ -586,19 +582,16 @@ let SessionStoreInternal = {
         this.onPurgeSessionHistory();
         break;
       case "browser:purge-domain-data":
         this.onPurgeDomainData(aData);
         break;
       case "nsPref:changed": // catch pref changes
         this.onPrefChange(aData);
         break;
-      case "gather-telemetry":
-        this.onGatherTelemetry();
-        break;
       case "idle-daily":
         this.onIdleDaily();
         break;
     }
   },
 
   /**
    * This method handles incoming messages sent by the session store content
@@ -1611,24 +1604,16 @@ let SessionStoreInternal = {
     // on a user preference we'll either restore all of them at once, or only
     // restore the selected tab and lazily restore the rest. We'll make no
     // efforts at this time to be smart and restore all of the tabs that had
     // been in a restored state at the time of the crash.
     let tab = aWindow.gBrowser.getTabForBrowser(aBrowser);
     this._resetLocalTabRestoringState(tab);
   },
 
-  onGatherTelemetry: function() {
-    // On the first gather-telemetry notification of the session,
-    // gather telemetry data.
-    Services.obs.removeObserver(this, "gather-telemetry");
-    let stateString = SessionStore.getBrowserState();
-    return SessionFile.gatherTelemetry(stateString);
-  },
-
   // Clean up data that has been closed a long time ago.
   // Do not reschedule a save. This will wait for the next regular
   // save.
   onIdleDaily: function() {
     // Remove old closed windows
     this._cleanupOldData([this._closedWindows]);
 
     // Remove closed tabs of closed windows
@@ -2400,17 +2385,16 @@ let SessionStoreInternal = {
     SessionCookies.update(windows);
 
     return { windows: windows };
   },
 
   _collectWindowData: function ssi_collectWindowData(aWindow) {
     if (!this._isWindowLoaded(aWindow))
       return;
-    TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
 
     let tabbrowser = aWindow.gBrowser;
     let tabs = tabbrowser.tabs;
     let winData = this._windows[aWindow.__SSi];
     let tabsData = winData.tabs = [];
 
     // update the internal state data for this window
     for (let tab of tabs) {
@@ -2422,17 +2406,16 @@ let SessionStoreInternal = {
 
     // Make sure we keep __SS_lastSessionWindowID around for cases like entering
     // or leaving PB mode.
     if (aWindow.__SS_lastSessionWindowID)
       this._windows[aWindow.__SSi].__lastSessionWindowID =
         aWindow.__SS_lastSessionWindowID;
 
     DirtyWindows.remove(aWindow);
-    TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
   },
 
   /* ........ Restoring Functionality .............. */
 
   /**
    * restore features to a single window
    * @param aWindow
    *        Window reference to the window to use for restoration
@@ -3072,24 +3055,16 @@ let SessionStoreInternal = {
    *
    * @param state
    *        The session state.
    */
   _updateSessionStartTime: function ssi_updateSessionStartTime(state) {
     // Attempt to load the session start time from the session state
     if (state.session && state.session.startTime) {
       this._sessionStartTime = state.session.startTime;
-
-      // ms to days
-      let sessionLength = (Date.now() - this._sessionStartTime) / MS_PER_DAY;
-
-      if (sessionLength > 0) {
-        // Submit the session length telemetry measurement
-        Services.telemetry.getHistogramById("FX_SESSION_RESTORE_SESSION_LENGTH").add(sessionLength);
-      }
     }
   },
 
   /**
    * call a callback for all currently opened browser windows
    * (might miss the most recent one)
    * @param aFunc
    *        Callback each window is passed to
--- a/browser/components/sessionstore/SessionWorker.js
+++ b/browser/components/sessionstore/SessionWorker.js
@@ -279,26 +279,16 @@ let Agent = {
       telemetry: {
         FX_SESSION_RESTORE_WRITE_FILE_MS: stopWriteMs - startWriteMs,
         FX_SESSION_RESTORE_FILE_SIZE_BYTES: data.byteLength,
       }
     };
   },
 
   /**
-   * Extract all sorts of useful statistics from a state string,
-   * for use with Telemetry.
-   *
-   * @return {object}
-   */
-  gatherTelemetry: function (stateString) {
-    return Statistics.collect(stateString);
-  },
-
-  /**
    * Wipes all files holding session data from disk.
    */
   wipe: function () {
 
     // Don't stop immediately in case of error.
     let exn = null;
 
     // Erase main session state file
@@ -383,136 +373,8 @@ function isNoSuchFileEx(aReason) {
 
 /**
  * Estimate the number of bytes that a data structure will use on disk
  * once serialized.
  */
 function getByteLength(str) {
   return Encoder.encode(JSON.stringify(str)).byteLength;
 }
-
-/**
- * Tools for gathering statistics on a state string.
- */
-let Statistics = {
-  collect: function(stateString) {
-    let start = Date.now();
-    let TOTAL_PREFIX = "FX_SESSION_RESTORE_TOTAL_";
-    let INDIVIDUAL_PREFIX = "FX_SESSION_RESTORE_INDIVIDUAL_";
-    let SIZE_SUFFIX = "_SIZE_BYTES";
-
-    let state = JSON.parse(stateString);
-
-    // Gather all data
-    let subsets = {};
-    this.gatherSimpleData(state, subsets);
-    this.gatherComplexData(state, subsets);
-
-    // Extract telemetry
-    let telemetry = {};
-    for (let k of Object.keys(subsets)) {
-      let obj = subsets[k];
-      telemetry[TOTAL_PREFIX + k + SIZE_SUFFIX] = getByteLength(obj);
-
-      if (Array.isArray(obj)) {
-        let size = obj.map(getByteLength);
-        telemetry[INDIVIDUAL_PREFIX + k + SIZE_SUFFIX] = size;
-      }
-    }
-
-    let stop = Date.now();
-    telemetry["FX_SESSION_RESTORE_EXTRACTING_STATISTICS_DURATION_MS"] = stop - start;
-    return {
-      telemetry: telemetry
-    };
-  },
-
-  /**
-   * Collect data that doesn't require a recursive walk through the
-   * data structure.
-   */
-  gatherSimpleData: function(state, subsets) {
-    // The subset of sessionstore.js dealing with open windows
-    subsets.OPEN_WINDOWS = state.windows;
-
-    // The subset of sessionstore.js dealing with closed windows
-    subsets.CLOSED_WINDOWS = state._closedWindows;
-
-    // The subset of sessionstore.js dealing with closed tabs
-    // in open windows
-    subsets.CLOSED_TABS_IN_OPEN_WINDOWS = [];
-
-    // The subset of sessionstore.js dealing with cookies
-    // in both open and closed windows
-    subsets.COOKIES = [];
-
-    for (let winData of state.windows) {
-      let closedTabs = winData._closedTabs || [];
-      subsets.CLOSED_TABS_IN_OPEN_WINDOWS.push(...closedTabs);
-
-      let cookies = winData.cookies || [];
-      subsets.COOKIES.push(...cookies);
-    }
-
-    for (let winData of state._closedWindows) {
-      let cookies = winData.cookies || [];
-      subsets.COOKIES.push(...cookies);
-    }
-  },
-
-  /**
-   * Walk through a data structure, recursively.
-   *
-   * @param {object} root The object from which to start walking.
-   * @param {function(key, value)} cb Callback, called for each
-   * item except the root. Returns |true| to walk the subtree rooted
-   * at |value|, |false| otherwise   */
-  walk: function(root, cb) {
-    if (!root || typeof root !== "object") {
-      return;
-    }
-    for (let k of Object.keys(root)) {
-      let obj = root[k];
-      let stepIn = cb(k, obj);
-      if (stepIn) {
-        this.walk(obj, cb);
-      }
-    }
-  },
-
-  /**
-   * Collect data that requires walking through the data structure
-   */
-  gatherComplexData: function(state, subsets) {
-    // The subset of sessionstore.js dealing with DOM storage
-    subsets.DOM_STORAGE = [];
-    // The subset of sessionstore.js storing form data
-    subsets.FORMDATA = [];
-    // The subset of sessionstore.js storing history
-    subsets.HISTORY = [];
-
-
-    this.walk(state, function(k, value) {
-      let dest;
-      switch (k) {
-        case "entries":
-          subsets.HISTORY.push(value);
-          return true;
-        case "storage":
-          subsets.DOM_STORAGE.push(value);
-          // Never visit storage, it's full of weird stuff
-          return false;
-        case "formdata":
-          subsets.FORMDATA.push(value);
-          // Never visit formdata, it's full of weird stuff
-          return false;
-        case "cookies": // Don't visit these places, they are full of weird stuff
-        case "extData":
-          return false;
-        default:
-          return true;
-      }
-    });
-
-    return subsets;
-  },
-
-};
--- a/browser/components/sessionstore/test/browser.ini
+++ b/browser/components/sessionstore/test/browser.ini
@@ -96,17 +96,16 @@ skip-if = buildapp == 'mulet'
 [browser_sessionHistory.js]
 # Disabled because of bug 1077581
 skip-if = e10s
 [browser_sessionStorage.js]
 [browser_swapDocShells.js]
 skip-if = e10s # See bug 918634
 [browser_switch_remoteness.js]
 run-if = e10s
-[browser_telemetry.js]
 [browser_upgrade_backup.js]
 [browser_windowRestore_perwindowpb.js]
 [browser_248970_b_perwindowpb.js]
 # Disabled because of leaks.
 # Re-enabling and rewriting this test is tracked in bug 936919.
 skip-if = true
 [browser_339445.js]
 [browser_345898.js]
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_telemetry.js
+++ /dev/null
@@ -1,270 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-let tmp = {};
-Cu.import("resource:///modules/sessionstore/SessionFile.jsm", tmp);
-let {SessionFile} = tmp;
-
-// Shortcuts for histogram names
-let Keys = {};
-for (let k of ["HISTORY", "FORMDATA", "OPEN_WINDOWS", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS", "DOM_STORAGE"]) {
-  Keys[k] = "FX_SESSION_RESTORE_TOTAL_" + k + "_SIZE_BYTES";
-}
-
-function lt(a, b, message) {
-  isnot(a, undefined, message + " (sanity check)");
-  isnot(b, undefined, message + " (sanity check)");
-  ok(a < b, message + " ( " + a + " < " + b + ")");
-}
-function gt(a, b, message) {
-  isnot(a, undefined, message + " (sanity check)");
-  isnot(b, undefined, message + " (sanity check)");
-  ok(a > b, message + " ( " + a + " > " + b + ")");
-}
-
-add_task(function init() {
-  forgetClosedWindows();
-  for (let i = ss.getClosedTabCount(window) - 1; i >= 0; --i) {
-    ss.forgetClosedTab(window, i);
-  }
-});
-
-/**
- * Test that Telemetry collection doesn't cause any error.
- */
-add_task(function() {
-  info("Checking a little bit of consistency");
-  let statistics = yield promiseStats();
-
-  for (let k of Object.keys(statistics)) {
-    let data = statistics[k];
-    info("Data for " + k + ": " + data);
-    if (Array.isArray(data)) {
-      ok(data.every(x => x >= 0), "Data for " + k + " is >= 0");
-    } else {
-      ok(data >= 0, "Data for " + k + " is >= 0");
-    }
-  }
-});
-
-/**
- * Test HISTORY key.
- */
-add_task(function history() {
-  let KEY = Keys.HISTORY;
-  let tab = gBrowser.addTab("http://example.org:80/?");
-  yield promiseBrowserLoaded(tab.linkedBrowser);
-  try {
-    TabState.flush(tab.linkedBrowser);
-    let statistics = yield promiseStats();
-
-    info("Now changing history");
-    tab.linkedBrowser.loadURI("http://example.org:80/1");
-    yield promiseBrowserLoaded(tab.linkedBrowser);
-    TabState.flush(tab.linkedBrowser);
-    let statistics2 = yield promiseStats();
-
-    // We have changed history, so it must have increased
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of HISTORY has increased");
-
-// Almost nothing else should
-    for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-  } finally {
-    if (tab) {
-      yield promiseRemoveTab(tab);
-    }
-  }
-});
-
-/**
- * Test CLOSED_TABS_IN_OPEN_WINDOWS key.
- */
-add_task(function close_tab() {
-  let KEY = Keys.CLOSED_TABS_IN_OPEN_WINDOWS;
-  let tab = gBrowser.addTab("http://example.org:80/?close_tab");
-  yield promiseBrowserLoaded(tab.linkedBrowser);
-  try {
-    TabState.flush(tab.linkedBrowser);
-    let statistics = yield promiseStats();
-
-    info("Now closing a tab");
-    yield promiseRemoveTab(tab);
-    tab = null;
-    let statistics2 = yield promiseStats();
-
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of CLOSED_TABS_IN_OPEN_WINDOWS has increased");
-
-    // Almost nothing else should change
-    for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-
-  } finally {
-    if (tab) {
-      yield promiseRemoveTab(tab);
-    }
-  }
-});
-
-/**
- * Test OPEN_WINDOWS key.
- */
-add_task(function open_window() {
-  let KEY = Keys.OPEN_WINDOWS;
-  let win;
-  try {
-    let statistics = yield promiseStats();
-    win = yield promiseNewWindowLoaded("http://example.org:80/?open_window");
-    let statistics2 = yield promiseStats();
-
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of OPEN_WINDOWS has increased");
-
-    // Almost nothing else should change
-    for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-
-  } finally {
-    if (win) {
-      yield promiseWindowClosed(win);
-    }
-  }
-});
-
-/**
- * Test CLOSED_WINDOWS key.
- */
-add_task(function close_window() {
-  let KEY = Keys.CLOSED_WINDOWS;
-  let win = yield promiseNewWindowLoaded("http://example.org:80/?close_window");
-
-  // We need to add something to the window, otherwise it won't be saved
-  let tab = win.gBrowser.addTab("http://example.org:80/?close_tab");
-  yield promiseBrowserLoaded(tab.linkedBrowser);
-  try {
-    let statistics = yield promiseStats();
-    yield promiseWindowClosed(win);
-    win = null;
-    let statistics2 = yield promiseStats();
-
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of CLOSED_WINDOWS has increased");
-    lt(statistics2[Keys.OPEN_WINDOWS], statistics[Keys.OPEN_WINDOWS], "The total size of OPEN_WINDOWS has decreased");
-
-    // Almost nothing else should change
-    for (let k of ["FORMDATA", "DOM_STORAGE", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-
-  } finally {
-    if (win) {
-      yield promiseWindowClosed(win);
-    }
-  }
-});
-
-
-/**
- * Test DOM_STORAGE key.
- */
-add_task(function dom_storage() {
-  let KEY = Keys.DOM_STORAGE;
-  let tab = gBrowser.addTab("http://example.org:80/?dom_storage");
-  yield promiseBrowserLoaded(tab.linkedBrowser);
-  try {
-    TabState.flush(tab.linkedBrowser);
-    let statistics = yield promiseStats();
-
-    info("Now adding some storage");
-    yield modifySessionStorage(tab.linkedBrowser, {foo: "bar"});
-    TabState.flush(tab.linkedBrowser);
-
-    let statistics2 = yield promiseStats();
-
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of DOM_STORAGE has increased");
-
-    // Almost nothing else should change
-    for (let k of ["CLOSED_TABS_IN_OPEN_WINDOWS", "FORMDATA", "CLOSED_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-
-  } finally {
-    if (tab) {
-      yield promiseRemoveTab(tab);
-    }
-  }
-});
-
-/**
- * Test FORMDATA key.
- */
-add_task(function formdata() {
-  let KEY = Keys.FORMDATA;
-  let tab = gBrowser.addTab("data:text/html;charset=utf-8,<input%20id='input'>");
-  yield promiseBrowserLoaded(tab.linkedBrowser);
-  try {
-    TabState.flush(tab.linkedBrowser);
-    let statistics = yield promiseStats();
-
-    info("Now changing form data");
-
-    yield setInputValue(tab.linkedBrowser, {id: "input", value: "This is some form data"});
-    TabState.flush(tab.linkedBrowser);
-
-    let statistics2 = yield promiseStats();
-
-    isnot(statistics[KEY], undefined, "Key was defined");
-    isnot(statistics2[KEY], undefined, "Key is still defined");
-    gt(statistics2[KEY], statistics[KEY], "The total size of FORMDATA has increased");
-
-    // Almost nothing else should
-    for (let k of ["DOM_STORAGE", "CLOSED_WINDOWS", "CLOSED_TABS_IN_OPEN_WINDOWS"]) {
-      is(statistics2[Keys[k]], statistics[Keys[k]], "The total size of " + k + " has not increased");
-    }
-  } finally {
-    if (tab) {
-      yield promiseRemoveTab(tab);
-    }
-  }
-});
-
-add_task(function* test_sessionRestoreInit() {
-   let info = Cc["@mozilla.org/toolkit/app-startup;1"].
-     getService(Ci.nsIAppStartup).
-     getStartupInfo();
-  ok(info.sessionRestoreInit > info.process, "sessionRestoreInit is after process creation");
-  ok(info.sessionRestoreInit <
-    Date.now() + 10000 /* Date.now() is non-monotonic, let's play it paranoid*/,
-    "sessionRestoreInit is before now");
-});
-
-/**
- * Get the latest statistics.
- */
-function promiseStats() {
-  let state = ss.getBrowserState();
-  info("Stats: " + state);
-  return SessionFile.gatherTelemetry(state);
-}
-
-
-function modifySessionStorage(browser, data) {
-  browser.messageManager.sendAsyncMessage("ss-test:modifySessionStorage", data);
-  return promiseContentMessage(browser, "ss-test:MozStorageChanged");
-}
-
-function setInputValue(browser, data) {
-  return sendMessage(browser, "ss-test:setInputValue", data);
-}
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3948,24 +3948,16 @@
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "30000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time to collect all window data (ms)"
   },
-  "FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "30000",
-    "n_buckets": 10,
-    "extended_statistics_ok": true,
-    "description": "Session restore: Time to collect the data of a single window (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
   "FX_SESSION_RESTORE_COLLECT_COOKIES_MS": {
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "30000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time to collect cookies (ms)"
@@ -4010,41 +4002,25 @@
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "default",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time to read the session data from the file on disk (ms)"
   },
-  "FX_SESSION_RESTORE_WRITE_STATE_LONGEST_OP_MS": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "3000",
-    "n_buckets": 10,
-    "extended_statistics_ok": true,
-    "description": "Session restore: Time spent on the main thread serializing, broadcasting and sending the session data for writing (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
   "FX_SESSION_RESTORE_WRITE_FILE_MS": {
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "default",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time to write the session data to the file on disk (ms)"
   },
-  "FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "3000",
-    "n_buckets": 10,
-    "extended_statistics_ok": true,
-    "description": "Session restore: Duration of the longest uninterruptible operation while writing session data (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
   "FX_SESSION_RESTORE_FILE_SIZE_BYTES": {
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "default",
     "kind": "exponential",
     "high": 50000000,
     "n_buckets": 30,
     "extended_statistics_ok": true,
     "description": "Session restore: The size of file sessionstore.js (bytes)"
@@ -4065,132 +4041,16 @@
     "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
     "expires_in_version": "default",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time spent blocking the main thread while restoring a window state (ms)"
   },
-  "FX_SESSION_RESTORE_SESSION_LENGTH": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "365",
-    "n_buckets": 15,
-    "description": "Session restore: Days elapsed since the session was first started *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_EXTRACTING_STATISTICS_DURATION_MS": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "3000",
-    "n_buckets": 10,
-    "extended_statistics_ok": true,
-    "description": "Session restore: Duration of the off main thread statistics extraction mechanism (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_OPEN_WINDOWS_SIZE_BYTES": {
-    "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "default",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "Session restore: The subset of sessionrestore.js representing open windows (total size, in bytes)"
-  },
-  "FX_SESSION_RESTORE_TOTAL_CLOSED_WINDOWS_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "Session restore: The subset of sessionrestore.js representing closed windows (total size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_CLOSED_TABS_IN_OPEN_WINDOWS_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "Sessionrestore: The subset of sesionstore.js representing closed tabs in open windows (total size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_COOKIES_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with cookies (total size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_DOM_STORAGE_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with DOM storage (total size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_FORMDATA_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with storing form data (total size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_TOTAL_HISTORY_SIZE_BYTES": {
-    "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "default",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with storing history (total size, in bytes)"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_OPEN_WINDOWS_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "Session restore: The subset of sessionrestore.js representing open windows (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_CLOSED_WINDOWS_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "Session restore: The subset of sessionrestore.js representing closed windows (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_CLOSED_TABS_IN_OPEN_WINDOWS_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "Sessionrestore: The subset of sesionstore.js representing closed tabs in open windows (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_COOKIES_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "50000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with cookies (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_DOM_STORAGE_SIZE_BYTES": {
-    "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "default",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with DOM storage (item size, in bytes)"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_FORMDATA_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with storing form data (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
-  "FX_SESSION_RESTORE_INDIVIDUAL_HISTORY_SIZE_BYTES": {
-    "expires_in_version": "40",
-    "kind": "exponential",
-    "high": "5000000",
-    "n_buckets": 30,
-    "description": "The subset of sessionstore.js dealing with storing history (item size, in bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
-  },
   "INNERWINDOWS_WITH_MUTATION_LISTENERS": {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "Deleted or to-be-reused innerwindow which has had mutation event listeners."
   },
   "CHARSET_OVERRIDE_SITUATION": {
     "expires_in_version": "default",
     "kind": "enumerated",