2008-08-28 02:11:02 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=2 sts=2 expandtab
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-08-28 02:11:02 +04:00
|
|
|
|
2017-03-22 13:38:40 +03:00
|
|
|
#include "NullPrincipalURI.h"
|
2013-06-30 20:26:39 +04:00
|
|
|
|
2014-07-03 05:55:19 +04:00
|
|
|
#include "mozilla/DebugOnly.h"
|
2013-06-30 20:26:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
|
|
|
|
2015-02-24 23:54:40 +03:00
|
|
|
#include "mozilla/ipc/URIParams.h"
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
#include "nsEscape.h"
|
|
|
|
#include "nsCRT.h"
|
2015-03-31 20:11:00 +03:00
|
|
|
#include "nsIUUIDGenerator.h"
|
2008-08-28 02:11:02 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2017-03-22 13:38:40 +03:00
|
|
|
//// NullPrincipalURI
|
2008-08-28 02:11:02 +04:00
|
|
|
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::NullPrincipalURI()
|
2015-02-24 23:54:40 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::NullPrincipalURI(const NullPrincipalURI& aOther)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2015-03-31 20:11:00 +03:00
|
|
|
mPath.Assign(aOther.mPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Init()
|
2015-03-31 20:11:00 +03:00
|
|
|
{
|
|
|
|
// FIXME: bug 327161 -- make sure the uuid generator is reseeding-resistant.
|
|
|
|
nsCOMPtr<nsIUUIDGenerator> uuidgen = services::GetUUIDGenerator();
|
|
|
|
NS_ENSURE_TRUE(uuidgen, NS_ERROR_NOT_AVAILABLE);
|
|
|
|
|
|
|
|
nsID id;
|
|
|
|
nsresult rv = uuidgen->GenerateUUIDInPlace(&id);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2008-08-28 02:11:02 +04:00
|
|
|
|
2017-08-09 13:41:40 +03:00
|
|
|
mPath.SetLength(NSID_LENGTH - 1); // -1 because NSID_LENGTH counts the '\0'
|
|
|
|
id.ToProvidedString(
|
|
|
|
*reinterpret_cast<char(*)[NSID_LENGTH]>(mPath.BeginWriting()));
|
2008-08-28 02:11:02 +04:00
|
|
|
|
2015-03-31 20:11:00 +03:00
|
|
|
MOZ_ASSERT(mPath.Length() == NSID_LENGTH - 1);
|
|
|
|
MOZ_ASSERT(strlen(mPath.get()) == NSID_LENGTH - 1);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
2017-03-22 13:38:40 +03:00
|
|
|
already_AddRefed<NullPrincipalURI>
|
|
|
|
NullPrincipalURI::Create()
|
2015-03-31 20:11:00 +03:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
RefPtr<NullPrincipalURI> uri = new NullPrincipalURI();
|
2015-03-31 20:11:00 +03:00
|
|
|
nsresult rv = uri->Init();
|
|
|
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
|
|
|
return uri.forget();
|
2008-08-28 02:11:02 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static NS_DEFINE_CID(kNullPrincipalURIImplementationCID,
|
|
|
|
NS_NULLPRINCIPALURI_IMPLEMENTATION_CID);
|
|
|
|
|
2017-03-22 13:38:40 +03:00
|
|
|
NS_IMPL_ADDREF(NullPrincipalURI)
|
|
|
|
NS_IMPL_RELEASE(NullPrincipalURI)
|
2008-08-28 02:11:02 +04:00
|
|
|
|
2017-03-22 13:38:40 +03:00
|
|
|
NS_INTERFACE_MAP_BEGIN(NullPrincipalURI)
|
2012-02-20 07:51:48 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI)
|
2008-08-28 02:11:02 +04:00
|
|
|
if (aIID.Equals(kNullPrincipalURIImplementationCID))
|
2017-03-22 13:38:40 +03:00
|
|
|
foundInterface = static_cast<nsIURI*>(this);
|
2008-08-28 02:11:02 +04:00
|
|
|
else
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
2012-02-20 07:51:48 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
|
2015-02-24 23:54:40 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI)
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// nsIURI
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetAsciiHost(nsACString& _host)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
_host.Truncate();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-08-17 22:34:17 +03:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetAsciiHostPort(nsACString& _hostport)
|
2015-08-17 22:34:17 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetAsciiSpec(nsACString& _spec)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString buffer;
|
2017-03-22 13:38:40 +03:00
|
|
|
// Ignore the return value -- NullPrincipalURI::GetSpec() is infallible.
|
2016-08-30 07:22:04 +03:00
|
|
|
Unused << GetSpec(buffer);
|
2017-01-24 22:11:44 +03:00
|
|
|
// This uses the infallible version of |NS_EscapeURL| as |GetSpec| is
|
|
|
|
// already infallible.
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_EscapeURL(buffer, esc_OnlyNonASCII | esc_AlwaysCopy, _spec);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetHost(nsACString& _host)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
_host.Truncate();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetHost(const nsACString& aHost)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetHostPort(nsACString& _host)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetHostPort(const nsACString& aHost)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2016-08-18 06:25:00 +03:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetHostAndPort(const nsACString& aHost)
|
2016-08-18 06:25:00 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetPassword(nsACString& _password)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetPassword(const nsACString& aPassword)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-07-29 14:50:21 +03:00
|
|
|
NullPrincipalURI::GetPathQueryRef(nsACString& _path)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2008-08-30 00:40:05 +04:00
|
|
|
_path = mPath;
|
2008-08-28 02:11:02 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-07-29 14:50:21 +03:00
|
|
|
NullPrincipalURI::SetPathQueryRef(const nsACString& aPath)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2016-12-28 14:40:21 +03:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetFilePath(nsACString& aFilePath)
|
2016-12-28 14:40:21 +03:00
|
|
|
{
|
|
|
|
aFilePath.Truncate();
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetFilePath(const nsACString& aFilePath)
|
2016-12-28 14:40:21 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetQuery(nsACString& aQuery)
|
2016-12-28 14:40:21 +03:00
|
|
|
{
|
|
|
|
aQuery.Truncate();
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetQuery(const nsACString& aQuery)
|
2016-12-28 14:40:21 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2017-08-02 14:43:30 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::SetQueryWithEncoding(const nsACString& aQuery,
|
|
|
|
const Encoding* aEncoding)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetRef(nsACString& _ref)
|
2011-05-22 05:12:45 +04:00
|
|
|
{
|
|
|
|
_ref.Truncate();
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetRef(const nsACString& aRef)
|
2011-05-22 05:12:45 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetPrePath(nsACString& _prePath)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2015-03-31 20:11:04 +03:00
|
|
|
_prePath = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":");
|
2008-08-28 02:11:02 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetPort(int32_t* _port)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetPort(int32_t aPort)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetScheme(nsACString& _scheme)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2015-03-31 20:11:04 +03:00
|
|
|
_scheme = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME);
|
2008-08-28 02:11:02 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetScheme(const nsACString& aScheme)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetSpec(nsACString& _spec)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2015-03-31 20:11:04 +03:00
|
|
|
_spec = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":") + mPath;
|
2008-08-28 02:11:02 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-16 01:18:15 +04:00
|
|
|
// result may contain unescaped UTF-8 characters
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetSpecIgnoringRef(nsACString& _result)
|
2011-08-16 01:18:15 +04:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
return GetSpec(_result);
|
2011-08-16 01:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetHasRef(bool* _result)
|
2011-08-16 01:18:15 +04:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
*_result = false;
|
2011-08-16 01:18:15 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-01-19 17:26:07 +03:00
|
|
|
nsresult
|
|
|
|
NullPrincipalURI::SetSpecInternal(const nsACString& aSpec)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetUsername(nsACString& _username)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetUsername(const nsACString& aUsername)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::GetUserPass(nsACString& _userPass)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SetUserPass(const nsACString& aUserPass)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Clone(nsIURI** _newURI)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
nsCOMPtr<nsIURI> uri = new NullPrincipalURI(*this);
|
2008-08-28 02:11:02 +04:00
|
|
|
uri.forget(_newURI);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::CloneIgnoringRef(nsIURI** _newURI)
|
2011-05-22 05:12:45 +04:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
// GetRef/SetRef not supported by NullPrincipalURI, so
|
2011-05-22 05:12:45 +04:00
|
|
|
// CloneIgnoringRef() is the same as Clone().
|
|
|
|
return Clone(_newURI);
|
|
|
|
}
|
|
|
|
|
2016-07-27 01:38:46 +03:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::CloneWithNewRef(const nsACString& newRef, nsIURI** _newURI)
|
2016-07-27 01:38:46 +03:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
// GetRef/SetRef not supported by NullPrincipalURI, so
|
2016-07-27 01:38:46 +03:00
|
|
|
// CloneWithNewRef() is the same as Clone().
|
|
|
|
return Clone(_newURI);
|
|
|
|
}
|
|
|
|
|
2017-11-20 19:11:30 +03:00
|
|
|
NS_IMPL_ISUPPORTS(NullPrincipalURI::Mutator, nsIURISetters, nsIURIMutator)
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::Mutate(nsIURIMutator** aMutator)
|
|
|
|
{
|
|
|
|
RefPtr<NullPrincipalURI::Mutator> mutator = new NullPrincipalURI::Mutator();
|
|
|
|
nsresult rv = mutator->InitFromURI(this);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
mutator.forget(aMutator);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Equals(nsIURI* aOther, bool* _equals)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*_equals = false;
|
2017-03-22 13:38:40 +03:00
|
|
|
RefPtr<NullPrincipalURI> otherURI;
|
2008-08-28 02:11:02 +04:00
|
|
|
nsresult rv = aOther->QueryInterface(kNullPrincipalURIImplementationCID,
|
2015-09-14 13:43:00 +03:00
|
|
|
getter_AddRefs(otherURI));
|
2008-08-28 02:11:02 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2015-03-31 20:11:04 +03:00
|
|
|
*_equals = mPath == otherURI->mPath;
|
2008-08-28 02:11:02 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-05-22 05:12:45 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::EqualsExceptRef(nsIURI* aOther, bool* _equals)
|
2011-05-22 05:12:45 +04:00
|
|
|
{
|
2017-03-22 13:38:40 +03:00
|
|
|
// GetRef/SetRef not supported by NullPrincipalURI, so
|
2011-05-22 05:12:45 +04:00
|
|
|
// EqualsExceptRef() is the same as Equals().
|
|
|
|
return Equals(aOther, _equals);
|
|
|
|
}
|
|
|
|
|
2008-08-28 02:11:02 +04:00
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Resolve(const nsACString& aRelativePath,
|
|
|
|
nsACString& _resolvedURI)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
|
|
|
_resolvedURI = aRelativePath;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SchemeIs(const char* aScheme, bool* _schemeIs)
|
2008-08-28 02:11:02 +04:00
|
|
|
{
|
2015-03-31 20:11:04 +03:00
|
|
|
*_schemeIs = (0 == nsCRT::strcasecmp(NS_NULLPRINCIPAL_SCHEME, aScheme));
|
2008-08-28 02:11:02 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-02-20 07:51:48 +04:00
|
|
|
|
2017-07-11 20:09:10 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::GetDisplaySpec(nsACString &aUnicodeSpec)
|
|
|
|
{
|
|
|
|
return GetSpec(aUnicodeSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::GetDisplayHostPort(nsACString &aUnicodeHostPort)
|
|
|
|
{
|
|
|
|
return GetHostPort(aUnicodeHostPort);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::GetDisplayHost(nsACString &aUnicodeHost)
|
|
|
|
{
|
|
|
|
return GetHost(aUnicodeHost);
|
|
|
|
}
|
|
|
|
|
2017-08-09 18:43:58 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
NullPrincipalURI::GetDisplayPrePath(nsACString &aPrePath)
|
|
|
|
{
|
|
|
|
return GetPrePath(aPrePath);
|
|
|
|
}
|
|
|
|
|
2015-02-24 23:54:40 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// nsIIPCSerializableURI
|
|
|
|
|
|
|
|
void
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Serialize(mozilla::ipc::URIParams& aParams)
|
2015-02-24 23:54:40 +03:00
|
|
|
{
|
|
|
|
aParams = mozilla::ipc::NullPrincipalURIParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::Deserialize(const mozilla::ipc::URIParams& aParams)
|
2015-02-24 23:54:40 +03:00
|
|
|
{
|
|
|
|
if (aParams.type() != mozilla::ipc::URIParams::TNullPrincipalURIParams) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("unexpected URIParams type");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-03-31 20:11:00 +03:00
|
|
|
nsresult rv = Init();
|
2015-02-24 23:54:40 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-02-20 07:51:48 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// nsISizeOf
|
|
|
|
|
|
|
|
size_t
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
2012-02-20 07:51:48 +04:00
|
|
|
{
|
2015-03-31 20:11:04 +03:00
|
|
|
return mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
2012-02-20 07:51:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
2017-03-22 13:38:40 +03:00
|
|
|
NullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
|
|
{
|
2012-02-20 07:51:48 +04:00
|
|
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
|
|
|
}
|