I am working on a simple Firefox Extension and I want to get the selected text. I tried this:
var WordCount = { /* ... */ changeSelected: function() {
Your problem is that document.commandDispatcher.focusedWindow is going to be pointing to a chrome window, where I suspect you actually want a content window. Try replacing that with content.getSelection()
document.commandDispatcher.focusedWindow
content.getSelection()