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

Unified Diff: LayoutTests/inspector/sources/debugger/source-url-comment.html

Issue 256543002: DevTools: do not recognize inline sourceURL, require it to end with the crlf. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 6 years, 8 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/sources/debugger/source-url-comment.html
diff --git a/LayoutTests/inspector/sources/debugger/source-url-comment.html b/LayoutTests/inspector/sources/debugger/source-url-comment.html
index 342844487031928179f5d44c9c629c999a5845f9..7ed8b1237713de1e684887225a04bd5d5bf68d59 100644
--- a/LayoutTests/inspector/sources/debugger/source-url-comment.html
+++ b/LayoutTests/inspector/sources/debugger/source-url-comment.html
@@ -35,6 +35,20 @@ function doURLAndMappingURL()
eval("function keepAlive() {}\n//# sourceMappingURL=sourceMappingURL.map\n//# sourceURL=sourceURL.js");
}
+function addScriptWithURL()
+{
+ var script = document.createElement("script");
+ script.src = "resources/script-with-url.js";
+ document.head.appendChild(script);
+}
+
+function addScriptWithPoorURL()
+{
+ var script = document.createElement("script");
+ script.src = "resources/script-with-poor-url.js";
+ document.head.appendChild(script);
+}
+
function test()
{
@@ -56,9 +70,40 @@ function test()
{
var panel = WebInspector.inspectorView.panel("sources");
var uiSourceCodes = panel._workspace.uiSourceCodes();
- for (var i = 0; i < uiSourceCodes.length; ++i)
- InspectorTest.assertTrue(uiSourceCodes[i].originURL().indexOf("inlineScriptURL.js") === -1, "sourceURL comment in inline script was used as a script name");
- forEachScriptMatchingURL("source-url-comment.html", checkScriptSourceURL)
+ for (var i = 0; i < uiSourceCodes.length; ++i) {
+ if (uiSourceCodes[i].originURL().indexOf("inlineScriptURL.js") !== -1)
+ InspectorTest.addResult("FAILED: sourceURL comment in inline script was used as a script name");
+ }
+ next();
+ }
+ },
+
+ function testSourceURLCommentInScript(next)
+ {
+ InspectorTest.showScriptSource("scriptWithSourceURL.js", didShowScriptSource);
+ InspectorTest.evaluateInPage("setTimeout(addScriptWithURL, 0)");
+
+ function didShowScriptSource(sourceFrame)
+ {
+ InspectorTest.addResult(sourceFrame.textEditor.text().trim());
+ forEachScriptMatchingURL("scriptWithSourceURL.js", checkScriptSourceURL);
+ next();
+ }
+ },
+
+ function testPoorSourceURLCommentInScript(next)
+ {
+ InspectorTest.showScriptSource("source-url-comment.html", didShowScriptSource);
+ InspectorTest.evaluateInPage("setTimeout(addScriptWithPoorURL, 0)");
+
+ function didShowScriptSource(sourceFrame)
+ {
+ var panel = WebInspector.inspectorView.panel("sources");
+ var uiSourceCodes = panel._workspace.uiSourceCodes();
+ for (var i = 0; i < uiSourceCodes.length; ++i) {
+ if (uiSourceCodes[i].originURL().indexOf("scriptWithPoorSourceURL.js") !== -1)
+ InspectorTest.addResult("FAILED: poor sourceURL comment in script was used as a script name");
+ }
next();
}
},

Powered by Google App Engine
This is Rietveld 408576698