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

Unified Diff: LayoutTests/inspector/debugger/debugger-script-preprocessor.html

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: Partial response to review Created 7 years, 6 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
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));
}
}

Powered by Google App Engine
This is Rietveld 408576698