diff options
Diffstat (limited to 'webkit/extensions')
-rw-r--r-- | webkit/extensions/v8/playback_extension.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/webkit/extensions/v8/playback_extension.cc b/webkit/extensions/v8/playback_extension.cc index 63838fb..8751d36 100644 --- a/webkit/extensions/v8/playback_extension.cc +++ b/webkit/extensions/v8/playback_extension.cc @@ -19,12 +19,25 @@ v8::Extension* PlaybackExtension::Get() { " x += .1;" " return (x % 1);" " };" - " Date.__proto__.now = function() {" - " time_seed += 50;" - " return new orig_date(time_seed);" - " };" " Date = function() {" - " return Date.now();" + " if (this instanceof Date) {" + " switch (arguments.length) {" + " case 0: return new orig_date(time_seed += 50);" + " case 1: return new orig_date(arguments[0]);" + " default: return new orig_date(arguments[0], arguments[1]," + " arguments.length >= 3 ? arguments[2] : 1," + " arguments.length >= 4 ? arguments[3] : 0," + " arguments.length >= 5 ? arguments[4] : 0," + " arguments.length >= 6 ? arguments[5] : 0," + " arguments.length >= 7 ? arguments[6] : 0);" + " }" + " }" + " return new Date().toString();" + " };" + " Date.__proto__ = orig_date;" + " Date.prototype.constructor = Date;" + " orig_date.now = function() {" + " return new Date().getTime();" " };" "})()"); return extension; |