| OLD | NEW |
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 */ | 206 */ |
| 207 isPrimitiveValue: function(object) | 207 isPrimitiveValue: function(object) |
| 208 { | 208 { |
| 209 // FIXME(33716): typeof document.all is always 'undefined'. | 209 // FIXME(33716): typeof document.all is always 'undefined'. |
| 210 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC
ollection(object); | 210 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC
ollection(object); |
| 211 }, | 211 }, |
| 212 | 212 |
| 213 /** | 213 /** |
| 214 * @param {*} object | 214 * @param {*} object |
| 215 * @param {string} groupName | 215 * @param {string} groupName |
| 216 * @param {boolean} canAccessInspectedGlobalObject | |
| 217 * @param {boolean} forceValueType | 216 * @param {boolean} forceValueType |
| 218 * @param {boolean} generatePreview | 217 * @param {boolean} generatePreview |
| 219 * @return {!RuntimeAgent.RemoteObject} | 218 * @return {!RuntimeAgent.RemoteObject} |
| 220 */ | 219 */ |
| 221 wrapObject: function(object, groupName, canAccessInspectedGlobalObject, forc
eValueType, generatePreview) | 220 wrapObject: function(object, groupName, forceValueType, generatePreview) |
| 222 { | 221 { |
| 223 if (canAccessInspectedGlobalObject) | 222 return this._wrapObject(object, groupName, forceValueType, generatePrevi
ew); |
| 224 return this._wrapObject(object, groupName, forceValueType, generateP
review); | |
| 225 return this._fallbackWrapper(object); | |
| 226 }, | 223 }, |
| 227 | 224 |
| 228 /** | 225 /** |
| 229 * @param {!Array<!Object>} array | 226 * @param {!Array<!Object>} array |
| 230 * @param {string} property | 227 * @param {string} property |
| 231 * @param {string} groupName | 228 * @param {string} groupName |
| 232 * @param {boolean} canAccessInspectedGlobalObject | |
| 233 * @param {boolean} forceValueType | 229 * @param {boolean} forceValueType |
| 234 * @param {boolean} generatePreview | 230 * @param {boolean} generatePreview |
| 235 */ | 231 */ |
| 236 wrapPropertyInArray: function(array, property, groupName, canAccessInspected
GlobalObject, forceValueType, generatePreview) | 232 wrapPropertyInArray: function(array, property, groupName, forceValueType, ge
neratePreview) |
| 237 { | 233 { |
| 238 for (var i = 0; i < array.length; ++i) { | 234 for (var i = 0; i < array.length; ++i) { |
| 239 if (typeof array[i] === "object" && property in array[i]) | 235 if (typeof array[i] === "object" && property in array[i]) |
| 240 array[i][property] = this.wrapObject(array[i][property], groupNa
me, canAccessInspectedGlobalObject, forceValueType, generatePreview); | 236 array[i][property] = this.wrapObject(array[i][property], groupNa
me, forceValueType, generatePreview); |
| 241 } | 237 } |
| 242 }, | 238 }, |
| 243 | 239 |
| 244 /** | 240 /** |
| 245 * @param {!Array<*>} array | 241 * @param {!Array<*>} array |
| 246 * @param {string} groupName | 242 * @param {string} groupName |
| 247 * @param {boolean} canAccessInspectedGlobalObject | |
| 248 * @param {boolean} forceValueType | 243 * @param {boolean} forceValueType |
| 249 * @param {boolean} generatePreview | 244 * @param {boolean} generatePreview |
| 250 */ | 245 */ |
| 251 wrapObjectsInArray: function(array, groupName, canAccessInspectedGlobalObjec
t, forceValueType, generatePreview) | 246 wrapObjectsInArray: function(array, groupName, forceValueType, generatePrevi
ew) |
| 252 { | 247 { |
| 253 for (var i = 0; i < array.length; ++i) | 248 for (var i = 0; i < array.length; ++i) |
| 254 array[i] = this.wrapObject(array[i], groupName, canAccessInspectedGl
obalObject, forceValueType, generatePreview); | 249 array[i] = this.wrapObject(array[i], groupName, forceValueType, gene
ratePreview); |
| 255 }, | 250 }, |
| 256 | 251 |
| 257 /** | 252 /** |
| 258 * @param {*} object | |
| 259 * @return {!RuntimeAgent.RemoteObject} | |
| 260 */ | |
| 261 _fallbackWrapper: function(object) | |
| 262 { | |
| 263 var result = { __proto__: null }; | |
| 264 result.type = typeof object; | |
| 265 if (this.isPrimitiveValue(object)) | |
| 266 result.value = object; | |
| 267 else | |
| 268 result.description = toString(object); | |
| 269 return /** @type {!RuntimeAgent.RemoteObject} */ (result); | |
| 270 }, | |
| 271 | |
| 272 /** | |
| 273 * @param {boolean} canAccessInspectedGlobalObject | |
| 274 * @param {!Object} table | 253 * @param {!Object} table |
| 275 * @param {!Array.<string>|string|boolean} columns | 254 * @param {!Array.<string>|string|boolean} columns |
| 276 * @return {!RuntimeAgent.RemoteObject} | 255 * @return {!RuntimeAgent.RemoteObject} |
| 277 */ | 256 */ |
| 278 wrapTable: function(canAccessInspectedGlobalObject, table, columns) | 257 wrapTable: function(table, columns) |
| 279 { | 258 { |
| 280 if (!canAccessInspectedGlobalObject) | |
| 281 return this._fallbackWrapper(table); | |
| 282 var columnNames = null; | 259 var columnNames = null; |
| 283 if (typeof columns === "string") | 260 if (typeof columns === "string") |
| 284 columns = [columns]; | 261 columns = [columns]; |
| 285 if (InjectedScriptHost.subtype(columns) === "array") { | 262 if (InjectedScriptHost.subtype(columns) === "array") { |
| 286 columnNames = []; | 263 columnNames = []; |
| 287 for (var i = 0; i < columns.length; ++i) | 264 for (var i = 0; i < columns.length; ++i) |
| 288 columnNames[i] = toString(columns[i]); | 265 columnNames[i] = toString(columns[i]); |
| 289 } | 266 } |
| 290 return this._wrapObject(table, "console", false, true, columnNames, true
); | 267 return this._wrapObject(table, "console", false, true, columnNames, true
); |
| 291 }, | 268 }, |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 return string.substr(0, leftHalf) + "\u2026" + string.substr(string.
length - rightHalf, rightHalf); | 1006 return string.substr(0, leftHalf) + "\u2026" + string.substr(string.
length - rightHalf, rightHalf); |
| 1030 } | 1007 } |
| 1031 return string.substr(0, maxLength) + "\u2026"; | 1008 return string.substr(0, maxLength) + "\u2026"; |
| 1032 }, | 1009 }, |
| 1033 | 1010 |
| 1034 __proto__: null | 1011 __proto__: null |
| 1035 } | 1012 } |
| 1036 | 1013 |
| 1037 return injectedScript; | 1014 return injectedScript; |
| 1038 }) | 1015 }) |
| OLD | NEW |