Chromium Code Reviews| Index: chrome/test/data/webui/test_api.js |
| =================================================================== |
| --- chrome/test/data/webui/test_api.js (revision 86434) |
| +++ 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); |
| + } |
|
abarth-chromium
2011/05/24 21:41:17
Ok. (Probably no { } for the if.)
|
| console.log('Running test ' + currentTest.name); |
| currentTest.apply(null, testArguments); |
| } catch (e) { |