Backout ce75fb8d5a8b (bug 1187233) for B2G xpcshell failures.

This commit is contained in:
Jan de Mooij 2015-10-19 16:37:52 +02:00
parent 6673eddd94
commit 6729df0f94
2 changed files with 1 additions and 56 deletions

View File

@ -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)

View File

@ -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");