canmove, Confirmed users
409
edits
m (add testing info) |
|||
| Line 37: | Line 37: | ||
} | } | ||
</bugzilla> | </bugzilla> | ||
=== Interfacing with FHR === | |||
With the exception of about:healthreport, everything about the feature is in the background. This makes it somewhat difficult to test and inspect because there is nothing to see. | |||
FHR is attached to the @mozilla.org/datareporting/service;1 XPCOM service, which should always be present and running in Firefox 21 and newer. The FHR-specific functionality is attached to an object on this service: | |||
let reporter = Cc["@mozilla.org/datareporting/service;1"] | |||
.getService(Ci.nsISupports) | |||
.wrappedJSObject | |||
.healthReporter; | |||
However, this property is lazy-loaded after app startup. Currently, we wait 45s on the first profile run and 10s on subsequent profile runs (these numbers may change). | |||
When the healthReporter instance is constructed, it starts a long chain of asynchronous events required to initialize the instance. It opens a SQLite database, loads probes, etc. The construction on first profile run is one of the most expensive operations FHR will perform (it needs to create a DB and populate its schema, etc). It is important that you don't attempt to access any properties or functions on the .healthReporter instance until the promise returned by onInit() has resolved. e.g. | |||
let reporter = Cc["@mozilla.org/datareporting/service;1"].getService(Ci.nsISupports).wrappedJSObject.healthReporter; | |||
reporter.onInit(function onInitialized() { // This is when FHR is finally initialized. }); | |||
If you attempt to do anything before onInit() resolves, whatever you were trying to do may fail. | |||
Once the FHR service is initialized, it starts monitoring the world and data is fed into it. All data is stored in a SQLite database, healthreport.sqlite in the profile directory. | |||
Data upload is performed automatically and is scheduled for 24 hour intervals. Data upload will not occur until the user has been presented with a notification of Mozilla's data collection practices and privacy policy. For Firefox, this will manifest as a notification bar *on all windows and all tabs* sometime after the first app run with FHR present and before the first scheduled FHR upload. This is currently 12 hours after process start, although this may change. | |||
==== Preferences ==== | |||
All preferences for FHR are in the datareporting. branch. This branch has the following sub-branches: | |||
; datareporting.healthreport. : Where all the FHR-specific preferences live. | |||
; datareporting.policy. : Preferences containing state for Mozilla's data collection and privacy policies. | |||
; datareporting.sessions. : Contains a history of previous and current session state. These preferences are periodically migrated to FHR's database. | |||
The following preferences are relevant to testing: | |||
; datareporting.healthreport.lastPingTime : When we last uploaded a document to the server | |||
; datareporting.healthreport.lastSubmitID : The ID of the current document on the server | |||
; datareporting.healthreport.logging.consoleLevel : Level of logging to write to the Error Console. Set to Debug or Trace for lots of additional logging. By default, only errors are recorded. | |||
; datareporting.healthreport.nextDataSubmissionTime : When the next data submission is scheduled to occur. To trigger a soon'ish data submission, decrement the 3rd from front digit by 1 and wait up to a minute for the upload to be triggered. e.g. 13**6**4059453630 -> 13**5**4059453630. | |||
; datareporting.policy.dataSubmissionPolicyAccepted : Whether the data submission policy has been accepted. We will not submit data to the server unless this is true. | |||