mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1195962
- Replace #ifdef with AppConstants.jsm in UITour.jsm. r=Gijs
This commit is contained in:
parent
f186f5b1c0
commit
11323e95e2
@ -1985,30 +1985,30 @@ this.UITour = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_addAnnotationPanelMutationObserver: function(aPanelEl) {
|
_addAnnotationPanelMutationObserver: function(aPanelEl) {
|
||||||
#ifdef XP_LINUX
|
if (AppConstants.platform == "linux") {
|
||||||
let observer = this._annotationPanelMutationObservers.get(aPanelEl);
|
let observer = this._annotationPanelMutationObservers.get(aPanelEl);
|
||||||
if (observer) {
|
if (observer) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
let win = aPanelEl.ownerDocument.defaultView;
|
||||||
|
observer = new win.MutationObserver(this._annotationMutationCallback);
|
||||||
|
this._annotationPanelMutationObservers.set(aPanelEl, observer);
|
||||||
|
let observerOptions = {
|
||||||
|
attributeFilter: ["height", "width"],
|
||||||
|
attributes: true,
|
||||||
|
};
|
||||||
|
observer.observe(aPanelEl, observerOptions);
|
||||||
}
|
}
|
||||||
let win = aPanelEl.ownerDocument.defaultView;
|
|
||||||
observer = new win.MutationObserver(this._annotationMutationCallback);
|
|
||||||
this._annotationPanelMutationObservers.set(aPanelEl, observer);
|
|
||||||
let observerOptions = {
|
|
||||||
attributeFilter: ["height", "width"],
|
|
||||||
attributes: true,
|
|
||||||
};
|
|
||||||
observer.observe(aPanelEl, observerOptions);
|
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeAnnotationPanelMutationObserver: function(aPanelEl) {
|
_removeAnnotationPanelMutationObserver: function(aPanelEl) {
|
||||||
#ifdef XP_LINUX
|
if (AppConstants.platform == "linux") {
|
||||||
let observer = this._annotationPanelMutationObservers.get(aPanelEl);
|
let observer = this._annotationPanelMutationObservers.get(aPanelEl);
|
||||||
if (observer) {
|
if (observer) {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
this._annotationPanelMutationObservers.delete(aPanelEl);
|
this._annotationPanelMutationObservers.delete(aPanelEl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2165,69 +2165,29 @@ const UITourHealthReport = {
|
|||||||
addClientId: true,
|
addClientId: true,
|
||||||
addEnvironment: true,
|
addEnvironment: true,
|
||||||
});
|
});
|
||||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
|
||||||
Task.spawn(function*() {
|
|
||||||
let reporter = Cc["@mozilla.org/datareporting/service;1"]
|
|
||||||
.getService()
|
|
||||||
.wrappedJSObject
|
|
||||||
.healthReporter;
|
|
||||||
|
|
||||||
// This can happen if the FHR component of the data reporting service is
|
if (AppConstants.MOZ_SERVICES_HEALTHREPORT) {
|
||||||
// disabled. This is controlled by a pref that most will never use.
|
Task.spawn(function*() {
|
||||||
if (!reporter) {
|
let reporter = Cc["@mozilla.org/datareporting/service;1"]
|
||||||
return;
|
.getService()
|
||||||
}
|
.wrappedJSObject
|
||||||
|
.healthReporter;
|
||||||
|
|
||||||
yield reporter.onInit();
|
// This can happen if the FHR component of the data reporting service is
|
||||||
|
// disabled. This is controlled by a pref that most will never use.
|
||||||
|
if (!reporter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the UITourMetricsProvider instance from the Health Reporter
|
yield reporter.onInit();
|
||||||
reporter.getProvider("org.mozilla.uitour").recordTreatmentTag(tag, value);
|
|
||||||
});
|
// Get the UITourMetricsProvider instance from the Health Reporter
|
||||||
#endif
|
reporter.getProvider("org.mozilla.uitour").recordTreatmentTag(tag, value);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
|
||||||
const DAILY_DISCRETE_TEXT_FIELD = Metrics.Storage.FIELD_DAILY_DISCRETE_TEXT;
|
|
||||||
|
|
||||||
this.UITourMetricsProvider = function() {
|
|
||||||
Metrics.Provider.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
UITourMetricsProvider.prototype = Object.freeze({
|
|
||||||
__proto__: Metrics.Provider.prototype,
|
|
||||||
|
|
||||||
name: "org.mozilla.uitour",
|
|
||||||
|
|
||||||
measurementTypes: [
|
|
||||||
UITourTreatmentMeasurement1,
|
|
||||||
],
|
|
||||||
|
|
||||||
recordTreatmentTag: function(tag, value) {
|
|
||||||
let m = this.getMeasurement(UITourTreatmentMeasurement1.prototype.name,
|
|
||||||
UITourTreatmentMeasurement1.prototype.version);
|
|
||||||
let field = tag;
|
|
||||||
|
|
||||||
if (this.storage.hasFieldFromMeasurement(m.id, field,
|
|
||||||
DAILY_DISCRETE_TEXT_FIELD)) {
|
|
||||||
let fieldID = this.storage.fieldIDFromMeasurement(m.id, field);
|
|
||||||
return this.enqueueStorageOperation(function recordKnownField() {
|
|
||||||
return this.storage.addDailyDiscreteTextFromFieldID(fieldID, value);
|
|
||||||
}.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, we first need to create the field.
|
|
||||||
return this.enqueueStorageOperation(function recordField() {
|
|
||||||
// This function has to return a promise.
|
|
||||||
return Task.spawn(function () {
|
|
||||||
let fieldID = yield this.storage.registerField(m.id, field,
|
|
||||||
DAILY_DISCRETE_TEXT_FIELD);
|
|
||||||
yield this.storage.addDailyDiscreteTextFromFieldID(fieldID, value);
|
|
||||||
}.bind(this));
|
|
||||||
}.bind(this));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
function UITourTreatmentMeasurement1() {
|
function UITourTreatmentMeasurement1() {
|
||||||
Metrics.Measurement.call(this);
|
Metrics.Measurement.call(this);
|
||||||
|
|
||||||
@ -2239,24 +2199,66 @@ function UITourTreatmentMeasurement1() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UITourTreatmentMeasurement1.prototype = Object.freeze({
|
if (AppConstants.MOZ_SERVICES_HEALTHREPORT) {
|
||||||
__proto__: Metrics.Measurement.prototype,
|
|
||||||
|
|
||||||
name: "treatment",
|
const DAILY_DISCRETE_TEXT_FIELD = Metrics.Storage.FIELD_DAILY_DISCRETE_TEXT;
|
||||||
version: 1,
|
|
||||||
|
|
||||||
// our fields are dynamic
|
this.UITourMetricsProvider = function() {
|
||||||
fields: { },
|
Metrics.Provider.call(this);
|
||||||
|
|
||||||
// We need a custom serializer because the default one doesn't accept unknown fields
|
|
||||||
_serializeJSONDaily: function(data) {
|
|
||||||
let result = {_v: this.version };
|
|
||||||
|
|
||||||
for (let [field, data] of data) {
|
|
||||||
result[field] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
#endif
|
UITourMetricsProvider.prototype = Object.freeze({
|
||||||
|
__proto__: Metrics.Provider.prototype,
|
||||||
|
|
||||||
|
name: "org.mozilla.uitour",
|
||||||
|
|
||||||
|
measurementTypes: [
|
||||||
|
UITourTreatmentMeasurement1,
|
||||||
|
],
|
||||||
|
|
||||||
|
recordTreatmentTag: function(tag, value) {
|
||||||
|
let m = this.getMeasurement(UITourTreatmentMeasurement1.prototype.name,
|
||||||
|
UITourTreatmentMeasurement1.prototype.version);
|
||||||
|
let field = tag;
|
||||||
|
|
||||||
|
if (this.storage.hasFieldFromMeasurement(m.id, field,
|
||||||
|
DAILY_DISCRETE_TEXT_FIELD)) {
|
||||||
|
let fieldID = this.storage.fieldIDFromMeasurement(m.id, field);
|
||||||
|
return this.enqueueStorageOperation(function recordKnownField() {
|
||||||
|
return this.storage.addDailyDiscreteTextFromFieldID(fieldID, value);
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, we first need to create the field.
|
||||||
|
return this.enqueueStorageOperation(function recordField() {
|
||||||
|
// This function has to return a promise.
|
||||||
|
return Task.spawn(function () {
|
||||||
|
let fieldID = yield this.storage.registerField(m.id, field,
|
||||||
|
DAILY_DISCRETE_TEXT_FIELD);
|
||||||
|
yield this.storage.addDailyDiscreteTextFromFieldID(fieldID, value);
|
||||||
|
}.bind(this));
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
UITourTreatmentMeasurement1.prototype = Object.freeze({
|
||||||
|
__proto__: Metrics.Measurement.prototype,
|
||||||
|
|
||||||
|
name: "treatment",
|
||||||
|
version: 1,
|
||||||
|
|
||||||
|
// our fields are dynamic
|
||||||
|
fields: { },
|
||||||
|
|
||||||
|
// We need a custom serializer because the default one doesn't accept unknown fields
|
||||||
|
_serializeJSONDaily: function(data) {
|
||||||
|
let result = {_v: this.version };
|
||||||
|
|
||||||
|
for (let [field, data] of data) {
|
||||||
|
result[field] = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
EXTRA_PP_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'UITour.jsm',
|
'UITour.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user