Closed Bug 690827 Opened 15 years ago Closed 13 years ago

right click on non-link text "foo.bar" shows "open link" menu item

Categories

(Firefox :: Menus, defect)

7 Branch
x86_64
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: toderu, Unassigned)

References

Details

(Keywords: regression, Whiteboard: [good first bug][mentor=felipe][lang=js])

Attachments

(2 files)

Attached image link_fail.png —
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Build ID: 20110928134238 Steps to reproduce: right click a selected text and options 'open link' appear. sample text: services.sync.log.appender.file.logOnSuccess (to reproduce, select the text and right click) Expected results: no 'open link' options in right click menu as it is not a link for a proper domain. offtopic: we want also options to rearrange the right click menu (in fx3 first option was copy, and in fx4+ first one is open link).
Simple example (select and click right): x.y No problem with Fx3.6
Keywords: regression
Summary: open link on non-link text → right click on non-link text "foo.bar" shows "open link" menu item
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [good first bug][mentor=felipe]
I think this is working as intended, we try to handle things that look like a address but missing a protocol, see: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/nsContextMenu.js#147
(In reply to Marco Bonardo [:mak] from comment #2) > I think this is working as intended, we try to handle things that look like > a address but missing a protocol. Yeah, but I think we can be a bit smarter and verify against a list of all TLDs in that check. False positive means that a context menu item shows up incorrectly and feels awkward. False negative means that an extra context menu item doesn't show up, and the user can copy/paste the address in this case. The false positive case seems like it is much more likely than the false negative case.
Whiteboard: [good first bug][mentor=felipe] → [good first bug][mentor=felipe][lang=js]
This is my second bug, so it's probably not too good. May I ask how I could debug/test any changes I make to js files? Would someone test it, and give feedback on it please?
Attachment #583880 - Flags: feedback+
Attachment #583880 - Flags: checkin+
Comment on attachment 583880 [details] [diff] [review] new regexp, fixes both mentioned strings I've changed your flags to request feedback from Felipe. This is a good start. I'm not sure how we would want to store the list of TLDs. I'm curious to hear what Felipe has to say. We'll probably want some tests to accompany this too. You might want to look in to browser chrome tests, as we'll want to check the results of the context menu: https://developer.mozilla.org/en/Browser_chrome_tests
Attachment #583880 - Flags: feedback?(felipc)
Attachment #583880 - Flags: feedback+
Attachment #583880 - Flags: checkin+
I was thinking more on the lines of trying to create a new nsIURI object with the given string and see if it succeeded, since that already ensures that a valid .tld is used. Is there any reason why we should not do that instead? I see that createFixupURI is used below but that is more forgiving
(In reply to Felipe Gomes (:felipe) from comment #6) > I was thinking more on the lines of trying to create a new nsIURI object > with the given string and see if it succeeded, since that already ensures > that a valid .tld is used. > Is there any reason why we should not do that instead? I see that > createFixupURI is used below but that is more forgiving Yeah, that's much better. I knew there had to be a better solution, but I didn't think of nsIURI.
(In reply to Felipe Gomes (:felipe) from comment #6) > I was thinking more on the lines of trying to create a new nsIURI object > with the given string and see if it succeeded, since that already ensures > that a valid .tld is used. This isn't true...
Felipe: feedback ping?
Assignee: nobody → greg.karz
Status: NEW → ASSIGNED
Comment on attachment 583880 [details] [diff] [review] new regexp, fixes both mentioned strings This doesn't scale and isn't maintainable. You could try using Services.eTLD.
Attachment #583880 - Flags: feedback?(felipc) → feedback-
I tried using nsIEffectiveTLDService but there only exists methods to retrieve the suffix but none to validate it against the list from publicsuffix.org. nsIEffectiveTLDService will need to be extended to add methods such as verfiyPublicSuffix that are based off of the cached list from publicsuffix. Felipe: I'm not sure if you have any other ideas here, but I don't think this is [good first bug] territory anymore.
(In reply to Dão Gottwald [:dao] from comment #8) > (In reply to Felipe Gomes (:felipe) from comment #6) > > I was thinking more on the lines of trying to create a new nsIURI object > > with the given string and see if it succeeded, since that already ensures > > that a valid .tld is used. > > This isn't true... Sorry, I thought I had seem this somewhere, but indeed it doesn't work that way. (In reply to Dão Gottwald [:dao] from comment #10) > Comment on attachment 583880 [details] [diff] [review] > new regexp, fixes both mentioned strings > > This doesn't scale and isn't maintainable. You could try using Services.eTLD. Unfortunately Services.eTLD won't help either, as Jared mentioned, because it doesn't do the validation that we need here. We do have the list of suffixes in the tree: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat and the eTLD uses it. We could add a new function to eTLD to validate it, but this will require more C++ changes. However, I don't see why a simple hard-coded list shouldn't be used, as the list doesn't have to be comprehensive. The failure case with it implemented is better than the current one. Currently we display the "Open link" for invalid links, and the new failure would be to not display it for very few valid links that won't be covered by it.
(In reply to Felipe Gomes (:felipe) from comment #12) > However, I don't see why a simple hard-coded list shouldn't be used, as the > list doesn't have to be comprehensive. The failure case with it implemented > is better than the current one. Currently we display the "Open link" for > invalid links, and the new failure would be to not display it for very few > valid links that won't be covered by it. The list is quite long and can be updated pretty often now. If we were to fix this bug, I think we would need to work off of an in-memory cache of effective_tld_names.dat. The lookup needs to happen very fast, since it would delay opening of the context menu.
What about just a change of verbage? "Open as link..." Even with an 100% accurate list of TLDs you will not catch links for e.g. VPN and proxy cases.
(In reply to Jeff Hammel [:jhammel] from comment #14) > What about just a change of verbage? "Open as link..." Even with an 100% > accurate list of TLDs you will not catch links for e.g. VPN and proxy cases. This seems like a reasonable solution to me. Shall we morph this bug?
Alternatively we could file a bug to get a new API to validate the tld (doesn't seem too hard to do with the information the eTLD service already have), and then we could return to this bug and write the JS part when the API is ready. This depends on how far we want to go to fix the bug. Opinions?
The effective TLD list is not actually the thing you want here: I think you just want a list of top level domains (.com, .org, .tv, etc) i.e. the list here: http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains We could easily enough create such a list and use gperf to generate a very efficient lookup function that tells us whether a given string ends with one of the known tld's. It will however take maintenance to keep up to date, and will take up (small but ever-growing) space in the browser's RAM, and we won't catch the VPN/proxy cases mentioned in comment 14. But we'd still be much smarter than the current algorithm for recognizing potential URIs. I'm cc-ing gerv because he'd be the most logical person to maintain the TLD list (or know who'd maintain it). Maintenance would be an ongoing issue with this (though it wouldn't be critical to keep things up to date if the service were only used for this purpose, i.e. no big harm done if it takes a while to recognize "foo.xn--zckzah" as a valid hostname when you right-click on it.)
I'm not an expert in i10n, but I assume that for pages using the non-ASCII charset case, it would easy enough to convert the given text to the punycode IDL format before we do the TLD search.
I think we want the solution from comment 14, or no solution at all (WONTFIX). It doesn't make sense to spend time creating a brand new TLD-validation service just to fix this bug. There are bigger bang/buck problems to be working on :)
(In reply to Gavin Sharp (use gavin@gavinsharp.com for email) from comment #19) > I think we want the solution from comment 14, or no solution at all > (WONTFIX). It doesn't make sense to spend time creating a brand new > TLD-validation service just to fix this bug. There are bigger bang/buck > problems to be working on :) +1. IMHO taking a performance hit as well as developers cycles when doing the right thing is effectively impossible (that is, intuiting what the user wants) is just a rabbit hole. Obviously everyone has different perspectives, but if I highlight e.g. foo.bar and there is an `Open (as) link` context menu item(s), that tells me what will happen if I click it. I don't see a need to invest effort here when there are bigger issues.
OK, I'll WONTFIX bug 722244. Lemme know if I'm needed here, but looks like I'm not.
Greg, are you still working on this bug? Looking at old "good first bugs" I've seen this one is not touched for a while. Felipe, should it stay as "good first bugs", is it still valid?
Flags: needinfo?(felipc)
Since it is more than one year without having info from the assignee I'll reset it. Please change it again if I've missed something.
Assignee: greg.karz → nobody
Status: ASSIGNED → NEW
i would like to take this bug forward. I got to know the exact concept but what steps I should perform now ? Also I am working on Linux, Do i need to build the entire src on windows as well (I have win 8) ?
Amod, try asking info in #introduction or #developers on irc.mozilla.org. https://developer.mozilla.org/en-US/docs/Introduction#Step_2_-_Find_something_to_work_on
This is a cross-platform issue. I can reproduce it fine in Fedora.
OS: Windows 7 → All
Hi, sorry for leaving this bug open for so long, I thought it had already been closed. Given all the past discussions here, I think the right thing is to WONTFIX it (from comments 16, 19, 20). Btw thanks a lot for the interest, and for anyone looking for a good first bug: I'm happy to be a mentor for any bug that needs a mentor, even if i'm not marked in that bug. Feel free to ping me at any time!
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: needinfo?(felipc)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: