mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
f7679e4701
- Bug 1219066 - Make sure to traverse and unlink HeapSnapshot::mParent in cycle collection; r=mccr8 (a25aab429d) - Bug 1220918 - Serialize and deseriliaze JS::ubi::Node's script filenames in heap snapshots; r=sfink (7bd216ff4d) - Bug 1219073 - part 1 - Add to sdk/url#URL objects. r=gozala (535e8fa870) - Bug 1205733 - Add move overloads to dom::Nullable's constructor and SetValue method, r=bz (44a2684efe) - Bug 1151884 - Enable the uint32_t overload of ToJSValue; r=smaug (989d3e5b5f) - obvious fix (76ba7249fb) - Bug 1225219 Implement ErrorResult::CloneTo(). r=bz (1a05be13c3) - Bug 1219749. Add a way to faithfully propagate the "exception is already on JSContext" state through an ErrorResult. r=peterv (cb1713a7b9) - Bug 1204501 - Update the documentation for DOMJSClass::mParticipant; r=peterv (2c0b22cfed) - Bug 979591. Disallow calling WebIDL constructors as functions even for system callers in release builds. r=peterv (7ad3312248) - Bug 1180921 - Give Optional<T> Maybe<T>-like operator== semantics. r=bz (aadc8d552d) - Bug 1188207 - Fix more constructors in DOM; r=baku (4609640af9) - Bug 1191918 - Round battery level to nearest 10% r=bz (0c98c214b1) - Bug 1221009. Part 1 - add a class to forward notifications from MediaResource to MediaDecoder. r=roc. (90ca84d0f9) - Bug 1221009. Part 2 - remove unused code. r=roc. (789b0a0e74) - Bug 1221009. Part 3 - add assertions to functions that shouldn't be called after shutdown. r=roc. (d292c1701f) - Bug 1217653 - MediaDecoder::GetOwner() should return null after shutdown. r=kinetik. (f071ecf2ee) - Bug 1219142. Part 1 - add AbstractMediaDecoder::DataArrivedEvent() to publish events. r=jya. (15e67bbd3e) - Bug 1219142. Part 2 - remove unused code. r=jya. (e2be34e25a) - bug 681602 - Implement xptcall for arm iOS. r=glandium (3be41176bc) - Bug 1188209 - Fix more constructors in memory; r=njn (28b833e741) - Bug 1222171 - Re-establish equivalence between gfxImageFormat and cairo_format_t. r=mstange. (6e50fcea80) - Bug 1215898 - Fix clang's -Wimplicit-fallthrough warnings in gfx/thebes. r=jdaggett r=jmuizelaar (db0f7ec46c) - Bug 598900 - GDI: use typo metrics when USE_TYPO_METRICS is specified. r=karlt (0fb2af92ce) - Bug 964512 - Check for existence of character before trying to get its metrics in gfxGDIFont::Initialize. r=jdaggett (bc88ee4252) - Bug 691581 - Don't let a zero-sized font result in assertions from FUnitsToDevUnitsFactor(). r=jdaggett (3408c67dbf) - clean spaces (ffdccafdea) - Bug 1192666 - Emit '[]' around origin strings for ipv6 origins, r=ehsan (cc5fcdb711) - Bug 1195415 - Add asciiHostPort field to nsIURI, and use it in the implementation of nsPrincipal::GetOriginForURI, r=bholley (7793745ecb) - Bug 1204610 - Use a smart pointer in nsNullPrincipalURI. r=mrbkap (082fedf3e7) - Bug 859764 - Part 1.1: Turn IDL Implementation into Internal-Only Interface. r=echen, r=smaug (900ae90da3) - Bug 1043250 - Part 2: Update MobileMessageCallback and SmsService. r=btseng (fc2a0ed029) - Bug 1175430 - Expose Network-Specific Error Cause for Various Error Handling in App Layer. r=btseng (c3abacd9e1) - Bug 859764 - Part 1.2: Clearn Up Naming in IDL. r=echen (41f70a1f4c) - Bug 1152730 - Part 3: Add owner window checks on DOM object operations. r=btseng (2c09378b02) - Bug 1043250 - Part 3: Update MozMobileMessageManager WebIDL interface and implementation. r=hsinyi (06feae677b) - Bug 859764 - Part 2: Define New WebIDL interfaces for MobileMessage Objects. r=echen r=smaug (54cb39df82) - Bug 859764 - Part 3: The Implementation for WebIDL Change. r=echen, r=smaug (be0d0439dc) - Bug 984413 - Add JSdoc in MobileMessageDB.jsm. r=btseng (a3f15e291a) - Bug 1154186 - Deprecate nsISmsMessenger_new.idl. r=echen (b179f3343c) - Bug 1152730 - Part 1: Update retry logic in SmsService and remove the retry in ril_worker. r=btseng (d8e5b520f2) - Bug 1197010 - Implement Android backend for createMessageCursor/createThreadCursor. r=snorp (9e4506b4a2) - Bug 748391 - Implement markMessageRead on the Android backend. r=snorp (d969455588) - Bug 859764 - Part 4: Implementation Change in Different Backend. r=echen (607b9bb53f) - Bug 1043250 - Part 4: Update SMS IPC implementation. r=btseng (264cd87721) - Bug 1197008 - Stop assuming 0 is an invalid threadId. r=btseng r=hsinyi (5498728784)
346 lines
7.6 KiB
C++
346 lines
7.6 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* vim: sw=2 ts=2 sts=2 expandtab
|
|
* 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/. */
|
|
|
|
#include "nsNullPrincipalURI.h"
|
|
|
|
#include "mozilla/DebugOnly.h"
|
|
#include "mozilla/MemoryReporting.h"
|
|
|
|
#include "mozilla/ipc/URIParams.h"
|
|
|
|
#include "nsEscape.h"
|
|
#include "nsCRT.h"
|
|
#include "nsIUUIDGenerator.h"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// nsNullPrincipalURI
|
|
|
|
nsNullPrincipalURI::nsNullPrincipalURI()
|
|
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
|
|
{
|
|
}
|
|
|
|
nsNullPrincipalURI::nsNullPrincipalURI(const nsNullPrincipalURI& aOther)
|
|
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
|
|
{
|
|
mPath.Assign(aOther.mPath);
|
|
}
|
|
|
|
nsresult
|
|
nsNullPrincipalURI::Init()
|
|
{
|
|
// 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);
|
|
|
|
MOZ_ASSERT(mPathBytes == mPath.BeginWriting());
|
|
|
|
id.ToProvidedString(mPathBytes);
|
|
|
|
MOZ_ASSERT(mPath.Length() == NSID_LENGTH - 1);
|
|
MOZ_ASSERT(strlen(mPath.get()) == NSID_LENGTH - 1);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
/* static */
|
|
already_AddRefed<nsNullPrincipalURI>
|
|
nsNullPrincipalURI::Create()
|
|
{
|
|
RefPtr<nsNullPrincipalURI> uri = new nsNullPrincipalURI();
|
|
nsresult rv = uri->Init();
|
|
NS_ENSURE_SUCCESS(rv, nullptr);
|
|
return uri.forget();
|
|
}
|
|
|
|
static NS_DEFINE_CID(kNullPrincipalURIImplementationCID,
|
|
NS_NULLPRINCIPALURI_IMPLEMENTATION_CID);
|
|
|
|
NS_IMPL_ADDREF(nsNullPrincipalURI)
|
|
NS_IMPL_RELEASE(nsNullPrincipalURI)
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI)
|
|
if (aIID.Equals(kNullPrincipalURIImplementationCID))
|
|
foundInterface = static_cast<nsIURI *>(this);
|
|
else
|
|
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
|
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
|
|
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI)
|
|
NS_INTERFACE_MAP_END
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// nsIURI
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetAsciiHost(nsACString &_host)
|
|
{
|
|
_host.Truncate();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetAsciiHostPort(nsACString &_hostport)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetAsciiSpec(nsACString &_spec)
|
|
{
|
|
nsAutoCString buffer;
|
|
(void)GetSpec(buffer);
|
|
NS_EscapeURL(buffer, esc_OnlyNonASCII | esc_AlwaysCopy, _spec);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetHost(nsACString &_host)
|
|
{
|
|
_host.Truncate();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetHost(const nsACString &aHost)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetHostPort(nsACString &_host)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetHostPort(const nsACString &aHost)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetOriginCharset(nsACString &_charset)
|
|
{
|
|
_charset.Truncate();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetPassword(nsACString &_password)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetPassword(const nsACString &aPassword)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetPath(nsACString &_path)
|
|
{
|
|
_path = mPath;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetPath(const nsACString &aPath)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetRef(nsACString &_ref)
|
|
{
|
|
_ref.Truncate();
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetRef(const nsACString &aRef)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
|
|
{
|
|
_prePath = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":");
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetPort(int32_t *_port)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetPort(int32_t aPort)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetScheme(nsACString &_scheme)
|
|
{
|
|
_scheme = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetScheme(const nsACString &aScheme)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetSpec(nsACString &_spec)
|
|
{
|
|
_spec = NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":") + mPath;
|
|
return NS_OK;
|
|
}
|
|
|
|
// result may contain unescaped UTF-8 characters
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetSpecIgnoringRef(nsACString &result)
|
|
{
|
|
return GetSpec(result);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetHasRef(bool *result)
|
|
{
|
|
*result = false;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetSpec(const nsACString &aSpec)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetUsername(nsACString &_username)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetUsername(const nsACString &aUsername)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::GetUserPass(nsACString &_userPass)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SetUserPass(const nsACString &aUserPass)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::Clone(nsIURI **_newURI)
|
|
{
|
|
nsCOMPtr<nsIURI> uri = new nsNullPrincipalURI(*this);
|
|
uri.forget(_newURI);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::CloneIgnoringRef(nsIURI **_newURI)
|
|
{
|
|
// GetRef/SetRef not supported by nsNullPrincipalURI, so
|
|
// CloneIgnoringRef() is the same as Clone().
|
|
return Clone(_newURI);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::Equals(nsIURI *aOther, bool *_equals)
|
|
{
|
|
*_equals = false;
|
|
RefPtr<nsNullPrincipalURI> otherURI;
|
|
nsresult rv = aOther->QueryInterface(kNullPrincipalURIImplementationCID,
|
|
getter_AddRefs(otherURI));
|
|
if (NS_SUCCEEDED(rv)) {
|
|
*_equals = mPath == otherURI->mPath;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::EqualsExceptRef(nsIURI *aOther, bool *_equals)
|
|
{
|
|
// GetRef/SetRef not supported by nsNullPrincipalURI, so
|
|
// EqualsExceptRef() is the same as Equals().
|
|
return Equals(aOther, _equals);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::Resolve(const nsACString &aRelativePath,
|
|
nsACString &_resolvedURI)
|
|
{
|
|
_resolvedURI = aRelativePath;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
|
|
{
|
|
*_schemeIs = (0 == nsCRT::strcasecmp(NS_NULLPRINCIPAL_SCHEME, aScheme));
|
|
return NS_OK;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// nsIIPCSerializableURI
|
|
|
|
void
|
|
nsNullPrincipalURI::Serialize(mozilla::ipc::URIParams &aParams)
|
|
{
|
|
aParams = mozilla::ipc::NullPrincipalURIParams();
|
|
}
|
|
|
|
bool
|
|
nsNullPrincipalURI::Deserialize(const mozilla::ipc::URIParams &aParams)
|
|
{
|
|
if (aParams.type() != mozilla::ipc::URIParams::TNullPrincipalURIParams) {
|
|
MOZ_ASSERT_UNREACHABLE("unexpected URIParams type");
|
|
return false;
|
|
}
|
|
|
|
nsresult rv = Init();
|
|
NS_ENSURE_SUCCESS(rv, false);
|
|
|
|
return true;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//// nsISizeOf
|
|
|
|
size_t
|
|
nsNullPrincipalURI::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
|
{
|
|
return mPath.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
|
}
|
|
|
|
size_t
|
|
nsNullPrincipalURI::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
|
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
|
}
|
|
|