Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> | |
| 4 <script type="text/javascript"> | |
| 5 | |
| 6 function test() | |
| 7 { | |
| 8 getDocument(); | |
| 9 | |
| 10 function getDocument() | |
| 11 { | |
| 12 InspectorTest.sendCommand("DOM.getDocument", {}, function(messageObject) { | |
| 13 if (messageObject.hasOwnProperty("error")) | |
|
Sami
2016/09/27 13:50:58
Is this block indented right?
alex clarke (OOO till 29th)
2016/09/27 13:56:07
Done.
| |
| 14 InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n"); | |
| 15 | |
| 16 var bodyId = messageObject.result.root.children[0].children[1].nodeI d; | |
| 17 requestChildNodesNotIncludingIframeChildren(bodyId); | |
| 18 }); | |
| 19 }; | |
| 20 | |
| 21 function requestChildNodesNotIncludingIframeChildren(bodyId) | |
| 22 { | |
| 23 InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "d epth": 10}, function(messageObject) { | |
| 24 if (messageObject.hasOwnProperty("error")) | |
| 25 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n"); | |
| 26 }); | |
| 27 | |
| 28 InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject ) | |
| 29 { | |
| 30 var iframeNode = messageObject.params.nodes[0].children[0].children[ 0].children[0]; | |
| 31 if (iframeNode.children.length !== 0) { | |
| 32 InspectorTest.log("Error IFrame node should not include children : " + JSON.stringify(iframeNode, null, " ")); | |
| 33 InspectorTest.completeTest(); | |
| 34 } else { | |
| 35 requestAllChildNodes(bodyId); | |
| 36 } | |
| 37 }; | |
| 38 }; | |
| 39 | |
| 40 function requestAllChildNodes(bodyId) | |
| 41 { | |
| 42 InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "d epth": -1}, function(messageObject) { | |
| 43 if (messageObject.hasOwnProperty("error")) | |
| 44 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n"); | |
| 45 }); | |
| 46 | |
| 47 InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject ) | |
| 48 { | |
| 49 // FrameIds change every time, so replace them. | |
| 50 messageObject.params.nodes[0].children[0].children[0].children[0].fr ameId = "???"; | |
| 51 messageObject.params.nodes[0].children[0].children[0].children[0].ch ildren[0].frameId = "???"; | |
| 52 | |
| 53 // The contentDocument's documentURL & baseURL are absolute paths. | |
| 54 messageObject.params.nodes[0].children[0].children[0].children[0].co ntentDocument.documentURL = "???"; | |
| 55 messageObject.params.nodes[0].children[0].children[0].children[0].co ntentDocument.baseURL = "???"; | |
| 56 | |
| 57 InspectorTest.log(JSON.stringify(messageObject, null, " ")); | |
| 58 InspectorTest.completeTest(); | |
| 59 }; | |
| 60 }; | |
| 61 }; | |
| 62 | |
| 63 window.addEventListener("DOMContentLoaded", function () { | |
| 64 runTest(); | |
| 65 }, false); | |
| 66 | |
| 67 </script> | |
| 68 </head> | |
| 69 <body> | |
| 70 | |
| 71 <div id="depth-1"> | |
| 72 <div id="depth-2"> | |
| 73 <div id="depth-3"> | |
| 74 <iframe src="resources/iframe.html"></iframe> | |
| 75 </div> | |
| 76 </div> | |
| 77 </div> | |
| 78 | |
| 79 </body> | |
| 80 </html> | |
| OLD | NEW |