I found a solution, but it does not use nsIController, as @Neil recommended in the SO topic <HERE look at viewSource.js.
I am still interested in nsIController solution if I try to understand that it connects me.
So, here is how you observe the choice:
var mylis = { timeout: 0, notifySelectionChanged: function(doc, sel, reason) { if (!this.timeout) { this.timeout = setTimeout(function() { console.log('notifySelectionChanged','doc=',doc,'sel=',sel,'reason=',reason); mylis.timeout = 0; }, 1000); } } } gBrowser.contentWindow.getSelection().QueryInterface(Ci.nsISelectionPrivate).addSelectionListener(mylis);
the timeout is important because otherwise it will slow down the browser flow. you can see how you highlight it all gimicky. viewSource.js used 100 ms, so I would recommend doing this.
MXR - viewSource.js
Noitidart Mar 06 '14 at 8:57 2014-03-06 08:57
source share