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

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

Issue 2373023002: Make DOM.getChildNodes & DOM.getDocument optionally pierce iframe boundaries (Closed)
Patch Set: Nits 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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", {}, 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 getDocumentIncludingIframe();
36 }
37 };
38 };
39
40 function getDocumentIncludingIframe()
41 {
42 InspectorTest.sendCommand("DOM.getDocument", {"traverseFrames": true}, f unction(messageObject) {
43 if (messageObject.hasOwnProperty("error"))
44 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n");
45
46 var bodyId = messageObject.result.root.children[0].children[1].nodeI d;
47 requestAllChildNodesIncludingIframe(bodyId);
48 });
49 };
50
51 function replacePropertyRecursive(object, propertyNameToReplace)
52 {
53 for (var propertyName in object) {
54 if (!object.hasOwnProperty(propertyName))
55 continue;
56 if (propertyName === propertyNameToReplace) {
57 object[propertyName] = "???";
58 } else if (typeof object[propertyName] === "object") {
59 replacePropertyRecursive(object[propertyName], propertyNameToRep lace);
60 }
61 }
62 }
63
64 function requestAllChildNodesIncludingIframe(bodyId)
65 {
66 InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "d epth": -1, "traverseFrames": true}, function(messageObject) {
67 if (messageObject.hasOwnProperty("error"))
68 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n");
69 });
70
71 InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject )
72 {
73 // Replace properties that tend to change every run.
74 replacePropertyRecursive(messageObject, "frameId");
75 replacePropertyRecursive(messageObject, "documentURL");
76 replacePropertyRecursive(messageObject, "baseURL");
77
78 InspectorTest.log(JSON.stringify(messageObject, null, " "));
79 InspectorTest.completeTest();
80 };
81 };
82 };
83
84 window.addEventListener("DOMContentLoaded", function () {
85 runTest();
86 }, false);
87
88 </script>
89 </head>
90 <body>
91
92 <div id="depth-1">
93 <div id="depth-2">
94 <div id="depth-3">
95 <iframe src="resources/iframe.html"></iframe>
96 </div>
97 </div>
98 </div>
99
100 </body>
101 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698