Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / inspector-protocol / access-inspected-object.html
blob1d4d6475de7bf22a9d85778a22ed35bd5e876024
1 <html>
2 <head>
3 <script type="text/javascript" src="inspector-protocol-test.js"></script>
4 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
10 function test()
12 InspectorTest.sendCommand("DOM.getDocument", {}, didGetDocument);
14 function didGetDocument(messageObject)
16 InspectorTest.sendCommand("DOM.querySelector", {
17 "nodeId": messageObject.result.root.nodeId,
18 "selector": "iframe#myframe"
19 }, didFindIframe);
20 InspectorTest.eventHandler["DOM.setChildNodes"] = iframeRequestHandler;
23 function didFindIframe(messageObject)
25 if (messageObject.error) {
26 InspectorTest.log("FAIL: " + messageObject.error);
27 InspectorTest.completeTest();
31 function iframeRequestHandler(messageObject)
33 var node = messageObject.params.nodes[0];
34 if (!node || node.nodeName !== "IFRAME")
35 return;
36 InspectorTest.eventHandler["DOM.setChildNodes"] = null;
37 InspectorTest.sendCommand("DOM.querySelector", {
38 "nodeId": node.contentDocument.nodeId,
39 "selector": "div#rootDiv"
40 }, didFindDiv);
43 function didFindDiv(messageObject)
45 InspectorTest.sendCommand("Console.enable", {});
46 InspectorTest.sendCommand("DOM.setInspectedNode", {
47 "nodeId": messageObject.result.nodeId
48 }, didAddInspectedNode);
51 function didAddInspectedNode(messageObject)
53 InspectorTest.sendCommand("Runtime.evaluate", {
54 "expression": "$0",
55 "includeCommandLineAPI": true
56 }, didEvaluate);
59 function didEvaluate(messageObject)
61 if (messageObject.result.wasThrown)
62 InspectorTest.log("FAIL: unexpected exception: " + JSON.stringify(messageObject, null, 2));
63 if (messageObject.result.result.value !== null)
64 InspectorTest.log("FAIL: unexpected value: " + JSON.stringify(messageObject, null, 2));
65 InspectorTest.completeTest();
69 </script>
70 </head>
71 <body>
72 <p>Test that code evaluated in the main frame cannot access $0 that resolves into a node in a frame from a different domain. <a href="https://bugs.webkit.org/show_bug.cgi?id=105423">Bug 105423.</p>
73 <iframe id="myframe" src="http://localhost:8000/inspector-protocol/resources/test-page.html" onload="runTest()"></iframe>
74 </body>
75 </html>