mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
location.host should be the host the jar was fetched from for jar: URIs. Bug
53124, r=darin, sr=jst
This commit is contained in:
parent
409de81840
commit
69105f8040
@ -498,7 +498,10 @@ public:
|
||||
NS_DECL_NSIDOMNSLOCATION
|
||||
|
||||
protected:
|
||||
nsresult GetURI(nsIURI** aURL);
|
||||
// In the case of jar: uris, we sometimes want the place the jar was
|
||||
// fetched from as the URI instead of the jar: uri itself. Pass in
|
||||
// PR_TRUE for aGetInnermostURI when that's the case.
|
||||
nsresult GetURI(nsIURI** aURL, PRBool aGetInnermostURI = PR_FALSE);
|
||||
nsresult GetWritableURI(nsIURI** aURL);
|
||||
nsresult SetURI(nsIURI* aURL);
|
||||
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "nsCDefaultURIFixup.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -255,7 +256,7 @@ LocationImpl::FindUsableBaseURI(nsIURI * aBaseURI, nsIDocShell * aParent, nsIURI
|
||||
|
||||
|
||||
nsresult
|
||||
LocationImpl::GetURI(nsIURI** aURI)
|
||||
LocationImpl::GetURI(nsIURI** aURI, PRBool aGetInnermostURI)
|
||||
{
|
||||
*aURI = nsnull;
|
||||
|
||||
@ -276,6 +277,16 @@ LocationImpl::GetURI(nsIURI** aURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aGetInnermostURI) {
|
||||
nsCOMPtr<nsIJARURI> jarURI(do_QueryInterface(uri));
|
||||
while (jarURI) {
|
||||
jarURI->GetJARFile(getter_AddRefs(uri));
|
||||
jarURI = do_QueryInterface(uri);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(uri, "nsJARURI screwed up?");
|
||||
|
||||
nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -379,7 +390,7 @@ LocationImpl::GetHost(nsAString& aHost)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result;
|
||||
|
||||
result = GetURI(getter_AddRefs(uri));
|
||||
result = GetURI(getter_AddRefs(uri), PR_TRUE);
|
||||
|
||||
if (uri) {
|
||||
nsCAutoString hostport;
|
||||
@ -418,7 +429,7 @@ LocationImpl::GetHostname(nsAString& aHostname)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result;
|
||||
|
||||
result = GetURI(getter_AddRefs(uri));
|
||||
result = GetURI(getter_AddRefs(uri), PR_TRUE);
|
||||
|
||||
if (uri) {
|
||||
nsCAutoString host;
|
||||
@ -642,7 +653,7 @@ LocationImpl::GetPort(nsAString& aPort)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetURI(getter_AddRefs(uri));
|
||||
result = GetURI(getter_AddRefs(uri), PR_TRUE);
|
||||
|
||||
if (uri) {
|
||||
PRInt32 port;
|
||||
|
Loading…
Reference in New Issue
Block a user