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

Unified Diff: chrome/test/chromedriver/js/call_function.js

Issue 1499013002: [chromedriver] Use instanceof instead of typeof to check if value is an object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use instanceof instead of typeof Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/js/call_function.js
diff --git a/chrome/test/chromedriver/js/call_function.js b/chrome/test/chromedriver/js/call_function.js
index ab1551b1fa8ccfc0e19790196fb2aeb3d5b52446..17a0ae557addbdbdd5a6355e367b0a8f6f67b836 100644
--- a/chrome/test/chromedriver/js/call_function.js
+++ b/chrome/test/chromedriver/js/call_function.js
@@ -149,7 +149,7 @@ function getPageCache(opt_doc) {
* @return {*} The wrapped value.
*/
function wrap(value) {
- if (typeof(value) == 'object' && value != null) {
+ if (value instanceof Object && value != null) {
var nodeType = value['nodeType'];
if (nodeType == NodeType.ELEMENT || nodeType == NodeType.DOCUMENT
|| (SHADOW_DOM_ENABLED && value instanceof ShadowRoot)) {
@@ -176,7 +176,7 @@ function wrap(value) {
* @return {*} The unwrapped value.
*/
function unwrap(value, cache) {
- if (typeof(value) == 'object' && value != null) {
+ if (value instanceof Object && value != null) {
if (ELEMENT_KEY in value)
return cache.retrieveItem(value[ELEMENT_KEY]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698