diff options
author | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 21:29:48 +0000 |
---|---|---|
committer | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 21:29:48 +0000 |
commit | a530a664825ab90fc10028d2bf5f6a21b40cbbf9 (patch) | |
tree | 7ecf69f9177eedd02fe35a5597be0c5b41c7e489 /chrome/test/data/webui/test_api.js | |
parent | a03a2227f0ccdbbaab03282066f01c731c594f21 (diff) | |
download | chromium_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.js | 9 |
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) { |