New issue
Advanced search Search tips

Issue 751993 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner:
Closed: Mar 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocked on:
issue 802217



Sign in to add a comment

Support running JS code at a give time/date

Project Member Reported by dats@chromium.org, Aug 3 2017

Issue description

To allow to execute code in a context of a particular time or date (e.g. when codepath depends on whether it's say evening or New Year) there is a need for a way to provide it bypassing actual system time.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/b8d4ce2b9955ebd08159a522c834a9a8d31dcd4c

commit b8d4ce2b9955ebd08159a522c834a9a8d31dcd4c
Author: Sergei D <dats@chromium.org>
Date: Wed Aug 09 05:55:23 2017

Add get current wall-clock time to the Platform

To avoid breaking Chromium we expose a stub method first, and will start
using it only when V8 rolls into Chromium and we implement it there.

Bug:  chromium:751993 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ida1f96f2dfa833552e7adfa36a580a6ef1bdd1aa
Reviewed-on: https://chromium-review.googlesource.com/604812
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47233}
[modify] https://crrev.com/b8d4ce2b9955ebd08159a522c834a9a8d31dcd4c/include/v8-platform.h

Project Member

Comment 2 by bugdroid1@chromium.org, Aug 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cdd78f7a5b1cdf69d89fcaf1d9bac247f8e2a2f6

commit cdd78f7a5b1cdf69d89fcaf1d9bac247f8e2a2f6
Author: Sergei D <dats@chromium.org>
Date: Tue Aug 22 01:45:25 2017

Implement getting current time in V8Platform.

V8 is going to delegate time requests to Platform interface.

Bug:  chromium:751993 
Change-Id: If5ac2ae28875ea9eb8a4b5845c98f6b040c1777e
Reviewed-on: https://chromium-review.googlesource.com/618068
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496168}
[modify] https://crrev.com/cdd78f7a5b1cdf69d89fcaf1d9bac247f8e2a2f6/gin/public/v8_platform.h
[modify] https://crrev.com/cdd78f7a5b1cdf69d89fcaf1d9bac247f8e2a2f6/gin/v8_platform.cc

Project Member

Comment 3 by bugdroid1@chromium.org, Aug 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/837b80166689d91d758355a73a507d5d603a91c8

commit 837b80166689d91d758355a73a507d5d603a91c8
Author: Sergei D <dats@chromium.org>
Date: Mon Aug 28 09:28:23 2017

Export default implementation of getting wall-clock time.

Derived projects need easy access to the original V8's implementation of
time to implement Platform interface.

Bug:  chromium:751993 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I97ee77929fda5930e7d75ca8609797673485cec3
Reviewed-on: https://chromium-review.googlesource.com/636884
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47638}
[modify] https://crrev.com/837b80166689d91d758355a73a507d5d603a91c8/include/v8-platform.h
[modify] https://crrev.com/837b80166689d91d758355a73a507d5d603a91c8/src/v8.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Aug 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/11ba497cd887b6cdedba403d540094433082b33b

commit 11ba497cd887b6cdedba403d540094433082b33b
Author: Sergei D <dats@chromium.org>
Date: Wed Aug 30 06:28:09 2017

Delegate getting current wall-clock time to the Platform interface.

To enable executing code in a context of a particular time or date (e.g. when
codepath depends on whether it's say evening or New Year) there is a need for
a way to provide it bypassing actual system time.

Bug:  chromium:751993 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Iee35d97b74345f63fff814a65a6f134d7c970341
Reviewed-on: https://chromium-review.googlesource.com/598666
Commit-Queue: Sergei Datsenko <dats@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47700}
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/include/v8-platform.h
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/compiler/graph-visualizer.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/d8.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/libplatform/default-platform.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/libplatform/default-platform.h
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/log.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/objects.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/src/perf-jit.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/test/cctest/cctest.h
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/test/cctest/test-cpu-profiler.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/test/inspector/isolate-data.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
[modify] https://crrev.com/11ba497cd887b6cdedba403d540094433082b33b/test/unittests/libplatform/default-platform-unittest.cc

Comment 5 by dats@chromium.org, Nov 21 2017

ov 3
To achieve predictable and reproducible results of rendering a page in headless chrome we need control over what time is being assumed by the JS engine. I suggest adding a method or two to the Emulation domain to override current time and timezone.

This will be handled by EmulationHandler (https://cs.chromium.org/chromium/src/content/browser/devtools/protocol/emulation_handler.h). Time needs to be IPC-forwarded (https://cs.chromium.org/chromium/src/content/common/renderer.mojom) to the Renderer process so it can be used as an override in gin's implementation of v8::Platform (https://cs.chromium.org/chromium/src/gin/v8_platform.cc?l=271).

Timezone for now must be enforced browser-wide with tzset() straight in the handler because TZ syscalls are proxied from renderer to browser (https://cs.chromium.org/chromium/src/content/zygote/zygote_main_linux.cc?l=150), but when v8 completes their switch to icu timezones (https://cs.chromium.org/chromium/src/v8/src/flag-definitions.h?type=cs&l=267) this can also be set per-renderer by using icu's API's (like this: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/time_zone_monitor/TimeZoneMonitorClient.cpp?q=timezonemonitorclient&dr=CSs&l=63).

Comment 6 Deleted

Comment 8 by alph@chromium.org, Dec 22 2017

 Issue 796371  has been merged into this issue.
Blockedon: 802217
Project Member

Comment 10 by bugdroid1@chromium.org, Jan 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a936793513a285ef763bda87f1eb20ea676ad0f5

commit a936793513a285ef763bda87f1eb20ea676ad0f5
Author: Eric Seckler <eseckler@chromium.org>
Date: Thu Jan 25 17:04:12 2018

base: Add override mechanism for Time/TimeTicks/ThreadTicks::Now.

Allows clients to provide functions to override the return values of
Time::Now(), TimeTicks::Now(), ThreadTicks::Now().

Also adds a way to bypass the override in places where real timestamps
should be used even if an override is set.

Bug:  802217 ,  751993 
Change-Id: I76ce536caf9bf0ef5e580abcc23215ce9851ee34
Reviewed-on: https://chromium-review.googlesource.com/867911
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Yuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531923}
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/BUILD.gn
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time.cc
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_fuchsia.cc
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_mac.cc
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_now_posix.cc
[add] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_override.cc
[add] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_override.h
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_unittest.cc
[modify] https://crrev.com/a936793513a285ef763bda87f1eb20ea676ad0f5/base/time/time_win.cc

Comment 11 by dats@chromium.org, Mar 7 2018

Status: WontFix (was: Started)
Obsolete

Sign in to add a comment