Bug 213455

Summary: Web Inspector: Add support for timezone override in the Page agent
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: Web InspectorAssignee: Philippe Normand <pnormand>
Status: RESOLVED WONTFIX    
Severity: Normal CC: bburg, benjamin, cdumez, cmarcelo, darin, ews-watchlist, hi, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, pfeldman, saam, tzagallo
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch bburg: review-

Description Philippe Normand 2020-06-22 02:47:21 PDT
There are ways to configure the timezone with the TZ environment variable, but having a generic API for this in the Page agent would be nice to have as well. It would also allow fine-grained control over multiple pages, for instance it's not possible currently to have two pages in different timezones. For automation and testing purposes this is a limitation currently.
Comment 1 Philippe Normand 2020-06-22 03:05:43 PDT
Created attachment 402460 [details]
Patch
Comment 2 EWS Watchlist 2020-06-22 03:06:18 PDT
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 3 Philippe Normand 2020-06-22 04:54:17 PDT
Created attachment 402462 [details]
Patch
Comment 4 Philippe Normand 2020-06-22 09:24:18 PDT
Created attachment 402482 [details]
Patch
Comment 5 Darin Adler 2020-06-23 13:02:57 PDT
Comment on attachment 402482 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402482&action=review

> Source/WebCore/inspector/agents/InspectorPageAgent.h:119
> +    void setTimeZone(ErrorString&, const String*) override;

This is failing to compile in Windows, saying it’s not overriding anything.
Comment 6 Philippe Normand 2020-06-24 02:35:57 PDT
Created attachment 402631 [details]
Patch
Comment 7 Philippe Normand 2020-06-24 03:09:53 PDT
That error means InspectorBackendDispatchers.h in DerivedSources wasn't re-generated to take into account the Page.json change. Looks like a win (CMake) bug.
Comment 8 BJ Burg 2020-06-24 14:51:28 PDT
Comment on attachment 402631 [details]
Patch

If this enhancement isn't exposed in Web Inspector user interface, why is it being added to Web Inspector Protocol?

Given that this enhancement doesn't have to do with debugging and inspection, it seems like something more suitable as a WebDriver extension capability (webkit:timezone or similar) or extension command.

I'm not sure whether arbitrarily overriding the timezone after a page has loaded makes sense–for example, cookie expiration would not be affected by this change as it exists currently. It will also not line up with time data that the embeddng application provides via other interfaces, such as extensions.