Environment: don't fail in toString()
Some objects have a resolve hooks that throw exceptions, so just checking "'actor' in object" can fail. In that case we should catch the exception and return the standard toString() value, or the object cannot be inspected from the looking glass. https://bugzilla.gnome.org/show_bug.cgi?id=671410
This commit is contained in:
parent
9bb9999b46
commit
1f87eb4157
@ -59,10 +59,14 @@ function init() {
|
||||
let origToString = Object.prototype.toString;
|
||||
Object.prototype.toString = function() {
|
||||
let base = origToString.call(this);
|
||||
try {
|
||||
if ('actor' in this && this.actor instanceof Clutter.Actor)
|
||||
return base.replace(/\]$/, ' delegate for ' + this.actor.toString().substring(1));
|
||||
else
|
||||
return base;
|
||||
} catch(e) {
|
||||
return base;
|
||||
}
|
||||
};
|
||||
|
||||
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783
|
||||
|
Loading…
Reference in New Issue
Block a user