Closed Bug 195833 Opened 23 years ago Closed 23 years ago

js error in onLocationChange when trying to get hostPort of wyciwyg:// url

Categories

(SeaMonkey :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: shliang, Assigned: shliang)

References

Details

Attachments

(1 file, 1 obsolete file)

wyciwyg:// protocol needs to be stripped off before getting hostPort (nsBrowserStatusHandler.js line 350 in onLocationChange, used to determind if popup blocked icon should be shown)
Attached patch patch (obsolete) — Splinter Review
Comment on attachment 116164 [details] [diff] [review] patch jag, could you r/sr? thanks
Attachment #116164 - Flags: review?(jaggernaut)
Comment on attachment 116164 [details] [diff] [review] patch There are other URI implementations than wyciwyg that will fail when you try to get their hostPort. This patch is definitely needed, but the hostPort access needs to be wrapped in a try/catch in any case.
Attachment #116164 - Flags: superreview-
*** Bug 192779 has been marked as a duplicate of this bug. ***
*** Bug 195413 has been marked as a duplicate of this bug. ***
e.g. see bug 195413 for a non-wyciwyg failure case.
Attached patch adding try/catchSplinter Review
Attachment #116164 - Attachment is obsolete: true
Attachment #116218 - Flags: superreview+
Comment on attachment 116218 [details] [diff] [review] adding try/catch I don't think you should need a try/catch around |hostPort = locationURI.hostPort|. locationURI is either an exposableURI (and hostPort should work, n'est-ce pas?), or it's null (due to the earlier try/catch failing), which you could check for in the |if (blank || ...)|. bz, am I missing something?
Attachment #116218 - Flags: review?
about:mozilla is an exposable URI and has no hostport. view-source:http://www.mozilla.org is an exposable URI and has no hostport I can probably come up with a few other examples and distributors can trivially add others... "has no hostport" means "the getter throws". Again, see bug 195413...
Hmm... Why are we throwing an exception for that? nsIURI.idl specifies that when no port is given, the default port is assumed and |port| returns -1, |hostPort| returns |host|. Shouldn't that extend to URIs for which |port| doesn't apply?
Comment on attachment 116218 [details] [diff] [review] adding try/catch r=jag, though I'm still curious why we're throwing exceptions.
Attachment #116218 - Flags: review? → review+
Because we're talking about URI schemes which have no concept of a port. See http://lxr.mozilla.org/seamonkey/source/netwerk/base/src/nsSimpleURI.cpp#223
hmm.. do we care in this case that we can't get the info out of the URL? the wyciwyg protocol is meant to be transparent to users. they should never see those URLs in the browser UI, and along the same lines, they should never see negative side-effects due to those URLs. do we care in this case?
Darin, the wyciwyg issue is actually resolved by getting the "exposable URI". The question on the table is whether the getters in nsSimpleURL should throw (for about: uris, eg) as they do now. If so, we need a try/catch in this code.
yeah, the getters should just return empty string (or -1 in the case of the port). setters for nsSimpleURI should throw, however. i'm sure someone was just being lazy when they made these functions throw, or maybe they didn't want to have strdup("") all over the place (back when nsIURI used raw |string| params). nothing wrong with "_retval.Truncate(); return NS_OK;" IMO.
Then we'll have to look through our code and see if anyone is depending on us currently throwing (returning a non-NS_OK).
yeah.. there is that :(
resolving
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 198529 has been marked as a duplicate of this bug. ***
*** Bug 194998 has been marked as a duplicate of this bug. ***
Attachment #116164 - Flags: review?(jaggernaut)
*** Bug 203518 has been marked as a duplicate of this bug. ***
*** Bug 206699 has been marked as a duplicate of this bug. ***
Product: Browser → Seamonkey
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: