Commit 526bb72f authored by Florian Müllner's avatar Florian Müllner Committed by Florian Müllner

environment: Warn when trying to access a deprecated actor property

The port away from the old Shell.GenericContainer actor turned many JS
classes with a corresponding actor property into Clutter.Actor subclasses.
For compatibility reasons, those properties were kept around for a while.
They were now removed and any code that still uses them should be adjusted.

Facilitate that transition by defining the compatibility property on
Clutter.Actor itself, but log a warning every time it is accessed.

!487
parent 49c95cff
......@@ -96,6 +96,15 @@ function init() {
Clutter.Actor.prototype.toString = function() {
return St.describe_actor(this);
};
// Deprecation warning for former JS classes turned into an actor subclass
Object.defineProperty(Clutter.Actor.prototype, 'actor', {
get() {
let klass = this.constructor.name;
let { stack } = new Error();
log(`Usage of object.actor is deprecated for ${klass}\n${stack}`);
return this;
}
});
let origToString = Object.prototype.toString;
Object.prototype.toString = function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment