summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
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;