Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-document-with-child-nodes.html

Issue 2373023002: Make DOM.getChildNodes & DOM.getDocument optionally pierce iframe boundaries (Closed)
Patch Set: Per IM conversation, let DOM.getDocument optionally return the sub tree as well. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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", {"depth": -1}, function(mes sageObject) {
13 if (messageObject.hasOwnProperty("error"))
14 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n");
15
16 var iframeOwner = messageObject.result.root.children[0].children[1]. children[0].children[0].children[0].children[0];
17 if (iframeOwner.contentDocument.children) {
18 InspectorTest.log("Error IFrame node should not include children : " + JSON.stringify(iframeOwner, null, " "));
19 InspectorTest.completeTest();
20 } else {
21 getDocumentPlusIframe();
22 }
23 });
24 };
25
26
27 function getDocumentPlusIframe()
28 {
29 InspectorTest.sendCommand("DOM.getDocument", {"depth": -1, "traverseFram es": true}, function(messageObject) {
30 if (messageObject.hasOwnProperty("error"))
31 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n");
32
33 var iframeOwner = messageObject.result.root.children[0].children[1]. children[0].children[0].children[0].children[0];
34
35 // FrameIds change every time, so replace them.
36 iframeOwner.frameId = "???";
37 iframeOwner.contentDocument.children[0].frameId = "???";
38
39 // The contentDocument's documentURL & baseURL are absolute paths.
40 iframeOwner.contentDocument.documentURL = "???";
41 iframeOwner.contentDocument.baseURL = "???";
42
43 var bodyId = messageObject.result.root.children[0].children[1];
44 InspectorTest.log(JSON.stringify(bodyId, null, " "));
45 InspectorTest.completeTest();
46 });
47 };
48 };
49
50 window.addEventListener("DOMContentLoaded", function () {
51 runTest();
52 }, false);
53
54 </script>
55 </head>
56 <body>
57
58 <div id="depth-1">
59 <div id="depth-2">
60 <div id="depth-3">
61 <iframe src="resources/iframe.html"></iframe>
62 </div>
63 </div>
64 </div>
65
66 </body>
67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698