Backed out changesets a2f8673cfafa and c7bc74ed9256 (bug 781570) for b2g bustage.

This commit is contained in:
Ryan VanderMeulen 2013-01-24 07:09:13 -05:00
Родитель ff8945e8f3
Коммит 2b3226b6d4
4 изменённых файлов: 118 добавлений и 466 удалений

Просмотреть файл

@ -1070,9 +1070,6 @@ bool
nsHTMLInputElement::ConvertStringToNumber(nsAString& aValue,
double& aResultValue) const
{
MOZ_ASSERT(DoesValueAsNumberApply(),
"ConvertStringToNumber only applies if .valueAsNumber applies");
switch (mType) {
case NS_FORM_INPUT_NUMBER:
{
@ -1103,7 +1100,7 @@ nsHTMLInputElement::ConvertStringToNumber(nsAString& aValue,
jsval rval;
jsval fullYear[3];
fullYear[0].setInt32(year);
fullYear[1].setInt32(month - 1);
fullYear[1].setInt32(month-1);
fullYear[2].setInt32(day);
if (!JS::Call(ctx, date, "setUTCFullYear", 3, fullYear, &rval)) {
JS_ClearPendingException(ctx);
@ -1123,14 +1120,6 @@ nsHTMLInputElement::ConvertStringToNumber(nsAString& aValue,
aResultValue = timestamp.toNumber();
return true;
}
case NS_FORM_INPUT_TIME:
uint32_t milliseconds;
if (!ParseTime(aValue, &milliseconds)) {
return false;
}
aResultValue = static_cast<double>(milliseconds);
return true;
default:
return false;
}
@ -1239,8 +1228,8 @@ bool
nsHTMLInputElement::ConvertNumberToString(double aValue,
nsAString& aResultString) const
{
MOZ_ASSERT(DoesValueAsNumberApply(),
"ConvertNumberToString is only implemented for types implementing .valueAsNumber");
MOZ_ASSERT(mType == NS_FORM_INPUT_DATE || mType == NS_FORM_INPUT_NUMBER,
"ConvertNumberToString is only implemented for type='{number,date}'");
MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(aValue) && !MOZ_DOUBLE_IS_INFINITE(aValue),
"aValue must be a valid non-Infinite number.");
@ -1284,36 +1273,6 @@ nsHTMLInputElement::ConvertNumberToString(double aValue,
return true;
}
case NS_FORM_INPUT_TIME:
{
// Per spec, we need to truncate |aValue| and we should only represent
// times inside a day [00:00, 24:00[, which means that we should do a
// modulo on |aValue| using the number of milliseconds in a day (86400000).
uint32_t value = NS_floorModulo(floor(aValue), 86400000);
uint16_t milliseconds = value % 1000;
value /= 1000;
uint8_t seconds = value % 60;
value /= 60;
uint8_t minutes = value % 60;
value /= 60;
uint8_t hours = value;
if (milliseconds != 0) {
aResultString.AppendPrintf("%02d:%02d:%02d.%03d",
hours, minutes, seconds, milliseconds);
} else if (seconds != 0) {
aResultString.AppendPrintf("%02d:%02d:%02d",
hours, minutes, seconds);
} else {
aResultString.AppendPrintf("%02d:%02d", hours, minutes);
}
return true;
}
default:
MOZ_NOT_REACHED();
return false;
@ -1323,73 +1282,45 @@ nsHTMLInputElement::ConvertNumberToString(double aValue,
NS_IMETHODIMP
nsHTMLInputElement::GetValueAsDate(JSContext* aCtx, jsval* aDate)
{
if (mType != NS_FORM_INPUT_DATE && mType != NS_FORM_INPUT_TIME) {
if (mType != NS_FORM_INPUT_DATE) {
aDate->setNull();
return NS_OK;
}
switch (mType) {
case NS_FORM_INPUT_DATE:
{
uint32_t year, month, day;
nsAutoString value;
GetValueInternal(value);
if (!GetValueAsDate(value, &year, &month, &day)) {
aDate->setNull();
return NS_OK;
}
JSObject* date = JS_NewDateObjectMsec(aCtx, 0);
if (!date) {
JS_ClearPendingException(aCtx);
aDate->setNull();
return NS_OK;
}
jsval rval;
jsval fullYear[3];
fullYear[0].setInt32(year);
fullYear[1].setInt32(month - 1);
fullYear[2].setInt32(day);
if(!JS::Call(aCtx, date, "setUTCFullYear", 3, fullYear, &rval)) {
JS_ClearPendingException(aCtx);
aDate->setNull();
return NS_OK;
}
aDate->setObjectOrNull(date);
return NS_OK;
}
case NS_FORM_INPUT_TIME:
{
uint32_t millisecond;
nsAutoString value;
GetValueInternal(value);
if (!ParseTime(value, &millisecond)) {
aDate->setNull();
return NS_OK;
}
JSObject* date = JS_NewDateObjectMsec(aCtx, millisecond);
if (!date) {
JS_ClearPendingException(aCtx);
aDate->setNull();
return NS_OK;
}
aDate->setObjectOrNull(date);
return NS_OK;
}
uint32_t year, month, day;
nsAutoString value;
GetValueInternal(value);
if (!GetValueAsDate(value, &year, &month, &day)) {
aDate->setNull();
return NS_OK;
}
MOZ_NOT_REACHED();
return NS_ERROR_UNEXPECTED;
JSObject* date = JS_NewDateObjectMsec(aCtx, 0);
if (!date) {
JS_ClearPendingException(aCtx);
aDate->setNull();
return NS_OK;
}
jsval rval;
jsval fullYear[3];
fullYear[0].setInt32(year);
fullYear[1].setInt32(month-1);
fullYear[2].setInt32(day);
if(!JS::Call(aCtx, date, "setUTCFullYear", 3, fullYear, &rval)) {
JS_ClearPendingException(aCtx);
aDate->setNull();
return NS_OK;
}
aDate->setObjectOrNull(date);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLInputElement::SetValueAsDate(JSContext* aCtx, const jsval& aDate)
{
if (mType != NS_FORM_INPUT_DATE && mType != NS_FORM_INPUT_TIME) {
if (mType != NS_FORM_INPUT_DATE) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
@ -3175,12 +3106,6 @@ nsHTMLInputElement::DigitSubStringToNumber(const nsAString& aStr,
bool
nsHTMLInputElement::IsValidTime(const nsAString& aValue) const
{
return ParseTime(aValue, nullptr);
}
/* static */ bool
nsHTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult)
{
/* The string must have the following parts:
* - HOURS: two digits, value being in [0, 23];
@ -3215,9 +3140,6 @@ nsHTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult)
}
if (aValue.Length() == 5) {
if (aResult) {
*aResult = ((hours * 60) + minutes) * 60000;
}
return true;
}
@ -3232,9 +3154,6 @@ nsHTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult)
}
if (aValue.Length() == 8) {
if (aResult) {
*aResult = (((hours * 60) + minutes) * 60 + seconds) * 1000;
}
return true;
}
@ -3245,16 +3164,7 @@ nsHTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult)
}
uint32_t fractionsSeconds;
if (!DigitSubStringToNumber(aValue, 9, aValue.Length() - 9, &fractionsSeconds)) {
return false;
}
if (aResult) {
*aResult = (((hours * 60) + minutes) * 60 + seconds) * 1000 +
fractionsSeconds * pow(10, 3 - (aValue.Length() - 9));
}
return true;
return DigitSubStringToNumber(aValue, 9, aValue.Length() - 9, &fractionsSeconds);
}
bool

Просмотреть файл

@ -496,7 +496,7 @@ protected:
/**
* Returns if valueAsNumber attribute applies for the current type.
*/
bool DoesValueAsNumberApply() const { return DoesMinMaxApply() || mType == NS_FORM_INPUT_TIME; }
bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); }
/**
* Returns if the maxlength attribute applies for the current type.
@ -635,19 +635,6 @@ protected:
*/
bool IsValidTime(const nsAString& aValue) const;
/**
* Returns the time expressed in milliseconds of |aValue| being parsed as a
* time following the HTML specifications:
* http://www.whatwg.org/specs/web-apps/current-work/#parse-a-time-string
*
* Note: |aResult| can be null.
*
* @param aValue the string to be parsed.
* @param aResult the time expressed in milliseconds representing the time [out]
* @return Whether the parsing was successful.
*/
static bool ParseTime(const nsAString& aValue, uint32_t* aResult);
/**
* Sets the value of the element to the string representation of the double.
*

Просмотреть файл

@ -23,43 +23,42 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=769370
var element = document.createElement("input");
var validTypes =
[
["text", false],
["password", false],
["search", false],
["telephone", false],
["email", false],
["url", false],
["hidden", false],
["checkbox", false],
["radio", false],
["file", false],
["submit", false],
["image", false],
["reset", false],
["button", false],
["number", false],
["date", true],
["time", true],
// The next types have not been implemented but will fallback to "text"
// which has the same value.
["range", false],
["color", false],
];
var todoTypes =
[
["datetime", true],
["month", true],
["week", true],
["datetime-local", true],
];
function checkAvailability()
{
var testData =
[
["text", false],
["password", false],
["search", false],
["telephone", false],
["email", false],
["url", false],
["hidden", false],
["checkbox", false],
["radio", false],
["file", false],
["submit", false],
["image", false],
["reset", false],
["button", false],
["number", false],
["date", true],
// The next types have not been implemented but will fallback to "text"
// which has the same value.
["range", false],
["color", false],
];
for (data of validTypes) {
var todoList =
[
["datetime", true],
["month", true],
["week", true],
["time", true],
["datetime-local", true],
];
for (data of testData) {
var exceptionCatched = false;
element.type = data[0];
try {
@ -80,7 +79,7 @@ function checkAvailability()
" availability is not correct");
}
for (data of todoTypes) {
for (data of todoList) {
var exceptionCatched = false;
element.type = data[0];
try {
@ -102,46 +101,7 @@ function checkAvailability()
}
}
function checkGarbageValues()
{
for (type of validTypes) {
if (!type[1]) {
continue;
}
type = type[0];
var element = document.createElement('input');
element.type = type;
element.value = "test";
element.valueAsDate = null;
is(element.value, "", "valueAsDate should set the value to the empty string");
element.value = "test";
element.valueAsDate = undefined;
is(element.value, "", "valueAsDate should set the value to the empty string");
element.value = "test";
element.valueAsDate = new Date(NaN);
is(element.value, "", "valueAsDate should set the value to the empty string");
var illegalValues = [
"foobar", 42, {}, function() { return 42; }, function() { return Date(); }
];
for (value of illegalValues) {
try {
var caught = false;
element.valueAsDate = value;
} catch(e) {
caught = true;
}
ok(caught, "Assigning " + value + " to .valueAsDate should throw");
}
}
}
function checkDateGet()
function checkGet()
{
var validData =
[
@ -192,7 +152,7 @@ function checkDateGet()
}
function checkDateSet()
function checkSet()
{
var testData =
[
@ -216,6 +176,10 @@ function checkDateSet()
// the corresponding date string is the empty string
[ -62135596800001, "" ],
// Invalid dates.
// We set the value to something different than the empty string because
// NaN should set the value to the empty string.
[ 86400000, "1970-01-02" ],
[ NaN, "" ],
];
element.type = "date";
@ -224,169 +188,71 @@ function checkDateSet()
is(element.value, data[1], "valueAsDate should set the value to "
+ data[1]);
}
}
function checkTimeGet()
{
var tests = [
// Some invalid values to begin.
{ value: "", result: null },
{ value: "foobar", result: null },
{ value: "00:", result: null },
{ value: "24:00", result: null },
{ value: "00:99", result: null },
{ value: "00:00:", result: null },
{ value: "00:00:99", result: null },
{ value: "00:00:00:", result: null },
{ value: "00:00:00.", result: null },
{ value: "00:00:00.0000", result: null },
// Some simple valid values.
{ value: "00:00", result: { time: 0, hours: 0, minutes: 0, seconds: 0, ms: 0 } },
{ value: "00:01", result: { time: 60000, hours: 0, minutes: 1, seconds: 0, ms: 0 } },
{ value: "01:00", result: { time: 3600000, hours: 1, minutes: 0, seconds: 0, ms: 0 } },
{ value: "01:01", result: { time: 3660000, hours: 1, minutes: 1, seconds: 0, ms: 0 } },
{ value: "13:37", result: { time: 49020000, hours: 13, minutes: 37, seconds: 0, ms: 0 } },
// Valid values including seconds.
{ value: "00:00:01", result: { time: 1000, hours: 0, minutes: 0, seconds: 1, ms: 0 } },
{ value: "13:37:42", result: { time: 49062000, hours: 13, minutes: 37, seconds: 42, ms: 0 } },
// Valid values including seconds fractions.
{ value: "00:00:00.001", result: { time: 1, hours: 0, minutes: 0, seconds: 0, ms: 1 } },
{ value: "00:00:00.123", result: { time: 123, hours: 0, minutes: 0, seconds: 0, ms: 123 } },
{ value: "00:00:00.100", result: { time: 100, hours: 0, minutes: 0, seconds: 0, ms: 100 } },
{ value: "00:00:00.000", result: { time: 0, hours: 0, minutes: 0, seconds: 0, ms: 0 } },
{ value: "20:17:31.142", result: { time: 73051142, hours: 20, minutes: 17, seconds: 31, ms: 142 } },
// Highest possible value.
{ value: "23:59:59.999", result: { time: 86399999, hours: 23, minutes: 59, seconds: 59, ms: 999 } },
// Some values with one or two digits for the fraction of seconds.
{ value: "00:00:00.1", result: { time: 100, hours: 0, minutes: 0, seconds: 0, ms: 100 } },
{ value: "00:00:00.14", result: { time: 140, hours: 0, minutes: 0, seconds: 0, ms: 140 } },
{ value: "13:37:42.7", result: { time: 49062700, hours: 13, minutes: 37, seconds: 42, ms: 700 } },
{ value: "23:31:12.23", result: { time: 84672230, hours: 23, minutes: 31, seconds: 12, ms: 230 } },
element.value = "test";
element.valueAsDate = null;
is(element.value, "", "valueAsDate should set the value to the empty string");
element.value = "test";
element.valueAsDate = undefined;
is(element.value, "", "valueAsDate should set the value to the empty string");
var illegalValues = [
"foobar", 42, {}, function() { return 42; }, function() { return Date(); }
];
var element = document.createElement('input');
element.type = 'time';
for (test of tests) {
element.value = test.value;
if (test.result === null) {
is(element.valueAsDate, null, "element.valueAsDate should return null");
} else {
var date = element.valueAsDate;
isnot(date, null, "element.valueAsDate should not be null");
is(date.getTime(), test.result.time);
is(date.getUTCHours(), test.result.hours);
is(date.getUTCMinutes(), test.result.minutes);
is(date.getUTCSeconds(), test.result.seconds);
is(date.getUTCMilliseconds(), test.result.ms);
for (value of illegalValues) {
try {
var caught = false;
element.valueAsDate = value;
} catch(e) {
caught = true;
}
}
}
function checkTimeSet()
{
var tests = [
// Simple tests.
{ value: 0, result: "00:00" },
{ value: 1, result: "00:00:00.001" },
{ value: 100, result: "00:00:00.100" },
{ value: 1000, result: "00:00:01" },
{ value: 60000, result: "00:01" },
{ value: 3600000, result: "01:00" },
{ value: 83622234, result: "23:13:42.234" },
// Some edge cases.
{ value: 86400000, result: "00:00" },
{ value: 86400001, result: "00:00:00.001" },
{ value: 170022234, result: "23:13:42.234" },
{ value: 432000000, result: "00:00" },
{ value: -1, result: "23:59:59.999" },
{ value: -86400000, result: "00:00" },
{ value: -86400001, result: "23:59:59.999" },
{ value: -56789, result: "23:59:03.211" },
{ value: 0.9, result: "00:00" },
];
var element = document.createElement('input');
element.type = 'time';
for (test of tests) {
element.valueAsDate = new Date(test.value);
is(element.value, test.result,
"element.value should have been changed by setting valueAsDate");
ok(caught, "Assigning " + value + " to .valueAsDate should throw");
}
}
function checkWithBustedPrototype()
{
for (type of validTypes) {
if (!type[1]) {
continue;
}
var element = document.createElement('input');
element.type = 'date';
type = type[0];
var witnessDate = new Date();
var element = document.createElement('input');
element.type = type;
Date.prototype.getUTCFullYear = function() { return {}; };
Date.prototype.getUTCMonth = function() { return {}; };
Date.prototype.getUTCDate = function() { return {}; };
Date.prototype.getTime = function() { return {}; };
Date.prototype.setUTCFullYear = function(y,m,d) { };
var witnessDate = new Date();
element.valueAsDate = new Date();
var backupPrototype = {};
backupPrototype.getUTCFullYear = Date.prototype.getUTCFullYear;
backupPrototype.getUTCMonth = Date.prototype.getUTCMonth;
backupPrototype.getUTCDate = Date.prototype.getUTCDate;
backupPrototype.getTime = Date.prototype.getTime;
backupPrototype.setUTCFullYear = Date.prototype.setUTCFullYear;
todo_isnot(element.valueAsDate, null, ".valueAsDate should not return null");
// TODO: check the Date object value (UTCFullYear, UTCMonth and UTCDate)
// when .valueAsDate will stop returning null.
Date.prototype.getUTCFullYear = function() { return {}; };
Date.prototype.getUTCMonth = function() { return {}; };
Date.prototype.getUTCDate = function() { return {}; };
Date.prototype.getTime = function() { return {}; };
Date.prototype.setUTCFullYear = function(y,m,d) { };
// Same test as above but using NaN instead of {}.
element.valueAsDate = new Date();
Date.prototype.getUTCFullYear = function() { return NaN; };
Date.prototype.getUTCMonth = function() { return NaN; };
Date.prototype.getUTCDate = function() { return NaN; };
Date.prototype.getTime = function() { return NaN; };
Date.prototype.setUTCFullYear = function(y,m,d) { };
todo_isnot(element.valueAsDate, null, ".valueAsDate should not return null");
// TODO: check the Date object value (UTCFullYear, UTCMonth and UTCDate)
// when .valueAsDate will stop returning null.
element.valueAsDate = new Date();
// Same test as above but using NaN instead of {}.
Date.prototype.getUTCFullYear = function() { return NaN; };
Date.prototype.getUTCMonth = function() { return NaN; };
Date.prototype.getUTCDate = function() { return NaN; };
Date.prototype.getTime = function() { return NaN; };
Date.prototype.setUTCFullYear = function(y,m,d) { };
element.valueAsDate = new Date();
todo_isnot(element.valueAsDate, null, ".valueAsDate should not return null");
// TODO: check the Date object value (UTCFullYear, UTCMonth and UTCDate)
// when .valueAsDate will stop returning null.
Date.prototype.getUTCFullYear = backupPrototype.getUTCFullYear;
Date.prototype.getUTCMonth = backupPrototype.getUTCMonth;
Date.prototype.getUTCDate = backupPrototype.getUTCDate;
Date.prototype.getTime = backupPrototype.getTime;
Date.prototype.setUTCFullYear = backupPrototype.setUTCFullYear;
}
todo_isnot(element.valueAsDate, null, ".valueAsDate should not return null");
// TODO: check the Date object value (UTCFullYear, UTCMonth and UTCDate)
// when .valueAsDate will stop returning null.
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
checkAvailability();
checkGarbageValues();
checkGet();
checkSet();
checkWithBustedPrototype();
// Test <input type='date'>.
checkDateGet();
checkDateSet();
// Test <input type='time'>.
checkTimeGet();
checkTimeSet();
SimpleTest.finish();
});

Просмотреть файл

@ -21,6 +21,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=636737
* This test is checking .valueAsNumber.
*/
// Global variable used by all functions.
var element = document.createElement("input");
function checkAvailability()
{
var testData =
@ -41,7 +44,6 @@ function checkAvailability()
["button", false],
["number", true],
["date", true],
["time", true],
// The next types have not been implemented but will fallback to "text"
// which has the same value.
["color", false],
@ -52,11 +54,11 @@ function checkAvailability()
["datetime", true],
["month", true],
["week", true],
["time", true],
["datetime-local", true],
["range", true],
];
var element = document.createElement('input');
for (data of testData) {
var exceptionCatched = false;
@ -121,7 +123,6 @@ function checkNumberGet()
["42,13", null], // comma can't be used as a decimal separator
];
var element = document.createElement('input');
element.type = "number";
for (data of testData) {
element.value = data[0];
@ -161,7 +162,6 @@ function checkNumberSet()
[NaN, ""],
];
var element = document.createElement('input');
element.type = "number";
for (data of testData) {
var caught = false;
@ -213,7 +213,6 @@ function checkDateGet()
"1900-02-29",
];
var element = document.createElement('input');
element.type = "date";
for (data of validData) {
element.value = data[0];
@ -269,7 +268,6 @@ function checkDateSet()
[ -Infinity, "2011-02-28", true ],
];
var element = document.createElement('input');
element.type = "date";
for (data of testData) {
var caught = false;
@ -291,111 +289,6 @@ function checkDateSet()
}
function checkTimeGet()
{
var tests = [
// Some invalid values to begin.
{ value: "", result: NaN },
{ value: "foobar", result: NaN },
{ value: "00:", result: NaN },
{ value: "24:00", result: NaN },
{ value: "00:99", result: NaN },
{ value: "00:00:", result: NaN },
{ value: "00:00:99", result: NaN },
{ value: "00:00:00:", result: NaN },
{ value: "00:00:00.", result: NaN },
{ value: "00:00:00.0000", result: NaN },
// Some simple valid values.
{ value: "00:00", result: 0 },
{ value: "00:01", result: 60000 },
{ value: "01:00", result: 3600000 },
{ value: "01:01", result: 3660000 },
{ value: "13:37", result: 49020000 },
// Valid values including seconds.
{ value: "00:00:01", result: 1000 },
{ value: "13:37:42", result: 49062000 },
// Valid values including seconds fractions.
{ value: "00:00:00.001", result: 1 },
{ value: "00:00:00.123", result: 123 },
{ value: "00:00:00.100", result: 100 },
{ value: "00:00:00.000", result: 0 },
{ value: "20:17:31.142", result: 73051142 },
// Highest possible value.
{ value: "23:59:59.999", result: 86399999 },
// Some values with one or two digits for the fraction of seconds.
{ value: "00:00:00.1", result: 100 },
{ value: "00:00:00.14", result: 140 },
{ value: "13:37:42.7", result: 49062700 },
{ value: "23:31:12.23", result: 84672230 },
];
var element = document.createElement('input');
element.type = 'time';
for (test of tests) {
element.value = test.value;
if (isNaN(test.result)) {
ok(isNaN(element.valueAsNumber),
"invalid value should have .valueAsNumber return NaN");
} else {
is(element.valueAsNumber, test.result,
".valueAsNumber should return " + test.result);
}
}
}
function checkTimeSet()
{
var tests = [
// Some NaN values (should set to empty string).
{ value: NaN, result: "" },
{ value: "foobar", result: "" },
{ value: function() {}, result: "" },
// Inifinity (should throw).
{ value: Infinity, throw: true },
{ value: -Infinity, throw: true },
// "" converts to 0... JS is fun :)
{ value: "", result: "00:00" },
// Simple tests.
{ value: 0, result: "00:00" },
{ value: 1, result: "00:00:00.001" },
{ value: 100, result: "00:00:00.100" },
{ value: 1000, result: "00:00:01" },
{ value: 60000, result: "00:01" },
{ value: 3600000, result: "01:00" },
{ value: 83622234, result: "23:13:42.234" },
// Some edge cases.
{ value: 86400000, result: "00:00" },
{ value: 86400001, result: "00:00:00.001" },
{ value: 170022234, result: "23:13:42.234" },
{ value: 432000000, result: "00:00" },
{ value: -1, result: "23:59:59.999" },
{ value: -86400000, result: "00:00" },
{ value: -86400001, result: "23:59:59.999" },
{ value: -56789, result: "23:59:03.211" },
{ value: 0.9, result: "00:00" },
];
var element = document.createElement('input');
element.type = 'time';
for (test of tests) {
try {
var caught = false;
element.valueAsNumber = test.value;
is(element.value, test.result, "value should return " + test.result);
} catch(e) {
caught = true;
}
if (!test.throw) {
test.throw = false;
}
is(caught, test.throw, "the test throwing status should be " + test.throw);
}
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
checkAvailability();
@ -408,10 +301,6 @@ checkNumberSet();
checkDateGet();
checkDateSet();
// <input type='time'> test
checkTimeGet();
checkTimeSet();
SimpleTest.finish();
});