[foozzie] Properly mock out Date

Yet another corner case how non-deterministic timestamps slipped into
the tests.

Bug: chromium:1064900
Change-Id: I33e8b4c8141b3854b7eca5d7ad9b45b6f5130d9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120584
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66881}
This commit is contained in:
Michael Achenbach 2020-03-26 10:42:38 +01:00 committed by Commit Bot
parent 51a55a3b28
commit b30618cebe
2 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@ assertEquals(0.3, Math.random());
assertEquals(1477662728698, Date.now());
assertEquals(1477662728701, Date.now());
assertEquals(1477662728705, new Date().getTime());
assertEquals(710, new Date.prototype.constructor().getUTCMilliseconds());
// Deterministic arguments in constructor keep working.
assertEquals(819134640000,

View File

@ -46,6 +46,10 @@ var prettyPrinted = function prettyPrinted(msg) { return msg; };
return result;
}
origDate.prototype.constructor = function(...args) {
return constructDate(args);
};
var handler = {
apply: function(target, thisArg, args) {
return constructDate(args);