Closed Bug 1956447 Opened 1 month ago Closed 27 days ago

getRepresentativeSnippet doc is incorrect

Categories

(Firefox for Android :: Tooling, defect)

All
Android
defect

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: michel, Assigned: michel)

Details

Attachments

(1 file)

The doc states that:

/**
 * Get the representative part of the URL. Usually this is the eTLD part of the host.
 *
 * For example this method will return "facebook.com" for "https://www.facebook.com/foobar".
 */
fun String.getRepresentativeSnippet(): String {
    val uri = this.toUri()

    val host = uri.hostWithoutCommonPrefixes
    if (!host.isNullOrEmpty()) {
        return host
    }

    val path = uri.path
    if (!path.isNullOrEmpty()) {
        return path
    }

    return this
}

However, that function does not return the eTLD (more commonly known as the public prefix). It usually returns the host/domain with common prefixes (exactly "www.", "mobile.", "m.") stripped.

Pushed by tthibaud@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2e51a92620ab Correct getRepresentativeSnippet ktx Android component doc. r=tthibaud,android-reviewers
Status: NEW → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: