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

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 312143003: This fixes bug with trying to get properties of non-object (symbol). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address comments Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index b60be3e95288e365eddde8188f7fb2b7acba3747..a1569b3be3829ad82274f02841179dd25626f948 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -173,13 +173,23 @@ function max(a, b)
}
/**
+ * @param {*} obj
aandrey 2014/06/05 15:13:23 plz add: * FIXME: Remove once ES6 is supported na
Alexandra Mikhaylova 2014/06/06 09:49:51 Done.
+ * @return {boolean}
+ */
+function isSymbol(obj)
+{
+ var type = typeof obj;
+ return (type === "symbol");
+}
+
+/**
* @constructor
*/
var InjectedScript = function()
{
/** @type {number} */
this._lastBoundObjectId = 1;
- /** @type {!Object.<number, Object>} */
+ /** @type {!Object.<number, (Object|symbol)>} */
this._idToWrappedObject = { __proto__: null };
/** @type {!Object.<number, string>} */
this._idToObjectGroupName = { __proto__: null };
@@ -312,7 +322,7 @@ InjectedScript.prototype = {
},
/**
- * @param {Object} object
+ * @param {Object|symbol} object
* @param {string=} objectGroupName
* @return {string}
*/
@@ -383,8 +393,9 @@ InjectedScript.prototype = {
var object = this._objectForId(parsedObjectId);
var objectGroupName = this._idToObjectGroupName[parsedObjectId.id];
- if (!this._isDefined(object))
+ if (!this._isDefined(object) || isSymbol(object))
return false;
+ object = /** @type {Object} */ (object);
var descriptors = this._propertyDescriptors(object, ownProperties, accessorPropertiesOnly);
// Go over properties, wrap object values.
@@ -415,8 +426,9 @@ InjectedScript.prototype = {
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
var objectGroupName = this._idToObjectGroupName[parsedObjectId.id];
- if (!this._isDefined(object))
+ if (!this._isDefined(object) || isSymbol(object))
return false;
+ object = /** @type {Object} */ (object);
var descriptors = [];
var internalProperties = InjectedScriptHost.getInternalProperties(object);
if (internalProperties) {
@@ -497,8 +509,7 @@ InjectedScript.prototype = {
continue;
var name = property;
- var type = typeof property;
- if (type === "symbol")
+ if (isSymbol(property))
name = injectedScript._describe(property);
try {
@@ -532,7 +543,7 @@ InjectedScript.prototype = {
descriptor.name = name;
if (o === object)
descriptor.isOwn = true;
- if (type === "symbol")
+ if (isSymbol(property))
descriptor.symbol = property;
push(descriptors, descriptor);
}
@@ -874,7 +885,7 @@ InjectedScript.prototype = {
/**
* @param {Object} objectId
- * @return {Object}
+ * @return {Object|symbol}
*/
_objectForId: function(objectId)
{
@@ -883,7 +894,7 @@ InjectedScript.prototype = {
/**
* @param {string} objectId
- * @return {Object}
+ * @return {Object|symbol}
*/
findObjectById: function(objectId)
{

Powered by Google App Engine
This is Rietveld 408576698