Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / source-url-comment.html
blob8c03c32aadb5e10089251ac70f19c5ac0173365d
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 function keepAliveInInlineScript() { }
8 //# sourceURL=inlineScriptURL.js
9 </script>
10 <script>
11 function doEval()
13 eval("function keepAlive() {}\n//# sourceURL=evalURL.js");
16 function doDeprecatedEval()
18 eval("function keepAlive() {}\n//@ sourceURL=deprecatedEvalURL.js");
21 function doEvalWithNonRelativeURL()
23 eval("function relativeURLScript() {}\n//# sourceURL=/js/nonRelativeURL.js");
26 function doDynamicScript()
28 var scriptElement = document.createElement("script");
29 scriptElement.textContent = "function keepAliveInDynamicScript() {}\n//# sourceURL=dynamicScriptURL.js";
30 document.body.appendChild(scriptElement);
33 function doURLAndMappingURL()
35 eval("function keepAlive() {}\n//# sourceMappingURL=sourceMappingURL.map\n//# sourceURL=sourceURL.js");
38 function addScriptWithURL()
40 var script = document.createElement("script");
41 script.src = "../debugger/resources/script-with-url.js";
42 document.head.appendChild(script);
45 function addScriptWithPoorURL()
47 var script = document.createElement("script");
48 script.src = "../debugger/resources/script-with-poor-url.js";
49 document.head.appendChild(script);
52 function test()
55 function forEachScriptMatchingURL(url, handler)
57 var scripts = InspectorTest.debuggerModel._scripts;
58 for (var id in scripts) {
59 if (scripts[id].sourceURL.indexOf(url) !== -1)
60 handler(scripts[id]);
64 InspectorTest.runDebuggerTestSuite([
65 function testSourceURLCommentInInlineScript(next)
67 InspectorTest.showScriptSource("source-url-comment.html", didShowScriptSource);
69 function didShowScriptSource(sourceFrame)
71 var panel = WebInspector.panels.sources;
72 var uiSourceCodes = panel._workspace.uiSourceCodes();
73 var ignored = true;
74 for (var i = 0; i < uiSourceCodes.length && ignored; ++i) {
75 if (uiSourceCodes[i].originURL().indexOf("inlineScriptURL.js") !== -1)
76 ignored = false;
78 if (ignored)
79 InspectorTest.addResult("FAILED: sourceURL comment in inline script was ignored");
80 next();
84 function testSourceURLCommentInScript(next)
86 InspectorTest.showScriptSource("scriptWithSourceURL.js", didShowScriptSource);
87 InspectorTest.evaluateInPage("setTimeout(addScriptWithURL, 0)");
89 function didShowScriptSource(sourceFrame)
91 InspectorTest.addResult(sourceFrame.textEditor.text().trim());
92 forEachScriptMatchingURL("scriptWithSourceURL.js", checkScriptSourceURL);
93 next();
97 function testPoorSourceURLCommentInScript(next)
99 InspectorTest.showScriptSource("source-url-comment.html", didShowScriptSource);
100 InspectorTest.evaluateInPage("setTimeout(addScriptWithPoorURL, 0)");
102 function didShowScriptSource(sourceFrame)
104 var panel = WebInspector.panels.sources;
105 var uiSourceCodes = panel._workspace.uiSourceCodes();
106 for (var i = 0; i < uiSourceCodes.length; ++i) {
107 if (uiSourceCodes[i].originURL().indexOf("scriptWithPoorSourceURL.js") !== -1)
108 InspectorTest.addResult("FAILED: poor sourceURL comment in script was used as a script name");
110 next();
114 function testSourceURLComment(next)
116 InspectorTest.showScriptSource("evalURL.js", didShowScriptSource);
117 InspectorTest.evaluateInPage("setTimeout(doEval, 0)");
119 function didShowScriptSource(sourceFrame)
121 InspectorTest.addResult(sourceFrame.textEditor.text());
122 forEachScriptMatchingURL("evalURL.js", checkScriptSourceURL);
123 next();
127 function testDeprecatedSourceURLComment(next)
129 InspectorTest.showScriptSource("deprecatedEvalURL.js", didShowScriptSource);
130 InspectorTest.evaluateInPage("setTimeout(doDeprecatedEval, 0)");
132 function didShowScriptSource(sourceFrame)
134 InspectorTest.addResult(sourceFrame.textEditor.text());
135 forEachScriptMatchingURL("deprecatedEvalURL.js", checkScriptSourceURL);
136 next();
140 function testSourceURLAndMappingURLComment(next)
142 InspectorTest.showScriptSource("sourceURL.js", didShowScriptSource);
143 InspectorTest.evaluateInPage("setTimeout(doURLAndMappingURL, 0)");
145 function didShowScriptSource(sourceFrame)
147 function checkScriptSourceURLAndMappingURL(script)
149 InspectorTest.addResult("hasSourceURL: " + script.hasSourceURL);
150 InspectorTest.addResult("sourceMapURL: " + script.sourceMapURL);
153 InspectorTest.addResult(sourceFrame.textEditor.text());
154 forEachScriptMatchingURL("sourceURL.js", checkScriptSourceURLAndMappingURL);
155 next();
159 function testSourceURLCommentInDynamicScript(next)
161 InspectorTest.showScriptSource("dynamicScriptURL.js", didShowScriptSource);
162 InspectorTest.evaluateInPage("setTimeout(doDynamicScript, 0)");
164 function didShowScriptSource(sourceFrame)
166 InspectorTest.addResult(sourceFrame.textEditor.text());
167 forEachScriptMatchingURL("dynamicScriptURL.js", checkScriptSourceURL);
168 next();
172 function testNonRelativeURL(next)
174 InspectorTest.showScriptSource("/js/nonRelativeURL.js", didShowScriptSource);
175 InspectorTest.evaluateInPage("setTimeout(doEvalWithNonRelativeURL, 0)");
177 function didShowScriptSource(sourceFrame)
179 InspectorTest.addResult(sourceFrame.textEditor.text());
180 forEachScriptMatchingURL("nonRelativeURL.js", checkScriptSourceURL);
181 next();
186 function checkScriptSourceURL(script)
188 InspectorTest.addResult("hasSourceURL: " + script.hasSourceURL);
192 </script>
194 </head>
196 <body onload="runTest()">
197 <p>Tests that evals with sourceURL comment are shown in scripts panel.</p>
198 </body>
199 </html>