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

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

Issue 1823883002: [DevTools] Removed InjectedScriptHost.eval and InjectedScriptHost.objectForId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-get-collection-entries
Patch Set: Created 4 years, 9 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 * @param {!Object|symbol} object 399 * @param {!Object|symbol} object
400 * @param {string=} objectGroupName 400 * @param {string=} objectGroupName
401 * @return {string} 401 * @return {string}
402 */ 402 */
403 _bind: function(object, objectGroupName) 403 _bind: function(object, objectGroupName)
404 { 404 {
405 var id = InjectedScriptHost.bind(object, objectGroupName || ""); 405 var id = InjectedScriptHost.bind(object, objectGroupName || "");
406 return "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + " }"; 406 return "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + " }";
407 }, 407 },
408 408
409 /**
410 * @param {string} objectId
411 * @return {!Object}
412 */
413 _parseObjectId: function(objectId)
414 {
415 return nullifyObjectProto(/** @type {!Object} */ (InjectedScriptHost.eva l("(" + objectId + ")")));
416 },
417
418 clearLastEvaluationResult: function() 409 clearLastEvaluationResult: function()
419 { 410 {
420 delete this._lastResult; 411 delete this._lastResult;
421 }, 412 },
422 413
423 /** 414 /**
424 * @param {*} result 415 * @param {*} result
425 */ 416 */
426 setLastEvaluationResult: function(result) 417 setLastEvaluationResult: function(result)
427 { 418 {
428 this._lastResult = result; 419 this._lastResult = result;
429 }, 420 },
430 421
431 /** 422 /**
432 * @param {string} objectId 423 * @param {!Object} object
424 * @param {string} objectGroupName
433 * @param {boolean} ownProperties 425 * @param {boolean} ownProperties
434 * @param {boolean} accessorPropertiesOnly 426 * @param {boolean} accessorPropertiesOnly
435 * @param {boolean} generatePreview 427 * @param {boolean} generatePreview
436 * @return {!Array.<!RuntimeAgent.PropertyDescriptor>|boolean} 428 * @return {!Array<!RuntimeAgent.PropertyDescriptor>|boolean}
437 */ 429 */
438 getProperties: function(objectId, ownProperties, accessorPropertiesOnly, gen eratePreview) 430 getProperties: function(object, objectGroupName, ownProperties, accessorProp ertiesOnly, generatePreview)
439 { 431 {
440 var parsedObjectId = this._parseObjectId(objectId);
441 var object = this._objectForId(parsedObjectId);
442 var objectGroupName = InjectedScriptHost.idToObjectGroupName(parsedObjec tId.id);
443
444 if (!this._isDefined(object) || isSymbol(object))
445 return false;
446 object = /** @type {!Object} */ (object);
447 var descriptors = []; 432 var descriptors = [];
448 var iter = this._propertyDescriptors(object, ownProperties, accessorProp ertiesOnly, undefined); 433 var iter = this._propertyDescriptors(object, ownProperties, accessorProp ertiesOnly, undefined);
449 // Go over properties, wrap object values. 434 // Go over properties, wrap object values.
450 for (var descriptor of iter) { 435 for (var descriptor of iter) {
451 if ("get" in descriptor) 436 if ("get" in descriptor)
452 descriptor.get = this._wrapObject(descriptor.get, objectGroupNam e); 437 descriptor.get = this._wrapObject(descriptor.get, objectGroupNam e);
453 if ("set" in descriptor) 438 if ("set" in descriptor)
454 descriptor.set = this._wrapObject(descriptor.set, objectGroupNam e); 439 descriptor.set = this._wrapObject(descriptor.set, objectGroupNam e);
455 if ("value" in descriptor) 440 if ("value" in descriptor)
456 descriptor.value = this._wrapObject(descriptor.value, objectGrou pName, false, generatePreview); 441 descriptor.value = this._wrapObject(descriptor.value, objectGrou pName, false, generatePreview);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 * @this {InjectedScript} 651 * @this {InjectedScript}
667 */ 652 */
668 function wrap(object, forceValueType, generatePreview, columnNames, isTa ble, customObjectConfig) 653 function wrap(object, forceValueType, generatePreview, columnNames, isTa ble, customObjectConfig)
669 { 654 {
670 return this._wrapObject(object, objectGroup, forceValueType, generat ePreview, columnNames, isTable, false, customObjectConfig); 655 return this._wrapObject(object, objectGroup, forceValueType, generat ePreview, columnNames, isTable, false, customObjectConfig);
671 } 656 }
672 return { bindRemoteObject: bind(wrap, this), __proto__: null}; 657 return { bindRemoteObject: bind(wrap, this), __proto__: null};
673 }, 658 },
674 659
675 /** 660 /**
676 * @param {!Object} objectId
677 * @return {!Object|symbol|undefined}
678 */
679 _objectForId: function(objectId)
680 {
681 return objectId.injectedScriptId === injectedScriptId ? /** @type{!Objec t|symbol|undefined} */ (InjectedScriptHost.objectForId(objectId.id)) : void 0;
682 },
683
684 /**
685 * @param {*} object 661 * @param {*} object
686 * @return {boolean} 662 * @return {boolean}
687 */ 663 */
688 _isDefined: function(object) 664 _isDefined: function(object)
689 { 665 {
690 return !!object || this._isHTMLAllCollection(object); 666 return !!object || this._isHTMLAllCollection(object);
691 }, 667 },
692 668
693 /** 669 /**
694 * @param {*} object 670 * @param {*} object
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 */ 1541 */
1566 _logEvent: function(event) 1542 _logEvent: function(event)
1567 { 1543 {
1568 inspectedGlobalObject.console.log(event.type, event); 1544 inspectedGlobalObject.console.log(event.type, event);
1569 } 1545 }
1570 } 1546 }
1571 1547
1572 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1548 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1573 return injectedScript; 1549 return injectedScript;
1574 }) 1550 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698