Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: chrome/test/data/webui/test_api.js

Issue 7038046: Insert meta tag turning on content-security-protection for chrome://settings, history, downloads ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/options.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/test_api.js
===================================================================
--- chrome/test/data/webui/test_api.js (revision 86705)
+++ chrome/test/data/webui/test_api.js (working copy)
@@ -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) {
« no previous file with comments | « chrome/browser/resources/options/options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698