| Index: LayoutTests/inspector/debugger/debugger-script-preprocessor.html
|
| diff --git a/LayoutTests/inspector/debugger/debugger-script-preprocessor.html b/LayoutTests/inspector/debugger/debugger-script-preprocessor.html
|
| index dc5546f1d4208613af454555bee535be13b866ec..e886bb0209b8f21225ddd043c264a55308ef29f1 100644
|
| --- a/LayoutTests/inspector/debugger/debugger-script-preprocessor.html
|
| +++ b/LayoutTests/inspector/debugger/debugger-script-preprocessor.html
|
| @@ -8,6 +8,7 @@ function load()
|
| {
|
| eval("function dynamic" + "Script1() {}");
|
| eval("function dynamic" + "Script2() {}");
|
| + eval("function dynamic" + "RuntimeError() {}");
|
| runTest();
|
| }
|
|
|
| @@ -15,21 +16,35 @@ function test()
|
| {
|
| function preprocessor(script, name)
|
| {
|
| + function makeResponse(script, msg, name) {
|
| + // write into the console to verify that no internal scripts are preprocessed.
|
| + return script + ';\nconsole.log(\"' + msg + '\");\n//@ sourceURL=' + name;
|
| + }
|
| if (script.indexOf("dynamic" + "Script1") !== -1)
|
| - return script + "//@ sourceURL=dynamicScript1";
|
| + return makeResponse(script, 'd1', "dynamic"+"Script1");
|
| if (script.indexOf("dynamic" + "Script2") !== -1) {
|
| try {
|
| var w = eval("window");
|
| - return script + "//@ sourceURL=FAIL_window_should_not_be_there";
|
| + return makeResponse(script, 'FAIL_window_should_not_be_there', "FAIL_window_should_not_be_there");
|
| } catch (e) {
|
| - return script + "//@ sourceURL=dynamicScript2";
|
| + return makeResponse(script, 'd2', "dynamic"+"Script2");
|
| }
|
| + }
|
| + if (script.indexOf("dynamic" + "RuntimeError") !== -1) {
|
| + throw new Error("internal preprocessor error");
|
| + }
|
| + if (!this.String) {
|
| + throw new Error("preprocessor environment is missing built-ins");
|
| }
|
| - // Verify that the |name| argument is correct. Note: if name is not passed in
|
| - // the results will be a script with a sourceURL equal to the original file name.
|
| - return script + "//@ sourceURL=" + name + ".js";
|
| +
|
| + // Verify that the |name| argument is correct.
|
| + name = name.replace(/\.html/, '_html') + '.js';
|
| + return makeResponse(script, 'preprocessed ' + name, name);
|
| }
|
|
|
| + var failingPreprocessor = "(function() {throw new Error(\"failingPreprocessor throws\");}())"
|
| + var syntaxError = "(function preprocessor(script, name) {\nsyntax error\n}\n)";
|
| +
|
| InspectorTest.startDebuggerTest(step1);
|
|
|
| function step1()
|
| @@ -45,8 +60,23 @@ function test()
|
| }
|
| var scripts = InspectorTest.queryScripts(accept);
|
| for (var i = 0; i < scripts.length; ++i)
|
| - InspectorTest.addResult(WebInspector.displayNameForURL(scripts[i].sourceURL));
|
| + InspectorTest.addResult("sourceURLs[" + i +"]=" + WebInspector.displayNameForURL(scripts[i].sourceURL));
|
|
|
| + InspectorTest.reloadPage(step3, undefined, "(" + failingPreprocessor + ")");
|
| + }
|
| +
|
| + function step3()
|
| + {
|
| + InspectorTest.reloadPage(step4, undefined, "1");
|
| + }
|
| +
|
| + function step4()
|
| + {
|
| + InspectorTest.reloadPage(step5, undefined, syntaxError);
|
| + }
|
| +
|
| + function step5()
|
| + {
|
| InspectorTest.reloadPage(InspectorTest.completeDebuggerTest.bind(InspectorTest));
|
| }
|
| }
|
|
|