summaryrefslogtreecommitdiffstats
path: root/webkit/extensions/v8/playback_extension.cc
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 21:39:11 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 21:39:11 +0000
commit06533c0b11ce14b45eb0205fdc28a217eeba763c (patch)
treec2209aab205a7b2216c61be7e1ae6b231b7cb148 /webkit/extensions/v8/playback_extension.cc
parent68acddb6ced1c8d29e84fb1465f331515217e50a (diff)
downloadchromium_src-06533c0b11ce14b45eb0205fdc28a217eeba763c.zip
chromium_src-06533c0b11ce14b45eb0205fdc28a217eeba763c.tar.gz
chromium_src-06533c0b11ce14b45eb0205fdc28a217eeba763c.tar.bz2
Refactor v8 extensions so that they aren't in the WebCore namespace, and can call functions in the rest of Chromium code without having to go through ChromiumBridge (which now lives upstream in the WebKit repository).
R=darin,mbelshe Review URL: http://codereview.chromium.org/40132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/extensions/v8/playback_extension.cc')
-rw-r--r--webkit/extensions/v8/playback_extension.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/webkit/extensions/v8/playback_extension.cc b/webkit/extensions/v8/playback_extension.cc
new file mode 100644
index 0000000..82d0b8a
--- /dev/null
+++ b/webkit/extensions/v8/playback_extension.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/extensions/v8/playback_extension.h"
+
+namespace extensions_v8 {
+
+const char* kPlaybackExtensionName = "v8/PlaybackMode";
+
+v8::Extension* PlaybackExtension::Get() {
+ v8::Extension* extension = new v8::Extension(
+ kPlaybackExtensionName,
+ "(function () {"
+ " var orig_date = Date;"
+ " Math.random = function() {"
+ " return 0.5;"
+ " };"
+ " Date.__proto__.now = function() {"
+ " return new orig_date(1204251968254);"
+ " };"
+ " Date = function() {"
+ " return Date.now();"
+ " };"
+ "})()");
+ return extension;
+}
+
+} // namespace extensions_v8
+