[foozzie] Make date mock more reliable.

TBR=mathias@chromium.org

Bug: chromium:1054390
Change-Id: I9533a0ca0faa0afa7032aa7dde144df48408c9d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2066958
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66377}
This commit is contained in:
Michael Achenbach 2020-02-20 16:57:23 +01:00 committed by Commit Bot
parent 04eed2946a
commit edad3a0f0f

View File

@ -32,10 +32,11 @@ var prettyPrinted = function prettyPrinted(msg) { return msg; };
}
const origDate = Date;
const construct = Reflect.construct;
const constructDate = function(args) {
let result;
if (args.length) {
result = new origDate(...args);
result = construct(origDate, args);
} else {
result = new origDate(mockDateNow());
}