3 <script src="console-test.js"></script>
4 <script src="inspector-test.js"></script>
9 InspectorTest.showConsolePanel();
10 var selector = WebInspector.consoleView._executionContextSelector._selectElement;
11 var option = selector.firstChild;
13 if (option.textContent && option.textContent.startsWith("myIFrame"))
15 option = option.nextSibling;
18 InspectorTest.addResult("FAILED: myIFrame not found in the context list");
19 InspectorTest.completeTest();
22 option.selected = true;
23 WebInspector.consoleView._executionContextChanged();
25 WebInspector.runtimeModel._completionsForExpression("", "myGlob", false, checkCompletions.bind(this));
26 function checkCompletions(completions)
28 var expected = ["myGlobalVar", "myGlobalFunction"];
29 for (var i = 0; i < expected.length; ++i) {
30 if (completions.indexOf(expected[i]) !== -1)
31 InspectorTest.addResult(expected[i]);
33 InspectorTest.addResult("NOT FOUND: " + expected[i]);
35 InspectorTest.dumpConsoleMessages();
36 InspectorTest.completeTest();
45 Test that completions in the context of an iframe with a different origin will
46 result in names of its global variables. Test passes if all global variables
47 are found among completions AND there are NO console messages.
48 <a href="https://bugs.webkit.org/show_bug.cgi?id=65457">Bug 65457.</a>
50 <iframe name="myIFrame" src="http://localhost:8000/inspector/resources/console-cd-completions-iframe.html" onload="runTest()"></iframe>