1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
4 <script src="../../../http/tests/inspector/inspector-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
7 function appendDynamicScriptElement(src, content)
9 var scriptElement = document.createElement("script");
11 scriptElement.src = src;
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()
35 InspectorTest.addConsoleSniffer(step1);
36 InspectorTest.evaluateInPage("loadScripts()", function() { })
40 InspectorTest.startDebuggerTest(step2);
45 InspectorTest.runAfterPendingDispatches(step3);
50 var panel = WebInspector.showPanel("sources");
51 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network);
52 var urls = uiSourceCodes.map(function(uiSourceCode) { return uiSourceCode.name(); });
55 var whiteList = ["debugger-test.js", "dynamic-script.js", "dynamic-scripts.html", "evalSourceURL.js", "inspector-test.js", "scriptElementContentSourceURL.js"];
58 for (var i = 0; i < whiteList.length; ++i) {
59 if (url === whiteList[i])
65 urls = urls.filter(filter);
67 InspectorTest.addResult("UISourceCodes:");
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"))
73 InspectorTest.addResult(" " + urls[i]);
76 InspectorTest.completeDebuggerTest();
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>