зеркало из https://github.com/mozilla/pjs.git
ECMA mandates a ToPrimitive on Date constructor arguments that we didn't have.
This commit is contained in:
Родитель
552c1ec950
Коммит
16564bcb92
|
@ -844,11 +844,13 @@ public class NativeDate extends ScriptableObject {
|
||||||
// if called with just one arg -
|
// if called with just one arg -
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
double date;
|
double date;
|
||||||
// if it's not a string, use it as a millisecond date
|
if (args[0] instanceof Scriptable)
|
||||||
|
args[0] = ((Scriptable) args[0]).getDefaultValue(null);
|
||||||
if (!(args[0] instanceof String)) {
|
if (!(args[0] instanceof String)) {
|
||||||
|
// if it's not a string, use it as a millisecond date
|
||||||
date = ScriptRuntime.toNumber(args[0]);
|
date = ScriptRuntime.toNumber(args[0]);
|
||||||
} else {
|
} else {
|
||||||
// it's a string; parse it.
|
// it's a string; parse it.
|
||||||
String str = (String) args[0];
|
String str = (String) args[0];
|
||||||
date = date_parseString(str);
|
date = date_parseString(str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -844,11 +844,13 @@ public class NativeDate extends ScriptableObject {
|
||||||
// if called with just one arg -
|
// if called with just one arg -
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
double date;
|
double date;
|
||||||
// if it's not a string, use it as a millisecond date
|
if (args[0] instanceof Scriptable)
|
||||||
|
args[0] = ((Scriptable) args[0]).getDefaultValue(null);
|
||||||
if (!(args[0] instanceof String)) {
|
if (!(args[0] instanceof String)) {
|
||||||
|
// if it's not a string, use it as a millisecond date
|
||||||
date = ScriptRuntime.toNumber(args[0]);
|
date = ScriptRuntime.toNumber(args[0]);
|
||||||
} else {
|
} else {
|
||||||
// it's a string; parse it.
|
// it's a string; parse it.
|
||||||
String str = (String) args[0];
|
String str = (String) args[0];
|
||||||
date = date_parseString(str);
|
date = date_parseString(str);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче