Merge mozilla-central into mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2013-01-15 13:50:43 -05:00
commit 503a31dba3
11 changed files with 63 additions and 39 deletions

View File

@ -14,8 +14,9 @@ const reporter = Cc["@mozilla.org/datareporting/service;1"]
.healthReporter;
const policy = Cc["@mozilla.org/datareporting/service;1"]
.getService(Ci.nsISupports)
.wrappedJSObject.policy;
.getService(Ci.nsISupports)
.wrappedJSObject
.policy;
const prefs = new Preferences("datareporting.healthreport.about.");
@ -26,7 +27,7 @@ function getLocale() {
}
function init() {
refreshWithDataSubmissionFlag(reporter.willUploadData);
refreshWithDataSubmissionFlag(policy.healthReportUploadEnabled);
refreshJSONPayload();
document.getElementById("details-link").href = prefs.get("glossaryUrl");
}
@ -38,10 +39,11 @@ function init() {
* (bool) Whether data submission is enabled.
*/
function refreshWithDataSubmissionFlag(enabled) {
if (!enabled)
if (!enabled) {
updateView("disabled");
else
} else {
updateView("default");
}
}
function updateView(state="default") {
@ -57,8 +59,9 @@ function refreshDataView(data) {
noData.style.display = data ? "none" : "inline";
dataEl.style.display = data ? "block" : "none";
if (data)
if (data) {
dataEl.innerHTML = JSON.stringify(data, null, 2);
}
}
/**
@ -69,7 +72,7 @@ function refreshJSONPayload() {
}
function onOptInClick() {
policy.healthReportUploadEnable = true;
policy.healthReportUploadEnabled = true;
refreshWithDataSubmissionFlag(true);
}
@ -85,14 +88,8 @@ function onOptOutClick() {
return;
}
policy.healthReportUploadEnable = false;
let promise = reporter.requestDeleteRemoteData("Clicked opt out button on about page.");
if (promise) {
promise.then(function onDelete() {
refreshWithDataSubmissionFlag(reporter.willUploadData);
});
}
policy.healthReportUploadEnabled = false;
reporter.requestDeleteRemoteData("Clicked opt out button on about page.");
refreshWithDataSubmissionFlag(false);
updateView("disabled");
}
@ -114,4 +111,5 @@ function onShowReportClick() {
function onHideReportClick() {
updateView("default");
document.getElementById("remote-report").src = "";
}
}

View File

@ -52,11 +52,13 @@
#else
/>
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
<menuitem id="healthReport"
label="&healthReport.label;"
accesskey="&healthReport.accesskey;"
oncommand="openHealthReport()"
onclick="checkForMiddleClick(this, event);"/>
#endif
<menuitem id="troubleShooting"
accesskey="&helpTroubleshootingInfo.accesskey;"
label="&helpTroubleshootingInfo.label;"

View File

@ -378,10 +378,12 @@
label="&appMenuGettingStarted.label;"
oncommand="gBrowser.loadOneTab('http://www.mozilla.com/firefox/central/', {inBackground: false});"
onclick="checkForMiddleClick(this, event);"/>
#ifdef MOZ_SERVICES_HEALTHREPORT
<menuitem id="appmenu_healthReport"
label="&healthReport.label;"
oncommand="openHealthReport()"
onclick="checkForMiddleClick(this, event);"/>
#endif
<menuitem id="appmenu_troubleshootingInfo"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"

View File

@ -97,7 +97,7 @@ DataNotificationInfoBar.prototype = {
let buttons = [{
label: gNavigatorBundle.getString("dataReportingNotification.button.label"),
accesskey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
popup: null,
callback: function () {
// Clicking the button to go to the preferences tab constitutes

View File

@ -529,6 +529,7 @@ function openTroubleshootingPage()
openUILinkIn("about:support", "tab");
}
#ifdef MOZ_SERVICES_HEALTHREPORT
/**
* Opens the troubleshooting information (about:support) page for this version
* of the application.
@ -537,7 +538,7 @@ function openHealthReport()
{
openUILinkIn("about:healthreport", "tab");
}
#endif
/**
* Opens the feedback page for this version of the application.

View File

@ -227,17 +227,17 @@
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption label="&FHRSection.label;"/>
<description>&FHRDesc.label;</description>
<caption label="&healthReportSection.label;"/>
<description>&healthReportDesc.label;</description>
<hbox>
<checkbox id="submitHealthReportBox"
oncommand="gAdvancedPane.updateSubmitHealthReport();"
label="&enableFHR.label;"
accesskey="&enableFHR.accesskey;"/>
label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<spacer flex="1"/>
<label id="FHRLearnMore"
class="text-link"
value="&FHRLearnMore.label;"/>
value="&healthReportLearnMore.label;"/>
</hbox>
</groupbox>
#endif

View File

@ -245,17 +245,17 @@
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
<groupbox>
<caption label="&FHRSection.label;"/>
<description>&FHRDesc.label;</description>
<caption label="&healthReportSection.label;"/>
<description>&healthReportDesc.label;</description>
<hbox>
<checkbox id="submitHealthReportBox"
oncommand="gAdvancedPane.updateSubmitHealthReport();"
label="&enableFHR.label;"
accesskey="&enableFHR.accesskey;"/>
label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<spacer flex="1"/>
<label id="FHRLearnMore"
class="text-link"
value="&FHRLearnMore.label;"/>
value="&healthReportLearnMore.label;"/>
</hbox>
</groupbox>
#endif

View File

@ -28,11 +28,7 @@ MOZ_SAFE_BROWSING=1
MOZ_SERVICES_AITC=1
MOZ_SERVICES_COMMON=1
MOZ_SERVICES_CRYPTO=1
if test "$OS_ARCH" != "Linux"; then
MOZ_SERVICES_HEALTHREPORT=1
fi
MOZ_SERVICES_HEALTHREPORT=1
MOZ_SERVICES_METRICS=1
MOZ_SERVICES_SYNC=1
MOZ_APP_VERSION=$FIREFOX_VERSION

View File

@ -473,6 +473,9 @@
@BINPATH@/components/DataReporting.manifest
@BINPATH@/components/DataReportingService.js
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
@BINPATH@/components/HealthReportComponents.manifest
#endif
#ifdef MOZ_SERVICES_SYNC
@BINPATH@/components/SyncComponents.manifest
@BINPATH@/components/Weave.js

View File

@ -35,11 +35,11 @@
<!ENTITY dataChoicesTab.label "Data Choices">
<!ENTITY FHRSection.label "Firefox Health Report">
<!ENTITY FHRDesc.label "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
<!ENTITY enableFHR.label "Enable Firefox Health Report">
<!ENTITY enableFHR.accesskey "F">
<!ENTITY FHRLearnMore.label "Learn More">
<!ENTITY healthReportSection.label "&brandShortName; Health Report">
<!ENTITY healthReportDesc.label "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
<!ENTITY enableHealthReport.label "Enable &brandShortName; Health Report">
<!ENTITY enableHealthReport.accesskey "R">
<!ENTITY healthReportLearnMore.label "Learn More">
<!ENTITY telemetrySection.label "Telemetry">
<!ENTITY telemetryDesc.label "Shares performance, usage, hardware and customization data about your browser with &vendorShortName; to help us make &brandShortName; better">

View File

@ -53,6 +53,8 @@ const DEFAULT_LOAD_DELAY_MSEC = 10 * 1000;
this.DataReportingService = function () {
this.wrappedJSObject = this;
this._quitting = false;
this._os = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
}
@ -130,10 +132,20 @@ DataReportingService.prototype = Object.freeze({
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.timer.initWithCallback({
notify: function notify() {
delete this.timer;
// There could be a race between "quit-application" firing and
// this callback being invoked. We close that door.
if (this._quitting) {
return;
}
// Side effect: instantiates the reporter instance if not already
// accessed.
//
// The instance installs its own shutdown observers. So, we just
// fire and forget: it will clean itself up.
let reporter = this.healthReporter;
delete this.timer;
}.bind(this),
}, delayInterval, this.timer.TYPE_ONE_SHOT);
@ -141,6 +153,16 @@ DataReportingService.prototype = Object.freeze({
case "quit-application":
this._os.removeObserver(this, "quit-application");
this._quitting = true;
// Shutdown doesn't clear pending timers. So, we need to explicitly
// cancel our health reporter initialization timer or else it will
// attempt initialization after shutdown has commenced. This would
// likely lead to stalls or crashes.
if (this.timer) {
this.timer.cancel();
}
this.policy.stopPolling();
break;
}