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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames.html b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames.html
new file mode 100644
index 0000000000000000000000000000000000000000..005e194ddeb2fe2a31e6fc6ebeebce2ad361ebff
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-request-child-nodes-traverse-frames.html
@@ -0,0 +1,80 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ getDocument();
+
+ function getDocument()
+ {
+ InspectorTest.sendCommand("DOM.getDocument", {}, function(messageObject) {
+ if (messageObject.hasOwnProperty("error"))
+ InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n");
+
+ var bodyId = messageObject.result.root.children[0].children[1].nodeId;
+ requestChildNodes(bodyId);
+ });
+ };
+
+ function requestChildNodes(bodyId)
+ {
+ InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "depth": -1}, function(messageObject) {
+ if (messageObject.hasOwnProperty("error"))
+ InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n");
+ });
+
+ InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject)
+ {
+ var iframeContentDocument = messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument;
+ if (iframeContentDocument.children) {
+ InspectorTest.log("Error IFrame node should not include children: " + JSON.stringify(iframeContentDocument, null, " "));
+ InspectorTest.completeTest();
+ } else {
+ requestAllChildNodesIncludingIframe(bodyId);
+ }
+ };
+ };
+
+ function requestAllChildNodesIncludingIframe(bodyId)
+ {
+ InspectorTest.sendCommand("DOM.requestChildNodes", {"nodeId": bodyId, "depth": -1, "traverseFrames": true}, function(messageObject) {
+ if (messageObject.hasOwnProperty("error"))
+ InspectorTest.log("Backend error: " + messageObject.error.message + " (" + messageObject.error.code + ")\n");
+ });
+
+ InspectorTest.eventHandler["DOM.setChildNodes"] = function(messageObject)
+ {
+ // FrameIds change every time, so replace them.
+ messageObject.params.nodes[0].children[0].children[0].children[0].frameId = "???";
+ messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument.children[0].frameId = "???";
+
+ // The contentDocument's documentURL & baseURL are absolute paths.
+ messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument.documentURL = "???";
+ messageObject.params.nodes[0].children[0].children[0].children[0].contentDocument.baseURL = "???";
+
+ InspectorTest.log(JSON.stringify(messageObject, null, " "));
+ InspectorTest.completeTest();
+ };
+ };
+};
+
+window.addEventListener("DOMContentLoaded", function () {
+ runTest();
+}, false);
+
+</script>
+</head>
+<body>
+
+<div id="depth-1">
+ <div id="depth-2">
+ <div id="depth-3">
+ <iframe src="resources/iframe.html"></iframe>
+ </div>
+ </div>
+</div>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698