summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorace@google.com <ace@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-14 22:20:18 +0000
committerace@google.com <ace@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-14 22:20:18 +0000
commitca12c84970275a27de5a423bfd78a1cdd5a8836e (patch)
tree82887bd4b68e4729deb3e644fcd71a900c51bdf9
parent4b59848d8b9dd3a5ba653459bd68968b0bf92993 (diff)
downloadchromium_src-ca12c84970275a27de5a423bfd78a1cdd5a8836e.zip
chromium_src-ca12c84970275a27de5a423bfd78a1cdd5a8836e.tar.gz
chromium_src-ca12c84970275a27de5a423bfd78a1cdd5a8836e.tar.bz2
Add command line flag that removes randomness from javascript functions, to be used during reliability_tests.
Review URL: http://codereview.chromium.org/63143 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13711 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc1
-rw-r--r--chrome/common/chrome_switches.cc7
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/renderer/render_thread.cc3
4 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 882937e..6c5da304 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -251,6 +251,7 @@ bool BrowserRenderProcessHost::Init() {
switches::kJavaScriptFlags,
switches::kRecordMode,
switches::kPlaybackMode,
+ switches::kNoJsRandomness,
switches::kDisableBreakpad,
switches::kFullMemoryCrashReport,
switches::kEnableLogging,
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 4ec169e..0b53400 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -218,6 +218,13 @@ const wchar_t kPlaybackMode[] = L"playback-mode";
// Don't record/playback events when using record & playback.
const wchar_t kNoEvents[] = L"no-events";
+// Support a separate switch that enables the v8 playback extension.
+// The extension causes javascript calls to Date.now() and Math.random()
+// to return consistent values, such that subsequent loads of the same
+// page will result in consistent js-generated data and XHR requests.
+// Pages may still be able to generate inconsistent data from plugins.
+const wchar_t kNoJsRandomness[] = L"no-js-randomness";
+
// Make Windows happy by allowing it to show "Enable access to this program"
// checkbox in Add/Remove Programs->Set Program Access and Defaults. This
// only shows an error box because the only way to hide Chrome is by
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 2ec310d..8f17f3b 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -72,6 +72,7 @@ extern const wchar_t kRestoreLastSession[];
extern const wchar_t kRecordMode[];
extern const wchar_t kPlaybackMode[];
extern const wchar_t kNoEvents[];
+extern const wchar_t kNoJsRandomness[];
extern const wchar_t kHideIcons[];
extern const wchar_t kShowIcons[];
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 2865cc4..cdce9c6 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -304,7 +304,8 @@ void RenderThread::EnsureWebKitInitialized() {
}
if (command_line.HasSwitch(switches::kPlaybackMode) ||
- command_line.HasSwitch(switches::kRecordMode)) {
+ command_line.HasSwitch(switches::kRecordMode) ||
+ command_line.HasSwitch(switches::kNoJsRandomness)) {
WebKit::registerExtension(extensions_v8::PlaybackExtension::Get());
}