Revision 593dea5f1b8e9d90bbcc20adcafe370e8f0b0564 authored by James Graham on 12 April 2018, 12:48:29 UTC, committed by James Graham on 12 April 2018, 12:48:29 UTC
Firefox requires a prefs file to be loaded to ensure that it doesn't make external network connections, and to make sure that other settings are appropriate for testing. Previously we always used the version of the prefs file from master, which is usually fine for nightly builds, but doesn't work with release builds if it happens that a pref changed. This change uses the correct release version of the prefs file for firefox releases and beta versions. It continues to use the master version for any nightly build; this could be fixed in some cases if we are able to access the actual commit hash used to build Firefox, but probably isn't too bad an approximation. The caching algorithm was changed so that release versions of the prefs are cached forever, and the nightly version is updated once per day (although this doesn't quite match the nightly release cadence, it's only going to fail in edge cases where the prefs were changed in the file, but the nightly version was not yet updated, of vice-versa.)
1 parent e504871
dictionary-helper.js
'use strict';
// Helper assertion functions to validate dictionary fields
// on dictionary objects returned from APIs
function assert_unsigned_int_field(object, field) {
const num = object[field];
assert_true(Number.isInteger(num) && (num >= 0),
`Expect dictionary.${field} to be unsigned integer`);
}
function assert_int_field(object, field) {
const num = object[field];
assert_true(Number.isInteger(num),
`Expect dictionary.${field} to be integer`);
}
function assert_string_field(object, field) {
const str = object[field];
assert_equals(typeof str, 'string',
`Expect dictionary.${field} to be string`);
}
function assert_number_field(object, field) {
const num = object[field];
assert_equals(typeof num, 'number',
`Expect dictionary.${field} to be number`);
}
function assert_boolean_field(object, field) {
const bool = object[field];
assert_equals(typeof bool, 'boolean',
`Expect dictionary.${field} to be boolean`);
}
function assert_array_field(object, field) {
assert_true(Array.isArray(object[field]),
`Expect dictionary.${field} to be array`);
}
function assert_dict_field(object, field) {
assert_equals(typeof object[field], 'object',
`Expect dictionary.${field} to be plain object`);
assert_not_equals(object[field], null,
`Expect dictionary.${field} to not be null`);
}
function assert_enum_field(object, field, validValues) {
assert_string_field(object, field);
assert_true(validValues.includes(object[field]),
`Expect dictionary.${field} to have one of the valid enum values: ${validValues}`);
}
function assert_optional_unsigned_int_field(object, field) {
if(object[field] !== undefined) {
assert_unsigned_int_field(object, field);
}
}
function assert_optional_int_field(object, field) {
if(object[field] !== undefined) {
assert_int_field(object, field);
}
}
function assert_optional_string_field(object, field) {
if(object[field] !== undefined) {
assert_string_field(object, field);
}
}
function assert_optional_number_field(object, field) {
if(object[field] !== undefined) {
assert_number_field(object, field);
}
}
function assert_optional_boolean_field(object, field) {
if(object[field] !== undefined) {
assert_boolean_field(object, field);
}
}
function assert_optional_array_field(object, field) {
if(object[field] !== undefined) {
assert_array_field(object, field);
}
}
function assert_optional_dict_field(object, field) {
if(object[field] !== undefined) {
assert_dict_field(object, field);
}
}
function assert_optional_enum_field(object, field, validValues) {
if(object[field] !== undefined) {
assert_enum_field(object, field, validValues);
}
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...