mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
Backout ce75fb8d5a8b (bug 1187233) for B2G xpcshell failures.
This commit is contained in:
parent
6673eddd94
commit
6729df0f94
@ -3030,26 +3030,11 @@ DateOneArgument(JSContext* cx, const CallArgs& args)
|
||||
MOZ_ASSERT(args.length() == 1);
|
||||
|
||||
if (args.isConstructing()) {
|
||||
if (args[0].isObject()) {
|
||||
RootedObject obj(cx, &args[0].toObject());
|
||||
|
||||
ESClassValue cls;
|
||||
if (!GetBuiltinClass(cx, obj, &cls))
|
||||
return false;
|
||||
|
||||
if (cls == ESClass_Date) {
|
||||
RootedValue unboxed(cx);
|
||||
if (!Unbox(cx, obj, &unboxed))
|
||||
return false;
|
||||
|
||||
return NewDateObject(cx, args, TimeClip(unboxed.toNumber()));
|
||||
}
|
||||
}
|
||||
ClippedTime t;
|
||||
|
||||
if (!ToPrimitive(cx, args[0]))
|
||||
return false;
|
||||
|
||||
ClippedTime t;
|
||||
if (args[0].isString()) {
|
||||
JSLinearString* linearStr = args[0].toString()->ensureLinear(cx);
|
||||
if (!linearStr)
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommonn.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
var BUGNUMBER = 1187233;
|
||||
var summary =
|
||||
"Passing a Date object to |new Date()| should copy it, not convert it to " +
|
||||
"a primitive and create it from that.";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
Date.prototype.toString = Date.prototype.valueOf = null;
|
||||
var d = new Date(new Date(8675309));
|
||||
assertEq(d.getTime(), 8675309);
|
||||
|
||||
Date.prototype.valueOf = () => 42;
|
||||
d = new Date(new Date(8675309));
|
||||
assertEq(d.getTime(), 8675309);
|
||||
|
||||
var D = newGlobal().Date;
|
||||
|
||||
D.prototype.toString = D.prototype.valueOf = null;
|
||||
var d = new Date(new D(3141592654));
|
||||
assertEq(d.getTime(), 3141592654);
|
||||
|
||||
D.prototype.valueOf = () => 525600;
|
||||
d = new Date(new D(3141592654));
|
||||
assertEq(d.getTime(), 3141592654);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
Loading…
Reference in New Issue
Block a user