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)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: toderu, Unassigned)
References
Details
(Keywords: regression, Whiteboard: [good first bug][mentor=felipe][lang=js])
Attachments
(2 files)
|
39.54 KB,
image/png
|
Details | |
|
1.97 KB,
patch
|
dao
:
feedback-
|
Details | Diff | Splinter Review |
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
Updated•14 years ago
|
Whiteboard: [good first bug][mentor=felipe]
Comment 2•14 years ago
|
||
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
Comment 3•14 years ago
|
||
(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.
Updated•14 years ago
|
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 5•14 years ago
|
||
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+
Comment 6•14 years ago
|
||
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
Comment 7•14 years ago
|
||
(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.
Comment 8•14 years ago
|
||
(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...
Comment 10•14 years ago
|
||
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-
Comment 11•14 years ago
|
||
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.
Comment 12•14 years ago
|
||
(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.
Comment 13•14 years ago
|
||
(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.
Comment 14•14 years ago
|
||
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.
Comment 15•14 years ago
|
||
(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?
Comment 16•14 years ago
|
||
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?
Comment 17•14 years ago
|
||
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.)
Comment 18•14 years ago
|
||
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.
Comment 19•14 years ago
|
||
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 :)
Comment 20•14 years ago
|
||
(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.
Comment 21•14 years ago
|
||
OK, I'll WONTFIX bug 722244. Lemme know if I'm needed here, but looks like I'm not.
Comment 22•13 years ago
|
||
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)
Comment 23•13 years ago
|
||
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
Comment 24•13 years ago
|
||
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) ?
Comment 25•13 years ago
|
||
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
Comment 26•13 years ago
|
||
This is a cross-platform issue. I can reproduce it fine in Fedora.
OS: Windows 7 → All
Comment 27•13 years ago
|
||
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.
Description
•