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

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: 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
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 function replacePropertyRecursive(object, propertyNameToReplace)
27 {
28 for (var propertyName in object) {
29 if (!object.hasOwnProperty(propertyName))
30 continue;
31 if (propertyName === propertyNameToReplace) {
32 object[propertyName] = "???";
33 } else if (typeof object[propertyName] === "object") {
34 replacePropertyRecursive(object[propertyName], propertyNameToRep lace);
35 }
36 }
37 }
38
39 function getDocumentPlusIframe()
40 {
41 InspectorTest.sendCommand("DOM.getDocument", {"depth": -1, "traverseFram es": true}, function(messageObject) {
42 if (messageObject.hasOwnProperty("error"))
43 InspectorTest.log("Backend error: " + messageObject.error.messag e + " (" + messageObject.error.code + ")\n");
44
45 var iframeOwner = messageObject.result.root.children[0].children[1]. children[0].children[0].children[0].children[0];
46
47 // Replace properties that tend to change every run.
48 replacePropertyRecursive(messageObject, "frameId");
49 replacePropertyRecursive(messageObject, "documentURL");
50 replacePropertyRecursive(messageObject, "baseURL");
51
52 var bodyId = messageObject.result.root.children[0].children[1];
53 InspectorTest.log(JSON.stringify(bodyId, null, " "));
54 InspectorTest.completeTest();
55 });
56 };
57 };
58
59 window.addEventListener("DOMContentLoaded", function () {
60 runTest();
61 }, false);
62
63 </script>
64 </head>
65 <body>
66
67 <div id="depth-1">
68 <div id="depth-2">
69 <div id="depth-3">
70 <iframe src="resources/iframe.html"></iframe>
71 </div>
72 </div>
73 </div>
74
75 </body>
76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698