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

Side by Side Diff: chrome/test/chromedriver/js/call_function.js

Issue 824603002: Revert of [chromedriver] Add shadow DOM support to chromedriver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « chrome/test/chromedriver/client/webelement.py ('k') | chrome/test/chromedriver/js/focus.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Enum for WebDriver status codes. 6 * Enum for WebDriver status codes.
7 * @enum {number} 7 * @enum {number}
8 */ 8 */
9 var StatusCode = { 9 var StatusCode = {
10 STALE_ELEMENT_REFERENCE: 10, 10 STALE_ELEMENT_REFERENCE: 10,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 /** 94 /**
95 * @private 95 * @private
96 * @param {!Node} node The node to check. 96 * @param {!Node} node The node to check.
97 * @return {boolean} If the nodes is reachable. 97 * @return {boolean} If the nodes is reachable.
98 */ 98 */
99 isNodeReachable_: function(node) { 99 isNodeReachable_: function(node) {
100 var nodeRoot = getNodeRoot(node); 100 var nodeRoot = getNodeRoot(node);
101 if (nodeRoot == document) 101 if (nodeRoot == document)
102 return true; 102 return true;
103 else if (SHADOW_DOM_ENABLED && nodeRoot instanceof ShadowRoot) 103 else if (SHADOW_DOM_ENABLED && nodeRoot instanceof ShadowRoot)
104 return this.isNodeReachable_(nodeRoot.host); 104 return true;
105 105
106 return false; 106 return false;
107 } 107 }
108 }; 108 };
109 109
110 /** 110 /**
111 * Returns the root element of the node. Found by traversing parentNodes until 111 * Returns the root element of the node. Found by traversing parentNodes until
112 * a node with no parent is found. This node is considered the root. 112 * a node with no parent is found. This node is considered the root.
113 * @param {!Node} node The node to find the root element for. 113 * @param {!Node} node The node to find the root element for.
114 * @return {!Node} The root node. 114 * @return {!Node} The root node.
(...skipping 26 matching lines...) Expand all
141 * @param {*} value The value to wrap. 141 * @param {*} value The value to wrap.
142 * @return {*} The wrapped value. 142 * @return {*} The wrapped value.
143 */ 143 */
144 function wrap(value) { 144 function wrap(value) {
145 if (typeof(value) == 'object' && value != null) { 145 if (typeof(value) == 'object' && value != null) {
146 var nodeType = value['nodeType']; 146 var nodeType = value['nodeType'];
147 if (nodeType == NodeType.ELEMENT || nodeType == NodeType.DOCUMENT 147 if (nodeType == NodeType.ELEMENT || nodeType == NodeType.DOCUMENT
148 || (SHADOW_DOM_ENABLED && value instanceof ShadowRoot)) { 148 || (SHADOW_DOM_ENABLED && value instanceof ShadowRoot)) {
149 var wrapped = {}; 149 var wrapped = {};
150 var root = getNodeRoot(value); 150 var root = getNodeRoot(value);
151 wrapped[ELEMENT_KEY] = getPageCache().storeItem(value); 151 wrapped[ELEMENT_KEY] = getPageCache(root).storeItem(value);
152 return wrapped; 152 return wrapped;
153 } 153 }
154 154
155 var obj = (typeof(value.length) == 'number') ? [] : {}; 155 var obj = (typeof(value.length) == 'number') ? [] : {};
156 for (var prop in value) 156 for (var prop in value)
157 obj[prop] = wrap(value[prop]); 157 obj[prop] = wrap(value[prop]);
158 return obj; 158 return obj;
159 } 159 }
160 return value; 160 return value;
161 } 161 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 var returnValue = wrap(func.apply(null, unwrap(args, cache))); 222 var returnValue = wrap(func.apply(null, unwrap(args, cache)));
223 } catch (error) { 223 } catch (error) {
224 status = error.code || StatusCode.UNKNOWN_ERROR; 224 status = error.code || StatusCode.UNKNOWN_ERROR;
225 var returnValue = error.message; 225 var returnValue = error.message;
226 } 226 }
227 return { 227 return {
228 status: status, 228 status: status,
229 value: returnValue 229 value: returnValue
230 } 230 }
231 } 231 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/client/webelement.py ('k') | chrome/test/chromedriver/js/focus.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698