summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/webui/test_api.js
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 21:29:48 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 21:29:48 +0000
commita530a664825ab90fc10028d2bf5f6a21b40cbbf9 (patch)
tree7ecf69f9177eedd02fe35a5597be0c5b41c7e489 /chrome/test/data/webui/test_api.js
parenta03a2227f0ccdbbaab03282066f01c731c594f21 (diff)
downloadchromium_src-a530a664825ab90fc10028d2bf5f6a21b40cbbf9.zip
chromium_src-a530a664825ab90fc10028d2bf5f6a21b40cbbf9.tar.gz
chromium_src-a530a664825ab90fc10028d2bf5f6a21b40cbbf9.tar.bz2
Insert meta tag turning on content-security-protection for chrome://settings, history, downloads pages now that the webkit inspector has been revised to stop calling JS eval().
Review URL: http://codereview.chromium.org/7038046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data/webui/test_api.js')
-rw-r--r--chrome/test/data/webui/test_api.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js
index fc472d2..27d94f8 100644
--- a/chrome/test/data/webui/test_api.js
+++ b/chrome/test/data/webui/test_api.js
@@ -53,9 +53,14 @@
throw new Error(message);
}
- function runTest(currentTest, testArguments) {
+ function runTest(testFunction, testArguments) {
try {
- currentTest = eval(currentTest);
+ // Avoid eval() if at all possible, since it will not work on pages
+ // that have enabled content-security-policy.
+ currentTest = this[testFunction]; // global object -- not a method.
+ if (typeof currentTest === "undefined") {
+ currentTest = eval(testFunction);
+ }
console.log('Running test ' + currentTest.name);
currentTest.apply(null, testArguments);
} catch (e) {