sereneblue / chameleon

WebExtension port of Random Agent Spoofer
https://sereneblue.github.io/chameleon
GNU General Public License v3.0
518 stars 53 forks source link

Enhance time spoofing #48

Closed WPFilmmaker closed 6 years ago

WPFilmmaker commented 6 years ago

21 Added the possibility to set a timezone, however reading on random-agent-spoofer bugtracker, it seems that there are several places where timezone has to be changed. I couldn't understand whether chameleon does that, hence my ticket. If chameleon hasn't that implemented probably it would be good adding such enhancement?

From: https://github.com/dillbyrne/random-agent-spoofer/issues/66

_"Currently only the time zone offset is spoofed. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toGMTString https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString"_

"Some date integer functions were originally included in the spoofing but they were dropped as they were causing page timeouts. Date locale strings will need to be set using the language headers for all the spoffed attributes to match. The selection of the time zone abbreviation is currently randomly selected when a timezone has been chosen. This could be improved to allow users to select the abbreviation in addition to the timezone."

"Time based fuctions such as getHours() need to be spoofed in such a way as to not break functionality like the previous version. Moving the date/time spoofing logic into the inject script will probably address the breakage as the functions will return updated but spoofed data each time they are called."

Does chameleon changes

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toGMTString

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

?

sereneblue commented 6 years ago

It looks like toGMTString has been deprecated so it's no longer relevant (it's still spoofed). Chameleon does spoof the locale string. Everything appears to work when visiting browserspy.dk.