Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / inspector-enabled / dynamic-scripts.html
blobfb923a4db14c4f874faa701cd22bddc10b2818f1
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../inspector/inspector-test.js"></script>
5 <script src="../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 onload()
30 if (window.testRunner)
31 testRunner.waitUntilDone();
32 loadScripts();
35 function scriptLoaded()
37 if (window.testRunner)
38 testRunner.showWebInspector();
39 runTest();
42 function test()
44 InspectorTest.startDebuggerTest(step2);
46 function step2()
48 InspectorTest.runAfterPendingDispatches(step3);
51 function step3()
53 var panel = WebInspector.panels.sources;
54 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(WebInspector.projectTypes.Network);
55 var urls = uiSourceCodes.map(function(uiSourceCode) { return uiSourceCode.name(); });
56 urls.sort();
58 var whiteList = ["debugger-test.js", "dynamic-script.js", "dynamic-scripts.html", "evalSourceURL.js", "inspector-test.js", "scriptElementContentSourceURL.js"];
59 function filter(url)
61 for (var i = 0; i < whiteList.length; ++i) {
62 if (url.indexOf(whiteList[i]) !== -1)
63 return true;
66 return false;
68 urls = urls.filter(filter);
70 InspectorTest.addResult("UISourceCodes:");
71 for (var i = 0; i < urls.length; ++i)
72 InspectorTest.addResult(" " + urls[i]);
73 InspectorTest.completeDebuggerTest();
76 </script>
77 </head>
78 <body onload="onload()">
79 <p>Tests that scripts for dynamically added script elements are shown in sources panel if inspector is opened after the scripts were loaded.</p>
80 <a href="https://bugs.webkit.org/show_bug.cgi?id=99324">Bug 99324</a>
81 </body>
82 </html>