зеркало из https://github.com/mozilla/pjs.git
Bug 372554 - "ASSERTION: cannot set host on no-auth url" trying to set location.hostname at a file: URL
p=Ryan Jones <sciguyryan@gmail.com> r=biesi/r+sr=jst
This commit is contained in:
Родитель
cc08284199
Коммит
d6e3c1b3e2
|
@ -57,7 +57,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -428,18 +427,17 @@ NS_IMETHODIMP
|
|||
nsLocation::SetHash(const nsAString& aHash)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
|
||||
if (url) {
|
||||
url->SetRef(NS_ConvertUTF16toUTF8(aHash));
|
||||
SetURI(url);
|
||||
rv = url->SetRef(NS_ConvertUTF16toUTF8(aHash));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(url);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -469,16 +467,16 @@ NS_IMETHODIMP
|
|||
nsLocation::SetHost(const nsAString& aHost)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
uri->SetHostPort(NS_ConvertUTF16toUTF8(aHost));
|
||||
SetURI(uri);
|
||||
rv = uri->SetHostPort(NS_ConvertUTF16toUTF8(aHost));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -508,16 +506,16 @@ NS_IMETHODIMP
|
|||
nsLocation::SetHostname(const nsAString& aHostname)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
uri->SetHost(NS_ConvertUTF16toUTF8(aHostname));
|
||||
SetURI(uri);
|
||||
rv = uri->SetHost(NS_ConvertUTF16toUTF8(aHostname));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -687,16 +685,16 @@ NS_IMETHODIMP
|
|||
nsLocation::SetPathname(const nsAString& aPathname)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
uri->SetPath(NS_ConvertUTF16toUTF8(aPathname));
|
||||
SetURI(uri);
|
||||
rv = uri->SetPath(NS_ConvertUTF16toUTF8(aPathname));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -730,9 +728,7 @@ NS_IMETHODIMP
|
|||
nsLocation::SetPort(const nsAString& aPort)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
// perhaps use nsReadingIterators at some point?
|
||||
|
@ -749,11 +745,13 @@ nsLocation::SetPort(const nsAString& aPort)
|
|||
}
|
||||
}
|
||||
|
||||
uri->SetPort(port);
|
||||
SetURI(uri);
|
||||
rv = uri->SetPort(port);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -784,16 +782,16 @@ NS_IMETHODIMP
|
|||
nsLocation::SetProtocol(const nsAString& aProtocol)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
uri->SetScheme(NS_ConvertUTF16toUTF8(aProtocol));
|
||||
SetURI(uri);
|
||||
rv = uri->SetScheme(NS_ConvertUTF16toUTF8(aProtocol));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -826,17 +824,17 @@ NS_IMETHODIMP
|
|||
nsLocation::SetSearch(const nsAString& aSearch)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = GetWritableURI(getter_AddRefs(uri));
|
||||
nsresult rv = GetWritableURI(getter_AddRefs(uri));
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (url) {
|
||||
result = url->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
|
||||
SetURI(uri);
|
||||
rv = url->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetURI(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1425,7 +1425,7 @@ nsStandardURL::SetHost(const nsACString &input)
|
|||
if (mURLType == URLTYPE_NO_AUTHORITY) {
|
||||
if (flat.IsEmpty())
|
||||
return NS_OK;
|
||||
NS_ERROR("cannot set host on no-auth url");
|
||||
NS_WARNING("cannot set host on no-auth url");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ nsStandardURL::SetPort(PRInt32 port)
|
|||
return NS_OK;
|
||||
|
||||
if (mURLType == URLTYPE_NO_AUTHORITY) {
|
||||
NS_ERROR("cannot set port on no-auth url");
|
||||
NS_WARNING("cannot set port on no-auth url");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче