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")) | |
| 14 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n"); | |
| 15 | |
| 16 var bodyId = messageObject.result.root.children[0].children[1].nodeI d; | |
| 17 requestChildNodes(bodyId); | |
| 18 }); | |
| 19 }; | |
| 20 | |
| 21 function requestChildNodes(bodyId) | |
| 22 { | |
| 23 InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "d epth": -1}, 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 iframeContentDocument = messageObject.params.nodes[0].children[0 ].children[0].children[0].contentDocument; | |
| 31 if (iframeContentDocument.children) { | |
| 32 InspectorTest.log("Error IFrame node should not include children : " + JSON.stringify(iframeContentDocument, null, " ")); | |
| 33 InspectorTest.completeTest(); | |
| 34 } else { | |
| 35 requestAllChildNodesIncludingIframe(bodyId); | |
| 36 } | |
| 37 }; | |
| 38 }; | |
| 39 | |
| 40 function requestAllChildNodesIncludingIframe(bodyId) | |
| 41 { | |
| 42 InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "d epth": -1, "traverseFrames": true}, 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 = "???"; | |
|
pfeldman
2016/10/12 18:45:26
Could you replace frameIds recursively in the resp
alex clarke (OOO till 29th)
2016/10/13 15:31:05
Done.
| |
| 51 messageObject.params.nodes[0].children[0].children[0].children[0].co ntentDocument.children[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 |