[gnome-shell] environment: Warn when trying to access a deprecated actor property
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] environment: Warn when trying to access a deprecated actor property
- Date: Wed, 17 Apr 2019 21:36:49 +0000 (UTC)
commit 526bb72f3d10d21e59eee5f3557ec32081845684
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Apr 13 13:34:29 2019 -0500
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.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487
js/ui/environment.js | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/js/ui/environment.js b/js/ui/environment.js
index e22ec7402..f70394710 100644
--- a/js/ui/environment.js
+++ b/js/ui/environment.js
@@ -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() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]