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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a Created 4 years, 5 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
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 * @const 192 * @const
193 */ 193 */
194 InjectedScript.primitiveTypes = { 194 InjectedScript.primitiveTypes = {
195 "undefined": true, 195 "undefined": true,
196 "boolean": true, 196 "boolean": true,
197 "number": true, 197 "number": true,
198 "string": true, 198 "string": true,
199 __proto__: null 199 __proto__: null
200 } 200 }
201 201
202 /**
203 * @type {!Map<string, string>}
204 * @const
205 */
206 InjectedScript.closureTypes = new Map([
207 ["local", "Local"],
208 ["closure", "Closure"],
209 ["catch", "Catch"],
210 ["block", "Block"],
211 ["script", "Script"],
212 ["with", "With Block"],
213 ["global", "Global"]
214 ]);
215
202 InjectedScript.prototype = { 216 InjectedScript.prototype = {
203 /** 217 /**
204 * @param {*} object 218 * @param {*} object
205 * @return {boolean} 219 * @return {boolean}
206 */ 220 */
207 isPrimitiveValue: function(object) 221 isPrimitiveValue: function(object)
208 { 222 {
209 // FIXME(33716): typeof document.all is always 'undefined'. 223 // FIXME(33716): typeof document.all is always 'undefined'.
210 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC ollection(object); 224 return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllC ollection(object);
211 }, 225 },
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 /** 354 /**
341 * @param {!Object} object 355 * @param {!Object} object
342 * @param {string} objectGroupName 356 * @param {string} objectGroupName
343 * @param {boolean} ownProperties 357 * @param {boolean} ownProperties
344 * @param {boolean} accessorPropertiesOnly 358 * @param {boolean} accessorPropertiesOnly
345 * @param {boolean} generatePreview 359 * @param {boolean} generatePreview
346 * @return {!Array<!RuntimeAgent.PropertyDescriptor>|boolean} 360 * @return {!Array<!RuntimeAgent.PropertyDescriptor>|boolean}
347 */ 361 */
348 getProperties: function(object, objectGroupName, ownProperties, accessorProp ertiesOnly, generatePreview) 362 getProperties: function(object, objectGroupName, ownProperties, accessorProp ertiesOnly, generatePreview)
349 { 363 {
364 var subtype = this._subtype(object);
365 if (subtype === "internal#scope")
366 object = object.object;
dgozman 2016/07/07 19:59:23 This needs a justification.
kozy 2016/07/07 22:59:08 Added comment.
367
350 var descriptors = []; 368 var descriptors = [];
351 var iter = this._propertyDescriptors(object, ownProperties, accessorProp ertiesOnly, undefined); 369 var iter = this._propertyDescriptors(object, ownProperties, accessorProp ertiesOnly, undefined);
352 // Go over properties, wrap object values. 370 // Go over properties, wrap object values.
353 for (var descriptor of iter) { 371 for (var descriptor of iter) {
354 if ("get" in descriptor) 372 if ("get" in descriptor)
355 descriptor.get = this._wrapObject(descriptor.get, objectGroupNam e); 373 descriptor.get = this._wrapObject(descriptor.get, objectGroupNam e);
356 if ("set" in descriptor) 374 if ("set" in descriptor)
357 descriptor.set = this._wrapObject(descriptor.set, objectGroupNam e); 375 descriptor.set = this._wrapObject(descriptor.set, objectGroupNam e);
358 if ("value" in descriptor) 376 if ("value" in descriptor)
359 descriptor.value = this._wrapObject(descriptor.value, objectGrou pName, false, generatePreview); 377 descriptor.value = this._wrapObject(descriptor.value, objectGrou pName, false, generatePreview);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } catch(e) { 661 } catch(e) {
644 } 662 }
645 } 663 }
646 664
647 if (subtype === "internal#entry") { 665 if (subtype === "internal#entry") {
648 if ("key" in obj) 666 if ("key" in obj)
649 return "{" + this._describeIncludingPrimitives(obj.key) + " => " + this._describeIncludingPrimitives(obj.value) + "}"; 667 return "{" + this._describeIncludingPrimitives(obj.key) + " => " + this._describeIncludingPrimitives(obj.value) + "}";
650 return this._describeIncludingPrimitives(obj.value); 668 return this._describeIncludingPrimitives(obj.value);
651 } 669 }
652 670
671 if (subtype === "internal#scopes")
dgozman 2016/07/07 19:59:23 scopeList
kozy 2016/07/07 22:59:08 Done.
672 return "Scopes[" + obj.length + "]";
673
674 if (subtype === "internal#scope")
675 return (InjectedScript.closureTypes.get(obj.type) || "Unknown") + (o bj.name ? "(" + obj.name + ")" : "");
dgozman 2016/07/07 19:59:23 maybe space before "(" ?
kozy 2016/07/07 22:59:08 Done.
676
653 return className; 677 return className;
654 }, 678 },
655 679
656 /** 680 /**
657 * @param {*} value 681 * @param {*} value
658 * @return {string} 682 * @return {string}
659 */ 683 */
660 _describeIncludingPrimitives: function(value) 684 _describeIncludingPrimitives: function(value)
661 { 685 {
662 if (typeof value === "string") 686 if (typeof value === "string")
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf); 1069 return string.substr(0, leftHalf) + "\u2026" + string.substr(string. length - rightHalf, rightHalf);
1046 } 1070 }
1047 return string.substr(0, maxLength) + "\u2026"; 1071 return string.substr(0, maxLength) + "\u2026";
1048 }, 1072 },
1049 1073
1050 __proto__: null 1074 __proto__: null
1051 } 1075 }
1052 1076
1053 return injectedScript; 1077 return injectedScript;
1054 }) 1078 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698