toolkit/components/telemetry/TelemetryStartup.js

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 "use strict";
     8 const Cu = Components.utils;
    10 Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
    11 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this)
    13 /**
    14  * TelemetryStartup is needed to forward the "profile-after-change" notification
    15  * to TelemetryPing.jsm.
    16  */
    17 function TelemetryStartup() {
    18 }
    20 TelemetryStartup.prototype.classID = Components.ID("{117b219f-92fe-4bd2-a21b-95a342a9d474}");
    21 TelemetryStartup.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver])
    22 TelemetryStartup.prototype.observe = function(aSubject, aTopic, aData){
    23   if (aTopic == "profile-after-change") {
    24     TelemetryPing.observe(null, "profile-after-change", null);
    25   }
    26 }
    28 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelemetryStartup]);

mercurial