[EMAIL PROTECTED] (Doug Turner) writes:
> -=-=-=-=-=-
> 
> If you have a string which may or may not be a URL and you want to get a
> nsIURI for it, do not do this:
> 
> // BAD!
> nsCOMPtr<nsIURL> uri;
> nsComponentManager::CreateInstance("@mozilla.org/network/standard-url;1",
> 
>                                      nsnull,
>                                      NS_GET_IID(nsIURL),
>                                      getter_AddRefs(uri));
> uri->SetSpec(url);
> //
> 
> 
> This above code bypass necko's pluggable protocol architecture
> completely.  Furthermore, if you have a bad URL, not all of the getter
> attribute will be set properly.
> 
> The proper thing to do is to call NS_NewURI:
> 
> http://lxr.mozilla.org/seamonkey/source/netwerk/base/public/nsNetUtil.h#66
> 
> This is in regards to bug
> http://bugzilla.mozilla.org/show_bug.cgi?id=73845
> 
> The bug has a listing of call sites that I know about and will change
> (if I can).  If you are doing anything special, please contact me.

How is one supposed to get a URI from JavaScript (or any
other non-C++ language)?

Dan
-- 

Reply via email to