Bug 1166494 - part3: Correctly handle marker definition fields that are described via function rather than array. r=vp

This commit is contained in:
Jordan Santell 2015-05-22 02:37:06 -07:00
parent af6a90041d
commit bd27262286

View File

@ -66,6 +66,16 @@ exports.getMarkerClassName = getMarkerClassName;
*/
function getMarkerFields (marker) {
let blueprint = TIMELINE_BLUEPRINT[marker.name];
if (typeof blueprint.fields === "function") {
let fields = blueprint.fields(marker);
// Add a ":" to the label since the localization files contain the ":"
// if not present. This should be changed, ugh.
return Object.keys(fields || []).map(label => {
let normalizedLabel = label.indexOf(":") !== -1 ? label : (label + ":");
return { label: normalizedLabel, value: fields[label] };
});
}
return (blueprint.fields || []).reduce((fields, field) => {
// Ensure this marker has this field present
if (field.property in marker) {