summaryrefslogtreecommitdiffstats
path: root/webkit/extensions
diff options
context:
space:
mode:
authorjnd@chromium.org <jnd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 08:54:41 +0000
committerjnd@chromium.org <jnd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 08:54:41 +0000
commitb6c50b006d92a1dd5049780799ed5a37f0328d46 (patch)
treee01c09969f0f755411d5a8eea196cb968559f28f /webkit/extensions
parent7a2b2d466bab5c1e8ae730b389d7626c8ad058e6 (diff)
downloadchromium_src-b6c50b006d92a1dd5049780799ed5a37f0328d46.zip
chromium_src-b6c50b006d92a1dd5049780799ed5a37f0328d46.tar.gz
chromium_src-b6c50b006d92a1dd5049780799ed5a37f0328d46.tar.bz2
Land patch for WangXianzhu. See http://codereview.chromium.org/1556005/show for the details.
BUG=39768 TBR=Wangxianzhu Review URL: http://codereview.chromium.org/2080002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/extensions')
-rw-r--r--webkit/extensions/v8/playback_extension.cc23
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;