OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-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, "pierce": tru
e}, 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 function stabilize(key, value) { | |
54 var unstableKeys = ["backendNodeId"]; | |
55 if (unstableKeys.indexOf(key) !== -1) | |
56 return "<" + typeof(value) + ">"; | |
57 return value; | |
58 } | |
59 InspectorTest.log(JSON.stringify(bodyId, stabilize, " ")); | |
60 InspectorTest.completeTest(); | |
61 }); | |
62 }; | |
63 }; | |
64 | |
65 window.addEventListener("DOMContentLoaded", function () { | |
66 runTest(); | |
67 }, false); | |
68 | |
69 </script> | |
70 </head> | |
71 <body> | |
72 | |
73 <div id="depth-1"> | |
74 <div id="depth-2"> | |
75 <div id="depth-3"> | |
76 <iframe src="resources/shadow-dom-iframe.html"></iframe> | |
77 </div> | |
78 </div> | |
79 <div id="targetDiv"></div> | |
80 </div> | |
81 | |
82 </body> | |
83 </html> | |
OLD | NEW |