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

Unified Diff: src/inspector/injected-script-source.js

Issue 2767323002: [inspector] better isArrayLike for injected-script-source.js (Closed)
Patch Set: addressed comments Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/inspector/injected_script_externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/injected-script-source.js
diff --git a/src/inspector/injected-script-source.js b/src/inspector/injected-script-source.js
index d86b1101d17acf405672878a658da8abbe2a283a..6ec737d3773d08cdbec24a937a0831c1148f822c 100644
--- a/src/inspector/injected-script-source.js
+++ b/src/inspector/injected-script-source.js
@@ -114,14 +114,12 @@ function isArrayLike(obj)
{
if (typeof obj !== "object")
return false;
- try {
- if (typeof obj.splice === "function") {
- if (!InjectedScriptHost.objectHasOwnProperty(/** @type {!Object} */ (obj), "length"))
- return false;
- var len = obj.length;
- return typeof len === "number" && isUInt32(len);
- }
- } catch (e) {
+ var splice = InjectedScriptHost.getProperty(obj, "splice");
+ if (typeof splice === "function") {
+ if (!InjectedScriptHost.objectHasOwnProperty(/** @type {!Object} */ (obj), "length"))
+ return false;
+ var len = InjectedScriptHost.getProperty(obj, "length");
+ return typeof len === "number" && isUInt32(len);
}
return false;
}
@@ -392,7 +390,7 @@ InjectedScript.prototype = {
_propertyDescriptors: function(object, addPropertyIfNeeded, ownProperties, accessorPropertiesOnly, propertyNamesOnly)
{
var descriptors = [];
- descriptors.__proto__ = null;
+ InjectedScriptHost.nullifyPrototype(descriptors);
var propertyProcessed = { __proto__: null };
var subtype = InjectedScriptHost.subtype(object);
@@ -423,6 +421,7 @@ InjectedScript.prototype = {
var descriptor;
try {
descriptor = Object.getOwnPropertyDescriptor(o, property);
+ InjectedScriptHost.nullifyPrototype(descriptor);
var isAccessorProperty = descriptor && ("get" in descriptor || "set" in descriptor);
if (accessorPropertiesOnly && !isAccessorProperty)
continue;
@@ -437,14 +436,14 @@ InjectedScript.prototype = {
} catch (e) {
if (accessorPropertiesOnly)
continue;
- descriptor = { value: e, wasThrown: true };
+ descriptor = { value: e, wasThrown: true, __proto__: null };
}
// Not all bindings provide proper descriptors. Fall back to the non-configurable, non-enumerable,
// non-writable property.
if (!descriptor) {
try {
- descriptor = { value: o[property], writable: false };
+ descriptor = { value: o[property], writable: false, __proto__: null };
} catch (e) {
// Silent catch.
continue;
« no previous file with comments | « no previous file | src/inspector/injected_script_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698