Last Comment Bug 659693 - domain highlighting doesn't work with IPv6 literals
: domain highlighting doesn't work with IPv6 literals
Product: Firefox
Classification: Client Software
Component: Location Bar (show other bugs)
: Trunk
: All All
: -- normal (vote)
: Firefox 7
Assigned To: Dão Gottwald [:dao]
: Marco Bonardo [::mak]
Depends on:
Blocks: 451833
  Show dependency treegraph
Reported: 2011-05-25 10:42 PDT by Will Roberts [:bws42]
Modified: 2013-12-27 14:22 PST (History)
5 users (show)
dao+bmo: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (1.87 KB, patch)
2011-05-25 11:52 PDT, Dão Gottwald [:dao]
sdwilsh: review+ approval‑mozilla‑aurora+
Details | Diff | Splinter Review

Description Will Roberts [:bws42] 2011-05-25 10:42:23 PDT
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1
Build Identifier: Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110525 Firefox/7.0a1

The domain highlighting feature added as part of bug 451833 fails to properly highlight the entire IPv6 address; it stops after the first colon.

Reproducible: Always
Comment 1 Will Roberts [:bws42] 2011-05-25 10:44:17 PDT
There's an example URL in the URL field, it might not work for you as it's a local IPv6 address, but it demonstrates the problem fine.
Comment 2 Dão Gottwald [:dao] 2011-05-25 11:52:24 PDT
Created attachment 535139 [details] [diff] [review]

This uses (.+?) for the host instead of ([^\/:]+), which caused this bug by excluding the colon. Since question mark makes .+ nongreedy, (?::\d+)?(?:\/|$) is needed to ensure that the host is followed by an optional port and a slash or the end of the string.
Comment 3 Shawn Wilsher :sdwilsh 2011-05-25 12:16:34 PDT
Comment on attachment 535139 [details] [diff] [review]

I sure do hate me some regular expressions.  r=sdwilsh
Comment 4 Dão Gottwald [:dao] 2011-05-25 12:47:07 PDT
Comment 5 Will Roberts [:bws42] 2011-05-25 19:47:28 PDT
Verified it works as expected.
Comment 6 Asa Dotzler [:asa] 2011-05-31 19:12:50 PDT
In the failure case, was the whole domain "graytext" or was it all "black text"?
Comment 7 Will Roberts [:bws42] 2011-05-31 19:39:37 PDT
In the failure case the address was only black to the first colon. So given an address like dead:beef:1234::1 dead was black and the rest was not.

Note You need to log in before you can comment on or make changes to this bug.