| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/debugger-test.js"></script> |
| <script> |
| function appendDynamicScriptElement(src, content) |
| { |
| var scriptElement = document.createElement("script"); |
| if (src) |
| scriptElement.src = src; |
| else |
| scriptElement.textContent = content; |
| document.head.appendChild(scriptElement); |
| } |
| |
| function loadScripts() |
| { |
| var sourceURLComment = "\n //@ sourceURL="; |
| window.eval("function fooEval() {}"); |
| window.eval("function fooEvalSourceURL() {}" + sourceURLComment + "evalSourceURL.js"); |
| appendDynamicScriptElement("", "function fooScriptElementContent1() {}"); |
| appendDynamicScriptElement("", "function fooScriptElementContent2() {}"); |
| appendDynamicScriptElement("", "function fooScriptElementContentSourceURL() {}" + sourceURLComment + "scriptElementContentSourceURL.js"); |
| appendDynamicScriptElement("resources/dynamic-script.js"); |
| } |
| |
| function scriptLoaded() |
| { |
| console.log("Done."); |
| } |
| |
| function test() |
| { |
| InspectorTest.addConsoleSniffer(step1); |
| InspectorTest.evaluateInPage("loadScripts()", function() { }) |
| |
| function step1() |
| { |
| InspectorTest.startDebuggerTest(step2); |
| } |
| |
| function step2() |
| { |
| InspectorTest.runAfterPendingDispatches(step3); |
| } |
| |
| function step3() |
| { |
| var panel = WebInspector.showPanel("scripts"); |
| var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network); |
| var urls = uiSourceCodes.map(function(uiSourceCode) { return uiSourceCode.name(); }); |
| urls.sort(); |
| |
| var whiteList = ["debugger-test.js", "dynamic-script.js", "dynamic-scripts.html", "evalSourceURL.js", "inspector-test.js", "scriptElementContentSourceURL.js"]; |
| function filter(url) |
| { |
| for (var i = 0; i < whiteList.length; ++i) { |
| if (url.indexOf(whiteList[i]) !== -1) |
| return true; |
| } |
| |
| return false; |
| } |
| urls = urls.filter(filter); |
| |
| InspectorTest.addResult("UISourceCodes:"); |
| for (var i = 0; i < urls.length; ++i) |
| InspectorTest.addResult(" " + urls[i]); |
| InspectorTest.completeDebuggerTest(); |
| } |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests that scripts for dynamically added script elements are shown in sources panel if loaded with inspector open.</p> |
| <a href="https://bugs.webkit.org/show_bug.cgi?id=99324">Bug 99324</a> |
| </body> |
| </html> |