mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
1311ec4a42
- Bug 1162692 - Add SpeechSynthesisUtterance.chosenVoiceURI for testing purposes. r=smaug (aa30ec93c) - Bug 1160844 - Only initialize pico tts when not in mochitest and speech synth is enabled. r=smaug (5d00c71e4) - Bug 1167539 - Replace use of NS_ENSURE_* with NS_WARN_IF in dom//webspeech/synth/*. r=smaugmedia (10cb826f8) - Bug 903135 - Multi platform MAR verification build config. r=rstrong (8022418a3) - Bug 1144512 - Add b2g build support for API level 22. r=mwu (a1f9bf473) - Bug 1115480 - Part 1: Implement XPCOM module for mDNSProvider. r=mcmanus (9e2b49f1a) - Bug 1115480 - Part 2: Implement mDNS device provider. r=schien (22ca5283f) - Bug 1115480 - Re-add metadata to the dom/presentation xpcshell.ini that shouldn't have been removed. (e6a5b401e) - Bug 1058551 - Support redirects to data: URIs. r=honza (2ff31ce33) - fix build (b48590cd0) - Bug 1163859: Only update webrtc.debug prefs from gecko thread. r=rjesup (ac0f18cb1) - Bug 1145354: Add SingletonThreadHolder for media/mtransport, and use it for mtransport IPC IO r=bwc (1106b13b5) - Bug 1117586, [e10s] select dropdowns cannot be opened with the keyboard, r=roc (bbf8b8842) - Bug 1152290 - "[e10s] "<select>" doesn't show selected value". r=roc (2a130ec4f) - Bug 1147967 - Remove CreateStackFrameLocation. r=bholley (9ea0b73e0) - Bug 958641 - De-holder nsIXPConnect::WrapNative. r=gabor (c5fe0ee54) - Bug 1142999 - Remove gcc warning about unused typedef. r=ehoogeveen (e0103e01a) - Bug 1145015 - Part 1: Remove IsValidKey() check in MagicGrallocBufferHandle serializer. r=sotaro, r=nical (bb470de06) - Bug 1145015 - Part 2: Add more checking rules for GrallocBuffer allocation. r=sotaro, r=nical (05398af8d) - Bug 1130096 - Convert embedding/components/windowwatcher/ to Gecko style. r=mccr8 (554041661) - Bug 1164977 - Prevent MediaStreamAudioSourceNode from passing null to nsIPrincipal::subsumes. r=padenot (5f95a8ab9) - Bug 1164292 followup: Add 'override' annotations to BasePrincipal & nsSystemPrincipal GetCsp()/SetCsp() methods. rs=ehsan (76e5d2013) - Bug 1164977 - Hoist all the app attribute handling into BasePrincipal. r=gabor (e99bb5617) - Bug 1172483 - Remove erroneous assert. (r=Waldo) (70ce92c09) - Bug 1164977 - Unify subsumes/equals logic on BasePrincipal and reduce duplicated code. r=gabor (4dbf31b45) - Bug 1140472 - Set an async stack when invoking promise handlers. r=bz (f12a5c9f6) - Bug 1164977 - Hoist app attributes into a struct on BasePrincipal and refer to them as 'origin attributes'. r=gabor (85eb810f2) - Bug 1164977 - Hoist attribute serialization into BasePrincipal. r=gabor (ff51a67d1) - Bug 1158133 - Add a way to disable async stacks, and disable by default on mobile platforms. r=bent,jimb (c4954752e) - Bug 1171177 - Remove VAROBJFIX. (r=luke) (5707455e6) - Bug 1165162 - Make requestsync test failures more useful. rpending=baku (5c0a79f07) - Bug 1139254 - Use MockRegistrar in services. r=gps (da61a6fad) - Bug 1165162 - Fix up test_manager.js to use real principals. rpending=ferjm (797ffb5ce) - Bug 1165162 - Stop recreating principals from the message manager. r=smaug (5f5241a6e) - pointer style (c0da0f1a9) - fix some misspatch (e209af9a6) - Bug 1165486 - Replace the PlainObj varobj with NonSyntacticVariablesObject. (r=luke) (2179cf860) - Bug 1171177 - Remove UNQUALIFIED_VAROBJ Shape flags in favor of Class-checking. (r=luke) (93391d13f) - Bug 1165162 - Make OriginAttributes a dictionary, and make it accessible as both a jsval and a canonical string. r=gabor,r=bholley,sr=sicking (0731b0caf)
183 lines
4.3 KiB
C++
183 lines
4.3 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
|
/* 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 "mozilla/BasePrincipal.h"
|
|
|
|
#include "nsIObjectInputStream.h"
|
|
#include "nsIObjectOutputStream.h"
|
|
#include "nsScriptSecurityManager.h"
|
|
|
|
#include "mozilla/dom/ToJSValue.h"
|
|
|
|
namespace mozilla {
|
|
|
|
void
|
|
BasePrincipal::OriginAttributes::CreateSuffix(nsACString& aStr)
|
|
{
|
|
aStr.Truncate();
|
|
MOZ_RELEASE_ASSERT(mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
|
|
int attrCount = 0;
|
|
|
|
if (mAppId != nsIScriptSecurityManager::NO_APP_ID) {
|
|
aStr.Append(attrCount++ ? "&appId=" : "!appId=");
|
|
aStr.AppendInt(mAppId);
|
|
}
|
|
|
|
if (mInBrowser) {
|
|
aStr.Append(attrCount++ ? "&inBrowser=1" : "!inBrowser=1");
|
|
}
|
|
}
|
|
|
|
void
|
|
BasePrincipal::OriginAttributes::Serialize(nsIObjectOutputStream* aStream) const
|
|
{
|
|
aStream->Write32(mAppId);
|
|
aStream->WriteBoolean(mInBrowser);
|
|
}
|
|
|
|
nsresult
|
|
BasePrincipal::OriginAttributes::Deserialize(nsIObjectInputStream* aStream)
|
|
{
|
|
nsresult rv = aStream->Read32(&mAppId);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = aStream->ReadBoolean(&mInBrowser);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
bool
|
|
BasePrincipal::Subsumes(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration)
|
|
{
|
|
MOZ_RELEASE_ASSERT(aOther, "The caller is performing a nonsensical security check!");
|
|
return SubsumesInternal(aOther, aConsideration);
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
|
{
|
|
|
|
*aResult = Subsumes(aOther, DontConsiderDocumentDomain) &&
|
|
Cast(aOther)->Subsumes(this, DontConsiderDocumentDomain);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
|
{
|
|
*aResult = Subsumes(aOther, ConsiderDocumentDomain) &&
|
|
Cast(aOther)->Subsumes(this, ConsiderDocumentDomain);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
|
{
|
|
*aResult = Subsumes(aOther, DontConsiderDocumentDomain);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
|
{
|
|
*aResult = Subsumes(aOther, ConsiderDocumentDomain);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetCsp(nsIContentSecurityPolicy** aCsp)
|
|
{
|
|
NS_IF_ADDREF(*aCsp = mCSP);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
|
|
{
|
|
// If CSP was already set, it should not be destroyed! Instead, it should
|
|
// get set anew when a new principal is created.
|
|
if (mCSP)
|
|
return NS_ERROR_ALREADY_INITIALIZED;
|
|
|
|
mCSP = aCsp;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetIsNullPrincipal(bool* aIsNullPrincipal)
|
|
{
|
|
*aIsNullPrincipal = false;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetJarPrefix(nsACString& aJarPrefix)
|
|
{
|
|
MOZ_ASSERT(AppId() != nsIScriptSecurityManager::UNKNOWN_APP_ID);
|
|
|
|
mozilla::GetJarPrefix(AppId(), IsInBrowserElement(), aJarPrefix);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetOriginAttributes(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
|
|
{
|
|
if (NS_WARN_IF(!ToJSValue(aCx, mOriginAttributes, aVal))) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetOriginSuffix(nsACString& aOriginAttributes)
|
|
{
|
|
mOriginAttributes.CreateSuffix(aOriginAttributes);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetAppStatus(uint16_t* aAppStatus)
|
|
{
|
|
if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
|
NS_WARNING("Asking for app status on a principal with an unknown app id");
|
|
*aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
|
return NS_OK;
|
|
}
|
|
|
|
*aAppStatus = nsScriptSecurityManager::AppStatusForPrincipal(this);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetAppId(uint32_t* aAppId)
|
|
{
|
|
if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
|
MOZ_ASSERT(false);
|
|
*aAppId = nsIScriptSecurityManager::NO_APP_ID;
|
|
return NS_OK;
|
|
}
|
|
|
|
*aAppId = AppId();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetIsInBrowserElement(bool* aIsInBrowserElement)
|
|
{
|
|
*aIsInBrowserElement = IsInBrowserElement();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
BasePrincipal::GetUnknownAppId(bool* aUnknownAppId)
|
|
{
|
|
*aUnknownAppId = AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
|
return NS_OK;
|
|
}
|
|
|
|
} // namespace mozilla
|