| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "Playback.h" | 5 #include "Playback.h" |
| 6 | 6 |
| 7 namespace WebCore { | 7 namespace WebCore { |
| 8 | 8 |
| 9 const char* kPlaybackExtensionName = "v8/PlaybackMode"; | 9 const char* kPlaybackExtensionName = "v8/PlaybackMode"; |
| 10 | 10 |
| 11 v8::Extension* PlaybackExtension::Get() { | 11 v8::Extension* PlaybackExtension::Get() { |
| 12 v8::Extension* extension = new v8::Extension( | 12 v8::Extension* extension = new v8::Extension( |
| 13 kPlaybackExtensionName, | 13 kPlaybackExtensionName, |
| 14 "(function () {" | 14 "(function () {" |
| 15 " var orig_date = Date;" | 15 " var orig_date = Date;" |
| 16 " Math.random = function() {" | 16 " Math.random = function() {" |
| 17 " return 0.5;" | 17 " return 0.5;" |
| 18 " };" | 18 " };" |
| 19 " Date.__proto__.now = function() {" | 19 " Date.__proto__.now = function() {" |
| 20 " return new orig_date(1204251968254);" | 20 " return new orig_date(1204251968254);" |
| 21 " };" | 21 " };" |
| 22 " Date = function() {" | 22 " Date = function() {" |
| 23 " return Date.now();" | 23 " return Date.now();" |
| 24 " };" | 24 " };" |
| 25 "})()"); | 25 "})()"); |
| 26 return extension; | 26 return extension; |
| 27 } | 27 } |
| 28 | 28 |
| 29 } | 29 } |
| 30 |
| OLD | NEW |