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

Side by Side Diff: Source/core/inspector/InjectedScriptSource.js

Issue 844563003: DevTools: Fix console not showing array items inherited from prototype. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 * @template T 142 * @template T
143 */ 143 */
144 function nullifyObjectProto(obj) 144 function nullifyObjectProto(obj)
145 { 145 {
146 if (obj && typeof obj === "object") 146 if (obj && typeof obj === "object")
147 obj.__proto__ = null; 147 obj.__proto__ = null;
148 return obj; 148 return obj;
149 } 149 }
150 150
151 /** 151 /**
152 * @param {*} obj 152 * @param {number|string} obj
153 * @return {boolean} 153 * @return {boolean}
154 */ 154 */
155 function isUInt32(obj) 155 function isUInt32(obj)
156 { 156 {
157 return typeof obj === "number" && obj >>> 0 === obj && (obj > 0 || 1 / obj > 0); 157 if (typeof obj === "number")
158 return obj >>> 0 === obj && (obj > 0 || 1 / obj > 0);
159 return "" + (obj >>> 0) === obj;
158 } 160 }
159 161
160 /** 162 /**
161 * FireBug's array detection. 163 * FireBug's array detection.
162 * @param {*} obj 164 * @param {*} obj
163 * @return {boolean} 165 * @return {boolean}
164 */ 166 */
165 function isArrayLike(obj) 167 function isArrayLike(obj)
166 { 168 {
167 if (typeof obj !== "object") 169 if (typeof obj !== "object")
168 return false; 170 return false;
169 try { 171 try {
170 if (typeof obj.splice === "function") 172 if (typeof obj.splice === "function") {
171 return isUInt32(obj.length); 173 var len = obj.length;
174 return typeof len === "number" && isUInt32(len);
175 }
172 } catch (e) { 176 } catch (e) {
173 } 177 }
174 return false; 178 return false;
175 } 179 }
176 180
177 /** 181 /**
178 * @param {number} a 182 * @param {number} a
179 * @param {number} b 183 * @param {number} b
180 * @return {number} 184 * @return {number}
181 */ 185 */
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 { 1381 {
1378 for (var descriptor of descriptors) { 1382 for (var descriptor of descriptors) {
1379 if (propertiesThreshold.indexes < 0 || propertiesThreshold.propertie s < 0) 1383 if (propertiesThreshold.indexes < 0 || propertiesThreshold.propertie s < 0)
1380 break; 1384 break;
1381 if (!descriptor) 1385 if (!descriptor)
1382 continue; 1386 continue;
1383 if (descriptor.wasThrown) { 1387 if (descriptor.wasThrown) {
1384 preview.lossless = false; 1388 preview.lossless = false;
1385 continue; 1389 continue;
1386 } 1390 }
1387 if (!descriptor.enumerable && !descriptor.isOwn)
1388 continue;
1389 1391
1390 var name = descriptor.name; 1392 var name = descriptor.name;
1391 if (name === "__proto__") 1393 if (name === "__proto__")
1392 continue; 1394 continue;
1393 if (this.subtype === "array" && name === "length") 1395 if (this.subtype === "array" && name === "length")
1394 continue; 1396 continue;
1397 if (!descriptor.enumerable && !descriptor.isOwn && !(this.subtype == = "array" && isUInt32(name)))
1398 continue;
1395 1399
1396 if (!("value" in descriptor)) { 1400 if (!("value" in descriptor)) {
1397 preview.lossless = false; 1401 preview.lossless = false;
1398 this._appendPropertyPreview(preview, { name: name, type: "access or", __proto__: null }, propertiesThreshold); 1402 this._appendPropertyPreview(preview, { name: name, type: "access or", __proto__: null }, propertiesThreshold);
1399 continue; 1403 continue;
1400 } 1404 }
1401 1405
1402 var value = descriptor.value; 1406 var value = descriptor.value;
1403 if (value === null) { 1407 if (value === null) {
1404 this._appendPropertyPreview(preview, { name: name, type: "object ", subtype: "null", value: "null", __proto__: null }, propertiesThreshold); 1408 this._appendPropertyPreview(preview, { name: name, type: "object ", subtype: "null", value: "null", __proto__: null }, propertiesThreshold);
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 */ 1951 */
1948 _logEvent: function(event) 1952 _logEvent: function(event)
1949 { 1953 {
1950 inspectedWindow.console.log(event.type, event); 1954 inspectedWindow.console.log(event.type, event);
1951 } 1955 }
1952 } 1956 }
1953 1957
1954 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1958 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1955 return injectedScript; 1959 return injectedScript;
1956 }) 1960 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698