I found a solution but it doesn't use nsIController as @Neil had recommended in a SO topic HERE to look at viewSource.js.
Im still interested in a nsIController solution if possible, im trying to understand that sucker it confuses me.
So this is how you observer for a selection:
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);
//gBrowser.contentWindow.getSelection().QueryInterface(Ci.nsISelectionPrivate).removeSelectionListener(mylis);
the timeout is important because otherwise it will slow down the browser thread. you can see as you highlight its all gimicky. viewSource.js used 100ms so I would reocmmend that.
MXR - viewSource.js