3 <script type=
"text/javascript" src=
"inspector-protocol-test.js"></script>
5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.waitUntilDone();
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"
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")
36 InspectorTest
.eventHandler
["DOM.setChildNodes"] = null;
37 InspectorTest
.sendCommand("DOM.querySelector", {
38 "nodeId": node
.contentDocument
.nodeId
,
39 "selector": "div#rootDiv"
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", {
55 "includeCommandLineAPI": true
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();
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>