[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:
parent
04eed2946a
commit
edad3a0f0f
@ -32,10 +32,11 @@ var prettyPrinted = function prettyPrinted(msg) { return msg; };
|
|||||||
}
|
}
|
||||||
|
|
||||||
const origDate = Date;
|
const origDate = Date;
|
||||||
|
const construct = Reflect.construct;
|
||||||
const constructDate = function(args) {
|
const constructDate = function(args) {
|
||||||
let result;
|
let result;
|
||||||
if (args.length) {
|
if (args.length) {
|
||||||
result = new origDate(...args);
|
result = construct(origDate, args);
|
||||||
} else {
|
} else {
|
||||||
result = new origDate(mockDateNow());
|
result = new origDate(mockDateNow());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user