summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 13:03:50 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-30 13:03:50 +0000
commita0db36a7c15ad1810e4670e63f43c92608dea868 (patch)
treee22fefc61c7b69ce5bd25a5966135d4fa1477bcf /webkit
parente41b32659f8d74e52cdfa1b78fa77214d3f17d2b (diff)
downloadchromium_src-a0db36a7c15ad1810e4670e63f43c92608dea868.zip
chromium_src-a0db36a7c15ad1810e4670e63f43c92608dea868.tar.gz
chromium_src-a0db36a7c15ad1810e4670e63f43c92608dea868.tar.bz2
DevTools: Show errors that happened while expanding object properties.
Review URL: http://codereview.chromium.org/159634 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/js/inject.js55
1 files changed, 29 insertions, 26 deletions
diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js
index 5778a42..7b71349 100644
--- a/webkit/glue/devtools/js/inject.js
+++ b/webkit/glue/devtools/js/inject.js
@@ -102,34 +102,37 @@ devtools.Injected.prototype.getProperties =
continue;
}
+ var value;
+ var type;
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);
- }
+ value = obj[name];
+ type = typeof value;
} catch (e) {
- // Mute exceptions from unsafe getters.
+ value = 'Exception: ' + e.toString();
+ type = 'string';
+ }
+ 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);
}
}
return result;