I'm trying to understand this code:
315 let existingIndex = this._editors.indexOf(editableNode.editor);
316 if (existingIndex == -1) {
317 let x = this._editors.length;
318 this._editors[x] = editableNode.editor;
319 this._stateListeners[x] = this._createStateListener();
320 this._editors[x].addEditActionListener(this);
321 this._editors[x].addDocumentStateListener(this._stateListeners[x]);
322 }
http://mxr.mozilla.org/mozilla-release/source/toolkit/modules/Finder.jsm#320
Especially addEditActionListener(this);
what is this
? MDN docs say it should be nsIEditActionListener but I can't find what this listener is comprised of MDN docs takes to broken page.
this
is the Finder object; it implements the nsIEditActionListener interface (http://mxr.mozilla.org/mozilla-release/source/toolkit/modules/Finder.jsm#395)
That interface is defined here: http://mxr.mozilla.org/mozilla-release/source/editor/idl/nsIEditActionListener.idl
So the code essentially attaches the Finder object to the editor, presumably so it can be notified of changes made in the editor at a later point.