Chromium Code Reviews| Index: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js |
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js |
| index eb8115f9024830252f5a55e8b3822cce5c7d09d3..9e4cc794cad484e511c641350f1d2b216320adc1 100644 |
| --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js |
| +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js |
| @@ -451,40 +451,24 @@ InjectedScript.prototype = { |
| function* process(o, properties) |
| { |
| for (var property of properties) { |
| - var name; |
| - if (isSymbol(property)) |
| - name = /** @type {string} */ (injectedScript._describe(property)); |
| - else |
| - name = typeof property === "number" ? ("" + property) : /** @type {string} */(property); |
| - |
| + var name = isSymbol(property) ? (/** @type {string} */ (injectedScript._describe(property))) : "" + property; |
| if (propertyProcessed[property]) |
| continue; |
| try { |
| propertyProcessed[property] = true; |
| var descriptor = nullifyObjectProto(InjectedScriptHost.suppressWarningsAndCallFunction(Object.getOwnPropertyDescriptor, Object, [o, property])); |
| - if (descriptor) { |
| - if (accessorPropertiesOnly && !("get" in descriptor || "set" in descriptor)) |
| - continue; |
| - if ("get" in descriptor && "set" in descriptor && name != "__proto__" && InjectedScriptHost.formatAccessorsAsProperties(object) && !doesAttributeHaveObservableSideEffectOnGet(object, name)) { |
| - descriptor.value = InjectedScriptHost.suppressWarningsAndCallFunction(function(attribute) { return this[attribute]; }, object, [property]); |
| - descriptor.isOwn = true; |
| - delete descriptor.get; |
| - delete descriptor.set; |
| - } |
| - } else { |
| - // Not all bindings provide proper descriptors. Fall back to the writable, configurable property. |
| - if (accessorPropertiesOnly) |
| - continue; |
| - try { |
| - descriptor = { name: name, value: o[property], writable: false, configurable: false, enumerable: false, __proto__: null }; |
| - if (o === object) |
| - descriptor.isOwn = true; |
| - yield descriptor; |
| - } catch (e) { |
| - // Silent catch. |
| - } |
| + var isAccessor = "get" in descriptor || "set" in descriptor; |
| + if (accessorPropertiesOnly && !isAccessor) |
| continue; |
| + |
| + var isGetterFunction = typeof descriptor.get === "function"; |
| + var canFormatAccessorsAsProperty = !(isGetterFunction ? InjectedScriptHost.hasFunctionSource(descriptor.get) : true); |
|
lushnikov
2016/05/06 17:58:56
can we inline "!"
kozy
2016/05/06 18:02:19
Done.
|
| + if (isAccessor && name !== "__proto__" && canFormatAccessorsAsProperty && !doesAttributeHaveObservableSideEffectOnGet(object, name)) { |
| + descriptor.value = InjectedScriptHost.suppressWarningsAndCallFunction(function(attribute) { return this[attribute]; }, object, [property]); |
| + descriptor.isOwn = true; |
| + delete descriptor.get; |
| + delete descriptor.set; |
| } |
| } catch (e) { |
| if (accessorPropertiesOnly) |