summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 12:47:11 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 12:47:11 +0000
commitcf770159e9bb3b364f802ac6446d747964bd92b5 (patch)
tree66482c97117d96b9241feca29eb40213d9101424 /webkit/glue
parent3fbba87bc562ab45b99e5ccf4f547713b2600739 (diff)
downloadchromium_src-cf770159e9bb3b364f802ac6446d747964bd92b5.zip
chromium_src-cf770159e9bb3b364f802ac6446d747964bd92b5.tar.gz
chromium_src-cf770159e9bb3b364f802ac6446d747964bd92b5.tar.bz2
DevTools: Do not list getter functions in object properties.
BUG=17793 Review URL: http://codereview.chromium.org/160385 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/devtools/js/inject.js56
1 files changed, 32 insertions, 24 deletions
diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js
index 369e3c4..5778a42 100644
--- a/webkit/glue/devtools/js/inject.js
+++ b/webkit/glue/devtools/js/inject.js
@@ -98,30 +98,38 @@ devtools.Injected.prototype.getProperties =
!obj.hasOwnProperty(name)) {
continue;
}
- var value = obj[name];
- var type = typeof value;
- result.push(type);
- result.push(name);
- if (type == 'string') {
- var str = value;
- result.push(str.length > 99 ? str.substr(0, 99) + '...' : str);
- result.push(undefined);
- } else if (type == 'function') {
- result.push(undefined);
- var str = Function.prototype.toString.call(value);
- // Cut function signature (everything before first ')').
- var signatureLength = str.search(/\)/);
- str = str.substr(0, signatureLength + 1);
- // Collapse each group of consecutive whitespaces into one whitespaces
- // and add body brackets.
- str = str.replace(/\s+/g, ' ') + ' {}';
- result.push(str);
- } else if (type == 'object') {
- result.push(undefined);
- result.push(this.getClassName_(value));
- } else {
- result.push(value);
- result.push(undefined);
+ if (obj['__lookupGetter__'] && obj.__lookupGetter__(name)) {
+ continue;
+ }
+
+ try {
+ var value = obj[name];
+ var type = typeof value;
+ result.push(type);
+ result.push(name);
+ if (type == 'string') {
+ var str = value;
+ result.push(str.length > 99 ? str.substr(0, 99) + '...' : str);
+ result.push(undefined);
+ } else if (type == 'function') {
+ result.push(undefined);
+ var str = Function.prototype.toString.call(value);
+ // Cut function signature (everything before first ')').
+ var signatureLength = str.search(/\)/);
+ str = str.substr(0, signatureLength + 1);
+ // Collapse each group of consecutive whitespaces into one whitespaces
+ // and add body brackets.
+ str = str.replace(/\s+/g, ' ') + ' {}';
+ result.push(str);
+ } else if (type == 'object') {
+ result.push(undefined);
+ result.push(this.getClassName_(value));
+ } else {
+ result.push(value);
+ result.push(undefined);
+ }
+ } catch (e) {
+ // Mute exceptions from unsafe getters.
}
}
return result;