summaryrefslogtreecommitdiffstats
path: root/webkit/port/bindings/v8/extensions/Playback.cpp
blob: b585ccf77312d6511c3f6213f15dd9f14c811e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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 "Playback.h"

namespace WebCore {

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;
}

}