commit-queue@webkit.org | acfeb0a | 2013-01-11 06:17:07 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 | <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 5 | <script> |
| 6 | |
| 7 | function load() |
| 8 | { |
| 9 | eval("function dynamic" + "Script1() {}"); |
| 10 | eval("function dynamic" + "Script2() {}"); |
| 11 | runTest(); |
| 12 | } |
| 13 | |
| 14 | function test() |
| 15 | { |
| 16 | function preprocessor(script, name) |
| 17 | { |
| 18 | if (script.indexOf("dynamic" + "Script1") !== -1) |
| 19 | return script + "//@ sourceURL=dynamicScript1"; |
| 20 | if (script.indexOf("dynamic" + "Script2") !== -1) { |
| 21 | try { |
| 22 | var w = eval("window"); |
| 23 | return script + "//@ sourceURL=FAIL_window_should_not_be_there"; |
| 24 | } catch (e) { |
| 25 | return script + "//@ sourceURL=dynamicScript2"; |
| 26 | } |
| 27 | } |
| 28 | // Verify that the |name| argument is correct. Note: if name is not passed in |
| 29 | // the results will be a script with a sourceURL equal to the original file name. |
| 30 | return script + "//@ sourceURL=" + name + ".js"; |
| 31 | } |
| 32 | |
| 33 | InspectorTest.startDebuggerTest(step1); |
| 34 | |
| 35 | function step1() |
| 36 | { |
| 37 | InspectorTest.reloadPage(step2, undefined, "(" + preprocessor + ")"); |
| 38 | } |
| 39 | |
| 40 | function step2() |
| 41 | { |
| 42 | function accept(script) |
| 43 | { |
| 44 | return true; |
| 45 | } |
| 46 | var scripts = InspectorTest.queryScripts(accept); |
| 47 | for (var i = 0; i < scripts.length; ++i) |
| 48 | InspectorTest.addResult(WebInspector.displayNameForURL(scripts[i].sourceURL)); |
| 49 | |
| 50 | InspectorTest.reloadPage(InspectorTest.completeDebuggerTest.bind(InspectorTest)); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | </script> |
| 55 | </head> |
| 56 | |
| 57 | <body onload="load()"> |
| 58 | <p> |
| 59 | Tests script preprocessor (ability to preprocess all scripts upon reload). |
| 60 | </p> |
| 61 | |
| 62 | </body> |
| 63 | </html> |