Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger / dynamic-scripts.html
blob6b9d075fa09c0db83483526f33cfd448f7126b08
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../http/tests/inspector/inspector-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
7 function appendDynamicScriptElement(src, content)
9 var scriptElement = document.createElement("script");
10 if (src)
11 scriptElement.src = src;
12 else
13 scriptElement.textContent = content;
14 document.head.appendChild(scriptElement);
17 function loadScripts()
19 var sourceURLComment = "\n //# sourceURL=";
20 window.eval("function fooEval() {}");
21 window.eval("function fooEvalSourceURL() {}" + sourceURLComment + "evalSourceURL.js");
22 appendDynamicScriptElement("", "function fooScriptElementContent1() {}");
23 appendDynamicScriptElement("", "function fooScriptElementContent2() {}");
24 appendDynamicScriptElement("", "function fooScriptElementContentSourceURL() {}" + sourceURLComment + "scriptElementContentSourceURL.js");
25 appendDynamicScriptElement("resources/dynamic-script.js");
28 function scriptLoaded()
30 console.log("Done.");
33 function test()
35 InspectorTest.addConsoleSniffer(step1);
36 InspectorTest.evaluateInPage("loadScripts()", function() { })
38 function step1()
40 InspectorTest.startDebuggerTest(step2);
43 function step2()
45 InspectorTest.runAfterPendingDispatches(step3);
48 function step3()
50 var panel = WebInspector.panels.sources;
51 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network);
52 var urls = uiSourceCodes.map(function(uiSourceCode) { return uiSourceCode.name(); });
53 urls.sort();
55 var whiteList = ["debugger-test.js", "dynamic-script.js", "dynamic-scripts.html", "evalSourceURL.js", "inspector-test.js", "scriptElementContentSourceURL.js"];
56 function filter(url)
58 for (var i = 0; i < whiteList.length; ++i) {
59 if (url === whiteList[i])
60 return true;
63 return false;
65 urls = urls.filter(filter);
67 InspectorTest.addResult("UISourceCodes:");
68 var lastURL;
69 for (var i = 0; i < urls.length; ++i) {
70 // Hack around the problem with scripts surviving between tests.
71 if (urls[i] === lastURL && !lastURL.endsWith(".html"))
72 continue;
73 InspectorTest.addResult(" " + urls[i]);
74 lastURL = urls[i];
76 InspectorTest.completeDebuggerTest();
79 </script>
80 </head>
81 <body onload="runTest()">
82 <p>Tests that scripts for dynamically added script elements are shown in sources panel if loaded with inspector open.</p>
83 <a href="https://bugs.webkit.org/show_bug.cgi?id=99324">Bug 99324</a>
84 </body>
85 </html>