Backout 65804eae62b1, a0b216d3be12, 68e5d9fe91fc (bug 837326) for impending bustage that would make this CLOSED TREE worse than it already is
authorNathan Froyd <froydnj@mozilla.com>
Fri, 21 Jun 2013 15:39:45 -0400
changeset 148349 8ce7857353a6880f79dad8e7be150850d41bc750
parent 148348 65804eae62b149a597b4c01e6189ac778dc5c21b
child 148350 0c5c910798b7fb0b04c596b1edb0db33cb0525d4
push id368
push userbbajaj@mozilla.com
push dateMon, 09 Sep 2013 22:57:58 +0000
treeherdermozilla-release@5a4f47ae1217 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs837326
milestone24.0a1
backs out65804eae62b149a597b4c01e6189ac778dc5c21b
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
Backout 65804eae62b1, a0b216d3be12, 68e5d9fe91fc (bug 837326) for impending bustage that would make this CLOSED TREE worse than it already is
netwerk/cookie/nsCookieService.cpp
netwerk/cookie/nsCookieService.h
netwerk/cookie/nsICookieService.idl
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/Makefile.in
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/ThirdPartyCookieProbe.jsm
toolkit/components/telemetry/moz.build
toolkit/components/telemetry/tests/unit/head.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_ThirdPartyCookieProbe.js
toolkit/components/telemetry/tests/unit/xpcshell.ini
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1641,33 +1641,23 @@ nsCookieService::SetCookieStringInternal
     return;
   }
 
   nsCookieKey key(baseDomain, aAppId, aInBrowserElement);
 
   // check default prefs
   CookieStatus cookieStatus = CheckPrefs(aHostURI, aIsForeign, requireHostMatch,
                                          aCookieHeader.get());
-  // fire a notification if third party or if cookie was rejected
-  // (but not if there was an error)
+  // fire a notification if cookie was rejected (but not if there was an error)
   switch (cookieStatus) {
   case STATUS_REJECTED:
     NotifyRejected(aHostURI);
-    if (aIsForeign) {
-      NotifyThirdParty(aHostURI, false, aChannel);
-    }
-    return; // Stop here
+    return;
   case STATUS_REJECTED_WITH_ERROR:
     return;
-  case STATUS_ACCEPTED: // Fallthrough
-  case STATUS_ACCEPT_SESSION:
-    if (aIsForeign) {
-      NotifyThirdParty(aHostURI, true, aChannel);
-    }
-    break;
   default:
     break;
   }
 
   // parse server local time. this is not just done here for efficiency
   // reasons - if there's an error parsing it, and we need to default it
   // to the current time, we must do it here since the current time in
   // SetCookieInternal() will change for each cookie processed (e.g. if the
@@ -1690,48 +1680,18 @@ nsCookieService::SetCookieStringInternal
       break;
   }
 }
 
 // notify observers that a cookie was rejected due to the users' prefs.
 void
 nsCookieService::NotifyRejected(nsIURI *aHostURI)
 {
-  if (mObserverService) {
+  if (mObserverService)
     mObserverService->NotifyObservers(aHostURI, "cookie-rejected", nullptr);
-  }
-}
-
-// notify observers that a third-party cookie was accepted/rejected
-// if the cookie issuer is unknown, it defaults to "?"
-void
-nsCookieService::NotifyThirdParty(nsIURI *aHostURI, bool aIsAccepted, nsIChannel *aChannel)
-{
-  if (!mObserverService) {
-    return;
-  }
-  const char* topic = aIsAccepted ? "third-party-cookie-accepted"
-    : "third-party-cookie-rejected";
-
-  if (aChannel) {
-    nsCOMPtr<nsIURI> channelURI;
-    DebugOnly<nsresult> rv = aChannel->GetURI(getter_AddRefs(channelURI));
-    NS_ASSERTION(NS_SUCCEEDED(rv), "Channel doesn't have a uri");
-    nsAutoCString referringHost;
-    rv = channelURI->GetHost(referringHost);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "URI doesn't have a host");
-    nsAutoString referringHostUTF16 = NS_ConvertUTF8toUTF16(referringHost);
-    mObserverService->NotifyObservers(aHostURI,
-                                      topic,
-                                      referringHostUTF16.get());
-  } else {
-    mObserverService->NotifyObservers(aHostURI,
-                                      topic,
-                                      NS_LITERAL_STRING("?").get());
-  }
 }
 
 // notify observers that the cookie list changed. there are five possible
 // values for aData:
 // "deleted" means a cookie was deleted. aSubject is the deleted cookie.
 // "added"   means a cookie was added. aSubject is the added cookie.
 // "changed" means a cookie was altered. aSubject is the new cookie.
 // "cleared" means the entire cookie list was cleared. aSubject is null.
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -282,17 +282,16 @@ class nsCookieService : public nsICookie
     bool                          CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI, const nsCString &aBaseDomain, bool aRequireHostMatch);
     static bool                   CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI);
     static bool                   GetExpiry(nsCookieAttributes &aCookie, int64_t aServerTime, int64_t aCurrentTime);
     void                          RemoveAllFromMemory();
     already_AddRefed<nsIArray>    PurgeCookies(int64_t aCurrentTimeInUsec);
     bool                          FindCookie(const nsCookieKey& aKey, const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter);
     static void                   FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsListIter &aIter);
     void                          NotifyRejected(nsIURI *aHostURI);
-    void                          NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel);
     void                          NotifyChanged(nsISupports *aSubject, const PRUnichar *aData);
     void                          NotifyPurged(nsICookie2* aCookie);
     already_AddRefed<nsIArray>    CreatePurgeList(nsICookie2* aCookie);
 
     /**
      * This method is used to iterate the cookie hash table and select the ones
      * that are part of a specific app.
      */
--- a/netwerk/cookie/nsICookieService.idl
+++ b/netwerk/cookie/nsICookieService.idl
@@ -53,28 +53,16 @@ interface nsIChannel;
  *          the entire cookie list should be reloaded.  the subject is null.
  *
  * topic  : "cookie-rejected"
  *          broadcast whenever a cookie was rejected from being set as a
  *          result of user prefs.
  * subject: an nsIURI interface pointer representing the URI that attempted
  *          to set the cookie.
  * data   : none.
- *
- * topic  : "third-party-cookie-accepted"
- *           broadcast whenever a third party cookie was accepted
- * subject:  an nsIURI interface pointer representing the URI that attempted
- *           to set the cookie.
- * data   :  the referrer, or "?" if unknown
- *
- * topic  : "third-party-cookie-rejected"
- *           broadcast whenever a third party cookie was rejected
- * subject:  an nsIURI interface pointer representing the URI that attempted
- *           to set the cookie.
- * data   :  the referrer, or "?" if unknown
  */
 [scriptable, uuid(2aaa897a-293c-4d2b-a657-8c9b7136996d)]
 interface nsICookieService : nsISupports
 {
   /*
    * Get the complete cookie string associated with the URI.
    *
    * @param aURI
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3315,44 +3315,16 @@
     "description": "The time (in milliseconds) that it took a 'detach' request to go round trip."
   },
   "DEVTOOLS_DEBUGGER_RDP_REMOTE_TABDETACH_MS": {
     "kind": "exponential",
     "high": "10000",
     "n_buckets": "1000",
     "description": "The time (in milliseconds) that it took a 'detach' request to go round trip."
   },
-  "COOKIES_3RDPARTY_NUM_SITES_ACCEPTED": {
-    "kind": "linear",
-    "low": "5",
-    "high": "145",
-    "n_buckets": "30",
-    "description": "The number of distinct pairs (first-party site, third-party site attempting to set cookie) for which the third-party cookie has been accepted. Sites are considered identical if they have the same eTLD + 1. Measures are normalized per 24h."
-  },
-  "COOKIES_3RDPARTY_NUM_SITES_BLOCKED": {
-    "kind": "linear",
-    "low": "5",
-    "high": "145",
-    "n_buckets": "30",
-    "description": "The number of distinct pairs (first-party site, third-party site attempting to set cookie) for which the third-party cookie has been rejected. Sites are considered identical if they have the same eTLD + 1. Measures are normalized per 24h."
-  },
-  "COOKIES_3RDPARTY_NUM_ATTEMPTS_ACCEPTED": {
-    "kind": "linear",
-    "low": "10",
-    "high": "500",
-    "n_buckets": "50",
-    "description": "The total number of distinct attempts by third-party sites to place cookies which have been accepted.  Measures are normalized per 24h."
-  },
-  "COOKIES_3RDPARTY_NUM_ATTEMPTS_BLOCKED": {
-    "kind": "linear",
-    "low": "10",
-    "high": "500",
-    "n_buckets": "50",
-    "description": "The total number of distinct attempts by third-party sites to place cookies which have been rejected.  Measures are normalized per 24h."
-  },
   "DEVTOOLS_DEBUGGER_RDP_LOCAL_BLACKBOX_MS": {
     "kind": "exponential",
     "high": "10000",
     "n_buckets": "1000",
     "description": "The time (in milliseconds) that it took a 'blackbox' request to go round trip."
   },
   "DEVTOOLS_DEBUGGER_RDP_REMOTE_BLACKBOX_MS": {
     "kind": "exponential",
--- a/toolkit/components/telemetry/Makefile.in
+++ b/toolkit/components/telemetry/Makefile.in
@@ -23,17 +23,16 @@ LIBRARY_NAME = telemetry
 MSVC_ENABLE_PGO := 1
 
 DISABLED_EXTRA_COMPONENTS = \
   TelemetryPing.manifest \
   $(NULL)
 
 EXTRA_JS_MODULES = \
   TelemetryStopwatch.jsm \
-  ThirdPartyCookieProbe.jsm \
   $(NULL)
 
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/threads
 
 EXTRA_DSO_LDOPTS += \
   $(MOZ_COMPONENT_LIBS) \
   $(MOZ_JS_LIBS) \
--- a/toolkit/components/telemetry/TelemetryPing.js
+++ b/toolkit/components/telemetry/TelemetryPing.js
@@ -10,17 +10,16 @@ const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 #ifndef MOZ_WIDGET_GONK
 Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
 #endif
 Cu.import("resource://gre/modules/ctypes.jsm");
-Cu.import("resource://gre/modules/ThirdPartyCookieProbe.jsm");
 
 // When modifying the payload in incompatible ways, please bump this version number
 const PAYLOAD_VERSION = 1;
 
 // This is the HG changeset of the Histogram.json file, used to associate
 // submitted ping data with its histogram definition (bug 832007)
 #expand const HISTOGRAMS_FILE_VERSION = "__HISTOGRAMS_FILE_VERSION__";
 
@@ -757,20 +756,16 @@ TelemetryPing.prototype = {
       this._isIdleObserver = false;
     }
   },
 
   /**
    * Initializes telemetry within a timer. If there is no PREF_SERVER set, don't turn on telemetry.
    */
   setup: function setup() {
-    // Initialize some probes that are kept in their own modules
-    this._thirdPartyCookies = new ThirdPartyCookieProbe();
-    this._thirdPartyCookies.init();
-
     // Record old value and update build ID preference if this is the first
     // run with a new build ID.
     let previousBuildID = undefined;
     try {
       previousBuildID = Services.prefs.getCharPref(PREF_PREVIOUS_BUILDID);
     } catch (e) {
       // Preference was not set.
     }
@@ -1002,17 +997,17 @@ TelemetryPing.prototype = {
     this.savePingToFile(this.getSessionPayloadAndSlug("saved-session"),
                         file, sync, true);
   },
 
   /** 
    * Remove observers to avoid leaks
    */
   uninstall: function uninstall() {
-    this.detachObservers();
+    this.detachObservers()
     if (this._hasWindowRestoredObserver) {
       Services.obs.removeObserver(this, "sessionstore-windows-restored");
       this._hasWindowRestoredObserver = false;
     }
     if (this._hasXulWindowVisibleObserver) {
       Services.obs.removeObserver(this, "xul-window-visible");
       this._hasXulWindowVisibleObserver = false;
     }
deleted file mode 100644
--- a/toolkit/components/telemetry/ThirdPartyCookieProbe.jsm
+++ /dev/null
@@ -1,180 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-let Ci = Components.interfaces;
-let Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-this.EXPORTED_SYMBOLS = ["ThirdPartyCookieProbe"];
-
-const MILLISECONDS_PER_DAY = 1000 * 60 * 60 * 24;
-
-/**
- * A probe implementing the measurements detailed at
- * https://wiki.mozilla.org/SecurityEngineering/ThirdPartyCookies/Telemetry
- *
- * This implementation uses only in-memory data.
- */
-this.ThirdPartyCookieProbe = function() {
-  /**
-   * A set of third-party sites that have caused cookies to be
-   * rejected. These sites are trimmed down to ETLD + 1
-   * (i.e. "x.y.com" and "z.y.com" are both trimmed down to "y.com",
-   * "x.y.co.uk" is trimmed down to "y.co.uk").
-   *
-   * Used to answer the following question: "For each third-party
-   * site, how many other first parties embed them and result in
-   * cookie traffic?" (see
-   * https://wiki.mozilla.org/SecurityEngineering/ThirdPartyCookies/Telemetry#Breadth
-   * )
-   *
-   * @type Map<string, RejectStats> A mapping from third-party site
-   * to rejection statistics.
-   */
-  this._thirdPartyCookies = new Map();
-  /**
-   * Timestamp of the latest call to flush() in milliseconds since the Epoch.
-   */
-  this._latestFlush = Date.now();
-};
-
-this.ThirdPartyCookieProbe.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-  init: function() {
-    Services.obs.addObserver(this, "profile-before-change", false);
-    Services.obs.addObserver(this, "third-party-cookie-accepted", false);
-    Services.obs.addObserver(this, "third-party-cookie-rejected", false);
-  },
-  dispose: function() {
-    Services.obs.removeObserver(this, "profile-before-change");
-    Services.obs.removeObserver(this, "third-party-cookie-accepted");
-    Services.obs.removeObserver(this, "third-party-cookie-rejected");
-  },
-  /**
-   * Observe either
-   * - "profile-before-change" (no meaningful subject or data) - time to flush statistics and unregister; or
-   * - "third-party-cookie-accepted"/"third-party-cookie-rejected" with
-   *    subject: the nsIURI of the third-party that attempted to set the cookie;
-   *    data: a string holding the uri of the page seen by the user.
-   */
-  observe: function(docURI, topic, referrer) {
-    try {
-      if (topic == "profile-before-change") {
-        // A final flush, then unregister
-        this.flush();
-        this.dispose();
-      }
-      if (topic != "third-party-cookie-accepted"
-          && topic != "third-party-cookie-rejected") {
-        // Not a third-party cookie
-        return;
-      }
-      // Add host to this._thirdPartyCookies
-      let firstParty = normalizeHost(referrer);
-      let thirdParty = normalizeHost(docURI.QueryInterface(Ci.nsIURI).host);
-      let data = this._thirdPartyCookies.get(thirdParty);
-      if (!data) {
-        data = new RejectStats();
-        this._thirdPartyCookies.set(thirdParty, data);
-      }
-      if (topic == "third-party-cookie-accepted") {
-        data.addAccepted(firstParty);
-      } else {
-        data.addRejected(firstParty);
-      }
-    } catch (ex) {
-      // Errors should not remain silent
-      Services.console.logStringMessage("ThirdPartyCookieProbe: Uncaught error " + ex + "\n" + ex.stack);
-    }
-  },
-
-  /**
-   * Clear internal data, fill up corresponding histograms.
-   */
-  flush: function(aUptime) {
-    let now = Date.now();
-    let updays = (now - this._latestFlush) / MILLISECONDS_PER_DAY;
-    if (updays <= 0) {
-      // Unlikely, but regardless, don't risk division by zero
-      // or weird stuff.
-      return;
-    }
-    this._latestFlush = now;
-    let acceptedSites = Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_SITES_ACCEPTED");
-    let rejectedSites = Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_SITES_BLOCKED");
-    let acceptedRequests = Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_ATTEMPTS_ACCEPTED");
-    let rejectedRequests = Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_ATTEMPTS_BLOCKED");
-    for (let [k, data] of this._thirdPartyCookies) {
-      acceptedSites.add(data.countAcceptedSites / updays);
-      rejectedSites.add(data.countRejectedSites / updays);
-      acceptedRequests.add(data.countAcceptedRequests / updays);
-      rejectedRequests.add(data.countRejectedRequests / updays);
-    }
-    this._thirdPartyCookies.clear();
-  }
-};
-
-/**
- * Data gathered on cookies that a third party site has attempted to set.
- *
- * Privacy note: the only data actually sent to the server is the size of
- * the sets.
- *
- * @constructor
- */
-let RejectStats = function() {
-  /**
-   * The set of all sites for which we have accepted third-party cookies.
-   */
-  this._acceptedSites = new Set();
-  /**
-   * The set of all sites for which we have rejected third-party cookies.
-   */
-  this._rejectedSites = new Set();
-  /**
-   * Total number of attempts to set a third-party cookie that have
-   * been accepted. Two accepted attempts on the same site will both
-   * augment this count.
-   */
-  this._acceptedRequests = 0;
-  /**
-   * Total number of attempts to set a third-party cookie that have
-   * been rejected. Two rejected attempts on the same site will both
-   * augment this count.
-   */
-  this._rejectedRequests = 0;
-};
-RejectStats.prototype = {
-  addAccepted: function(firstParty) {
-    this._acceptedSites.add(firstParty);
-    this._acceptedRequests++;
-  },
-  addRejected: function(firstParty) {
-    this._rejectedSites.add(firstParty);
-    this._rejectedRequests++;
-  },
-  get countAcceptedSites() {
-    return this._acceptedSites.size;
-  },
-  get countRejectedSites() {
-    return this._rejectedSites.size;
-  },
-  get countAcceptedRequests() {
-    return this._acceptedRequests;
-  },
-  get countRejectedRequests() {
-    return this._rejectedRequests;
-  }
-};
-
-/**
- * Normalize a host to its eTLD + 1.
- */
-function normalizeHost(host) {
-  return Services.eTLD.getBaseDomainFromHost(host);
-};
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -25,9 +25,8 @@ CPP_SOURCES += [
 
 EXTRA_COMPONENTS += [
     'TelemetryPing.manifest',
 ]
 
 EXTRA_PP_COMPONENTS += [
     'TelemetryPing.js',
 ]
-
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/unit/head.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js
-const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
-const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
-
-function createAppInfo(id, name, version, platformVersion) {
-  gAppInfo = {
-    // nsIXULAppInfo
-    vendor: "Mozilla",
-    name: name,
-    ID: id,
-    version: version,
-    appBuildID: "2007010101",
-    platformVersion: platformVersion,
-    platformBuildID: "2007010101",
-
-    // nsIXULRuntime
-    inSafeMode: false,
-    logConsoleErrors: true,
-    OS: "XPCShell",
-    XPCOMABI: "noarch-spidermonkey",
-    invalidateCachesOnRestart: function invalidateCachesOnRestart() {
-      // Do nothing
-    },
-
-    // nsICrashReporter
-    annotations: {},
-
-    annotateCrashReport: function(key, data) {
-      this.annotations[key] = data;
-    },
-
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
-                                           Ci.nsIXULRuntime,
-                                           Ci.nsICrashReporter,
-                                           Ci.nsISupports])
-  };
-
-  var XULAppInfoFactory = {
-    createInstance: function (outer, iid) {
-      if (outer != null)
-        throw Components.results.NS_ERROR_NO_AGGREGATION;
-      return gAppInfo.QueryInterface(iid);
-    }
-  };
-  var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
-  registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
-                            XULAPPINFO_CONTRACTID, XULAppInfoFactory);
-}
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -352,16 +352,65 @@ function runOldPingFileTest() {
   do_check_true(histogramsFile.exists());
 
   let mtime = histogramsFile.lastModifiedTime;
   histogramsFile.lastModifiedTime = mtime - 8 * 24 * 60 * 60 * 1000; // 8 days.
   TelemetryPing.testLoadHistograms(histogramsFile, true);
   do_check_false(histogramsFile.exists());
 }
 
+// copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
+const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
+
+function createAppInfo(id, name, version, platformVersion) {
+  gAppInfo = {
+    // nsIXULAppInfo
+    vendor: "Mozilla",
+    name: name,
+    ID: id,
+    version: version,
+    appBuildID: "2007010101",
+    platformVersion: platformVersion,
+    platformBuildID: "2007010101",
+
+    // nsIXULRuntime
+    inSafeMode: false,
+    logConsoleErrors: true,
+    OS: "XPCShell",
+    XPCOMABI: "noarch-spidermonkey",
+    invalidateCachesOnRestart: function invalidateCachesOnRestart() {
+      // Do nothing
+    },
+
+    // nsICrashReporter
+    annotations: {},
+
+    annotateCrashReport: function(key, data) {
+      this.annotations[key] = data;
+    },
+
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo,
+                                           Ci.nsIXULRuntime,
+                                           Ci.nsICrashReporter,
+                                           Ci.nsISupports])
+  };
+
+  var XULAppInfoFactory = {
+    createInstance: function (outer, iid) {
+      if (outer != null)
+        throw Components.results.NS_ERROR_NO_AGGREGATION;
+      return gAppInfo.QueryInterface(iid);
+    }
+  };
+  var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+  registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
+                            XULAPPINFO_CONTRACTID, XULAppInfoFactory);
+}
+
 function dummyTheme(id) {
   return {
     id: id,
     name: Math.random().toString(),
     headerURL: "http://lwttest.invalid/a.png",
     footerURL: "http://lwttest.invalid/b.png",
     textcolor: Math.random().toString(),
     accentcolor: Math.random().toString()
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/unit/test_ThirdPartyCookieProbe.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let Cu = Components.utils;
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/ThirdPartyCookieProbe.jsm");
-Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
-
-let TOPIC_ACCEPTED = "third-party-cookie-accepted";
-let TOPIC_REJECTED = "third-party-cookie-rejected";
-
-let FLUSH_MILLISECONDS = 1000 * 60 * 60 * 24 / 2; /*Half a day, for testing purposes*/
-
-const NUMBER_OF_REJECTS = 30;
-const NUMBER_OF_ACCEPTS = 17;
-const NUMBER_OF_REPEATS = 5;
-
-const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
-
-let gCookieService;
-let gThirdPartyCookieProbe;
-
-let gHistograms = {
-  clear: function() {
-    this.sitesAccepted.clear();
-    this.requestsAccepted.clear();
-    this.sitesRejected.clear();
-    this.requestsRejected.clear();
-  }
-};
-
-function run_test() {
-  do_print("Initializing environment");
-  do_get_profile();
-  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-  gCookieService = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
-
-  do_print("Initializing ThirdPartyCookieProbe.jsm");
-  gThirdPartyCookieProbe = new ThirdPartyCookieProbe();
-  gThirdPartyCookieProbe.init();
-
-  do_print("Acquiring histograms");
-  gHistograms.sitesAccepted =
-    Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_SITES_ACCEPTED");
-  gHistograms.sitesRejected =
-    Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_SITES_BLOCKED"),
-  gHistograms.requestsAccepted =
-    Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_ATTEMPTS_ACCEPTED");
-  gHistograms.requestsRejected =
-    Services.telemetry.getHistogramById("COOKIES_3RDPARTY_NUM_ATTEMPTS_BLOCKED"),
-
-
-  run_next_test();
-}
-
-/**
- * Utility function: try to set a cookie with the given document uri and referrer uri.
- *
- * @param obj An object with the following fields
- * - {string} request The uri of the request setting the cookie.
- * - {string} referrer The uri of the referrer for this request.
- */
-function tryToSetCookie(obj) {
-  let requestURI = Services.io.newURI(obj.request, null, null);
-  let referrerURI = Services.io.newURI(obj.referrer, null, null);
-  let requestChannel = Services.io.newChannelFromURI(requestURI);
-  gCookieService.setCookieString(referrerURI, null, "Is there a cookie in my jar?", requestChannel);
-}
-
-function wait(ms) {
-  let deferred = Promise.defer();
-  do_timeout(ms, () => deferred.resolve());
-  return deferred.promise;
-}
-
-function oneTest(tld, flushUptime, check) {
-  gHistograms.clear();
-  do_print("Testing with tld " + tld);
-
-  do_print("Adding rejected entries");
-  Services.prefs.setIntPref("network.cookie.cookieBehavior",
-                          1 /*reject third-party cookies*/);
-
-  for (let i = 0; i < NUMBER_OF_REJECTS; ++i) {
-    for (let j = 0; j < NUMBER_OF_REPEATS; ++j) {
-      for (let prefix of ["http://", "https://"]) {
-        // Histogram sitesRejected should only count
-        // NUMBER_OF_REJECTS entries.
-        // Histogram requestsRejected should count
-        // NUMBER_OF_REJECTS * NUMBER_OF_REPEATS * 2
-        tryToSetCookie({
-          request: prefix + "echelon" + tld,
-          referrer: prefix + "domain" + i + tld
-        });
-      }
-    }
-  }
-
-  do_print("Adding accepted entries");
-  Services.prefs.setIntPref("network.cookie.cookieBehavior",
-                            0 /*accept third-party cookies*/);
-
-  for (let i = 0; i < NUMBER_OF_ACCEPTS; ++i) {
-    for (let j = 0; j < NUMBER_OF_REPEATS; ++j) {
-      for (let prefix of ["http://", "https://"]) {
-        // Histogram sitesAccepted should only count
-        // NUMBER_OF_ACCEPTS entries.
-        // Histogram requestsAccepted should count
-        // NUMBER_OF_ACCEPTS * NUMBER_OF_REPEATS * 2
-        tryToSetCookie({
-            request: prefix + "prism" + tld,
-            referrer: prefix + "domain" + i + tld
-          });
-      }
-    }
-  }
-
-  do_print("Checking that the histograms have not changed before ping()");
-  do_check_eq(gHistograms.sitesAccepted.snapshot().sum, 0);
-  do_check_eq(gHistograms.sitesRejected.snapshot().sum, 0);
-  do_check_eq(gHistograms.requestsAccepted.snapshot().sum, 0);
-  do_check_eq(gHistograms.requestsRejected.snapshot().sum, 0);
-
-  do_print("Checking that the resulting histograms are correct");
-  if (flushUptime != null) {
-    let now = Date.now();
-    let before = now - flushUptime;
-    gThirdPartyCookieProbe._latestFlush = before;
-  }
-  gThirdPartyCookieProbe.flush();
-  check();
-}
-
-add_task(function() {
-  // To ensure that we work correctly with eTLD, test with several suffixes
-  for (let tld of [".com", ".com.ar", ".co.uk", ".gouv.fr"]) {
-    oneTest(tld, FLUSH_MILLISECONDS, function() {
-      do_check_eq(gHistograms.sitesAccepted.snapshot().sum, NUMBER_OF_ACCEPTS * 2);
-      do_check_eq(gHistograms.sitesRejected.snapshot().sum, NUMBER_OF_REJECTS * 2);
-      do_check_eq(gHistograms.requestsAccepted.snapshot().sum, NUMBER_OF_ACCEPTS * NUMBER_OF_REPEATS * 2 * 2);
-      do_check_eq(gHistograms.requestsRejected.snapshot().sum, NUMBER_OF_REJECTS * NUMBER_OF_REPEATS * 2 * 2);
-    });
-  }
-
-  // Check that things still work with default uptime management
-  for (let tld of [".com", ".com.ar", ".co.uk", ".gouv.fr"]) {
-    yield wait(1000); // Ensure that uptime is at least one second
-    oneTest(tld, null, function() {
-      do_check_true(gHistograms.sitesAccepted.snapshot().sum > 0);
-      do_check_true(gHistograms.sitesRejected.snapshot().sum > 0);
-      do_check_true(gHistograms.requestsAccepted.snapshot().sum > 0);
-      do_check_true(gHistograms.requestsRejected.snapshot().sum > 0);
-    });
-  }
-});
-
-add_task(function() {
-  gThirdPartyCookieProbe.dispose();
-});
-
--- a/toolkit/components/telemetry/tests/unit/xpcshell.ini
+++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini
@@ -1,14 +1,13 @@
 [DEFAULT]
-head = head.js
+head = 
 tail = 
 
 [test_nsITelemetry.js]
 [test_TelemetryLateWrites.js]
 [test_TelemetryLockCount.js]
 [test_TelemetryPing.js]
 # Bug 676989: test fails consistently on Android
 # fail-if = os == "android"
 [test_TelemetryPing_idle.js]
 [test_TelemetryStopwatch.js]
 [test_TelemetryPingBuildID.js]
-[test_ThirdPartyCookieProbe.js]