Context menu for selected text in content shows all items

RESOLVED FIXED in Thunderbird 3.0b1


10 years ago
9 years ago


(Reporter: philor, Assigned: philor)


({dev-doc-complete, regression})

Thunderbird 3.0b1
dev-doc-complete, regression

Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)



10 years ago
Created attachment 346224 [details] [diff] [review]
Fix v.1

More fallout from my worst-ever job of reviewing, in bug 461112. We have an unimplemented, never shown or used backend for a context menuitem to search for selected text (copied from Fx's copying from SM), that I couldn't quite bear to tear out when I rewrote nsContextMenu.js. Even though I saw that the patch in 461112 was removing the searchText string and switching to loading instead of, I failed to notice that the patch wasn't actually adding searchText there.

But, in keeping with my claim that you shouldn't ever use strings which have been translated unused and unseen for years, the right thing to do is not to just add it back, and make localizers retranslate it while still not being able to see the result. Much as I hate to see it go, the right thing is to rip out the unused code until we actually use it.
Attachment #346224 - Flags: review?(bugzilla)


10 years ago
Priority: -- → P1
Thanks for patching my incomplete patch. 
And thanks for giving me the ability to show that we have lots of unused areas of code, by delivering an incomplete patch :)
Comment on attachment 346224 [details] [diff] [review]
Fix v.1

So the patch reduces to:

>   isTextSelection : function CM_isTextSelection() {
>     var selection = this.searchSelected();
>+    if (selection != "")
>+      return true;
>+    return false;

how about:

return this.searchSelected();

much simpler.

Comment 3

10 years ago
Comment on attachment 346224 [details] [diff] [review]
Fix v.1

Then I'll be forced to accept that there's no point in having a separate function, and no point in normalizing the whitespace, and before you know it I'll find myself fixing our share of bug 272041, too.
Attachment #346224 - Attachment is obsolete: true
Attachment #346224 - Flags: review?(bugzilla)

Comment 4

10 years ago
Created attachment 346412 [details] [diff] [review]
Fix v.2

I guess actually fixing something is better than just preserving my favorite unused code.
Attachment #346412 - Flags: review?(bugzilla)
Attachment #346412 - Flags: review?(bugzilla) → review+

Comment 5

10 years ago
Last Resolved: 10 years ago
Resolution: --- → FIXED
For those who need the removed gContextMenu.isTextSelected (extensions ported from Firefox) here's the replacement:

var isTextSelected = false;
if (gContextMenu.isContentSelected) {
  var selection = document.commandDispatcher.focusedWindow.
      getSelection().toString().replace(/(\n|\r|\t)+/g, " ").trim();
  isTextSelected = (selection != "");

I'm linking this from and
Keywords: dev-doc-complete
You need to log in before you can comment on or make changes to this bug.