publicSuffix.isKnownSuffix does not throw for inputs that are invalid host names
Categories
(WebExtensions :: General, defect, P3)
Tracking
(firefox158 fixed)
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: robwu, Assigned: kzar)
References
Details
(Keywords: dev-doc-complete, Whiteboard: [addons-jira])
Attachments
(1 external file)
The implementation at https://searchfox.org/firefox-main/rev/600bd2128b2ba435b9698ec8b61394aa27c7c93f/toolkit/components/extensions/child/ext-publicSuffix.js#39-45 catches and swallows errors unconditionally.
Dave noted at https://bugzilla.mozilla.org/show_bug.cgi?id=1315558#c42 that this behavior is not in line with the original API proposal, the MDN documentation and Chromium's implementation:
I'm working on the Chromium implementation of this API at the moment, and I noticed a (very minor) bug in the Firefox implementation. For a case like
browser.publicSuffix.isKnownSuffix("invalid%.domain"), the API is returningfalseinstead of throwing an exception. That seems to contradict the API proposal and the docs in MDN (and soon to be the Chromium implementation).
When I approved the implementation, I reasoned that returning false for an invalid host name is reasonable. But given that the MDN documentation, original API proposal and Chromium's implementation all expect a thrown error, and throwing would just be more consistent across all other publicSuffix methods, I'm supportive of changing the behavior to just throw.
| Assignee | ||
Updated•2 months ago
|
Updated•2 months ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
The browser.publicSuffix.isKnownSuffix extension API should throw when the
given hostname is invalid, instead of returning false.
See https://github.com/w3c/webextensions/blob/main/proposals/public-suffix.md#4-invalid-hostname
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
https://hg-edge.mozilla.org/mozilla-central/rev/83fbfef2e78c
(I think I confused the automation by closing this before the mozilla-central commit was merged, sorry.)
| Assignee | ||
Comment 4•1 month ago
|
||
The docs for this API already specify that it should throw for invalid hostnames, but it could be worth mentioning the fix in the release notes for add-ons devs.
Comment 5•1 month ago
|
||
| bugherder | ||
Documentation changes available in:
Description
•