Bug 887580 - Properly export object in profile.jsm and policy.jsm. r=gps
authorStefan Mirea <steven.mirea@gmail.com>
Wed, 26 Jun 2013 17:01:45 -0700
changeset 158831 8105a07af65888b0eab2222c51bc4a6e9d475259
parent 158830 802f4d5b710694e6fc9872ce23895f57cae9a6a4
child 158832 163308fe32da7060cd8988dc182c19d36239d81f
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs887580
milestone26.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 887580 - Properly export object in profile.jsm and policy.jsm. r=gps
services/datareporting/policy.jsm
services/healthreport/profile.jsm
--- a/services/datareporting/policy.jsm
+++ b/services/datareporting/policy.jsm
@@ -129,26 +129,26 @@ Object.freeze(NotifyPolicyRequest.protot
  *
  * Receivers are expected to call one of the provided on* functions to signal
  * completion of the request.
  *
  * Instances of this type should not be instantiated outside of this file.
  * Receivers of instances of this type should not attempt to do anything with
  * the instance except call one of the on* methods.
  */
-function DataSubmissionRequest(promise, expiresDate, isDelete) {
+this.DataSubmissionRequest = function (promise, expiresDate, isDelete) {
   this.promise = promise;
   this.expiresDate = expiresDate;
   this.isDelete = isDelete;
 
   this.state = null;
   this.reason = null;
 }
 
-DataSubmissionRequest.prototype = {
+this.DataSubmissionRequest.prototype = Object.freeze({
   NO_DATA_AVAILABLE: "no-data-available",
   SUBMISSION_SUCCESS: "success",
   SUBMISSION_FAILURE_SOFT: "failure-soft",
   SUBMISSION_FAILURE_HARD: "failure-hard",
 
   /**
    * No submission was attempted because no data was available.
    *
@@ -205,19 +205,17 @@ DataSubmissionRequest.prototype = {
    *        (string) Why the failure occurred. For logging purposes only.
    */
   onSubmissionFailureHard: function onSubmissionFailureHard(reason=null) {
     this.state = this.SUBMISSION_FAILURE_HARD;
     this.reason = reason;
     this.promise.resolve(this);
     return this.promise.promise;
   },
-};
-
-Object.freeze(DataSubmissionRequest.prototype);
+});
 
 /**
  * Manages scheduling of Firefox Health Report data submission.
  *
  * The rules of data submission are as follows:
  *
  *  1. Do not submit data more than once every 24 hours.
  *  2. Try to submit as close to 24 hours apart as possible.
@@ -312,17 +310,17 @@ this.DataReportingPolicy = function (pre
   // carry forward through a single application instance.
   this._dataSubmissionPolicyNotifiedDate = null;
 
   // Record when we last requested for submitted data to be sent. This is
   // to avoid having multiple outstanding requests.
   this._inProgressSubmissionRequest = null;
 };
 
-DataReportingPolicy.prototype = Object.freeze({
+this.DataReportingPolicy.prototype = Object.freeze({
   /**
    * How long after first run we should notify about data submission.
    */
   SUBMISSION_NOTIFY_INTERVAL_MSEC: 12 * 60 * 60 * 1000,
 
   /**
    * Time that must elapse with no user action for implicit acceptance.
    *
--- a/services/healthreport/profile.jsm
+++ b/services/healthreport/profile.jsm
@@ -26,24 +26,24 @@ Cu.import("resource://gre/modules/Promis
 Cu.import("resource://gre/modules/osfile.jsm")
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/utils.js");
 
 // Profile creation time access.
 // This is separate from the provider to simplify testing and enable extraction
 // to a shared location in the future.
-function ProfileCreationTimeAccessor(profile, log) {
+this.ProfileCreationTimeAccessor = function(profile, log) {
   this.profilePath = profile || OS.Constants.Path.profileDir;
   if (!this.profilePath) {
     throw new Error("No profile directory.");
   }
   this._log = log || {"debug": function (s) { dump(s + "\n"); }};
 }
-ProfileCreationTimeAccessor.prototype = {
+this.ProfileCreationTimeAccessor.prototype = {
   /**
    * There are three ways we can get our creation time:
    *
    * 1. From our own saved value (to avoid redundant work).
    * 2. From the on-disk JSON file.
    * 3. By calculating it from the filesystem.
    *
    * If we have to calculate, we write out the file; if we have
@@ -205,20 +205,20 @@ ProfileMetadataMeasurement.prototype = {
  */
 function truncate(msec) {
   return Math.floor(msec / MILLISECONDS_PER_DAY);
 }
 
 /**
  * A Metrics.Provider for profile metadata, such as profile creation time.
  */
-function ProfileMetadataProvider() {
+this.ProfileMetadataProvider = function() {
   Metrics.Provider.call(this);
 }
-ProfileMetadataProvider.prototype = {
+this.ProfileMetadataProvider.prototype = {
   __proto__: Metrics.Provider.prototype,
 
   name: "org.mozilla.profile",
 
   measurementTypes: [ProfileMetadataMeasurement],
 
   pullOnly: true,