Bug 1294620 - Use infallible XPIDL attribute getters more. r=erahm.
This makes a lot of code more compact, and also avoids some redundant nsresult checks. The patch also removes a handful of redundant checks on infallible setters.
This commit is contained in:
@@ -158,12 +158,9 @@ bool
|
||||
TimelineConsumers::HasConsumer(nsIDocShell* aDocShell)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!aDocShell) {
|
||||
return false;
|
||||
}
|
||||
bool isTimelineRecording = false;
|
||||
aDocShell->GetRecordProfileTimelineMarkers(&isTimelineRecording);
|
||||
return isTimelineRecording;
|
||||
return aDocShell
|
||||
? aDocShell->GetRecordProfileTimelineMarkers()
|
||||
: false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -1411,21 +1411,14 @@ ChildRunnable::Run()
|
||||
case eInitial: {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
bool nullPrincipal;
|
||||
nsresult rv = mPrincipal->GetIsNullPrincipal(&nullPrincipal);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
Fail(JS::AsmJSCache_InternalError);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (nullPrincipal) {
|
||||
if (mPrincipal->GetIsNullPrincipal()) {
|
||||
NS_WARNING("AsmsJSCache not supported on null principal.");
|
||||
Fail(JS::AsmJSCache_InternalError);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoPtr<PrincipalInfo> principalInfo(new PrincipalInfo());
|
||||
rv = PrincipalToPrincipalInfo(mPrincipal, principalInfo);
|
||||
nsresult rv = PrincipalToPrincipalInfo(mPrincipal, principalInfo);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
Fail(JS::AsmJSCache_InternalError);
|
||||
return NS_OK;
|
||||
|
||||
@@ -1645,11 +1645,7 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||
while (true) {
|
||||
bool isNullPrincipal = true;
|
||||
if (principal) {
|
||||
nsresult rv = principal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return;
|
||||
}
|
||||
isNullPrincipal = principal->GetIsNullPrincipal();
|
||||
}
|
||||
|
||||
if (!isNullPrincipal) {
|
||||
|
||||
@@ -8459,9 +8459,7 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
|
||||
|
||||
// We don't allow storage on the null principal, in general. Even if the
|
||||
// calling context is chrome.
|
||||
bool isNullPrincipal;
|
||||
if (NS_WARN_IF(NS_FAILED(aPrincipal->GetIsNullPrincipal(&isNullPrincipal))) ||
|
||||
isNullPrincipal) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
return StorageAccess::eDeny;
|
||||
}
|
||||
|
||||
|
||||
@@ -2166,9 +2166,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen));
|
||||
bool isPrivate = mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
|
||||
if (isPrivate) {
|
||||
bool nonBlank;
|
||||
mDocShell->GetHasLoadedNonBlankURI(&nonBlank);
|
||||
if (nonBlank) {
|
||||
if (mDocShell->GetHasLoadedNonBlankURI()) {
|
||||
nsContentUtils::ReportToConsoleNonLocalized(
|
||||
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
|
||||
nsIScriptError::warningFlag,
|
||||
|
||||
@@ -2336,9 +2336,7 @@ nsScriptLoader::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||
} else {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
|
||||
|
||||
bool enforceSRI = false;
|
||||
loadInfo->GetEnforceSRI(&enforceSRI);
|
||||
if (enforceSRI) {
|
||||
if (loadInfo->GetEnforceSRI()) {
|
||||
MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
|
||||
("nsScriptLoader::OnStreamComplete, required SRI not found"));
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
|
||||
@@ -137,7 +137,7 @@ BatteryManager::UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInf
|
||||
nsIDocument* doc = GetOwner() ? GetOwner()->GetDoc() : nullptr;
|
||||
uint16_t status = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
if (doc) {
|
||||
doc->NodePrincipal()->GetAppStatus(&status);
|
||||
status = doc->NodePrincipal()->GetAppStatus();
|
||||
}
|
||||
|
||||
mCharging = aBatteryInfo.charging();
|
||||
|
||||
@@ -92,13 +92,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNullPrincipal;
|
||||
mRv = principal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
if (NS_WARN_IF(mRv.Failed())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(isNullPrincipal)) {
|
||||
if (NS_WARN_IF(principal->GetIsNullPrincipal())) {
|
||||
mRv.Throw(NS_ERROR_FAILURE);
|
||||
return true;
|
||||
}
|
||||
@@ -350,13 +344,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isNullPrincipal;
|
||||
aRv = principal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(isNullPrincipal)) {
|
||||
if (NS_WARN_IF(principal->GetIsNullPrincipal())) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -307,13 +307,12 @@ nsDOMCameraManager::GetCamera(const nsAString& aCamera,
|
||||
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
|
||||
// If we are a CERTIFIED app, we can short-circuit the permission check,
|
||||
// which gets us a performance win.
|
||||
uint16_t status = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
principal->GetAppStatus(&status);
|
||||
// Unprivileged mochitests always fail the dispatched permission check,
|
||||
// even if permission to the camera has been granted.
|
||||
bool immediateCheck = false;
|
||||
CameraPreferences::GetPref("camera.control.test.permission", immediateCheck);
|
||||
if ((status == nsIPrincipal::APP_STATUS_CERTIFIED || immediateCheck) && CheckPermission(mWindow)) {
|
||||
if ((principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED || immediateCheck) &&
|
||||
CheckPermission(mWindow)) {
|
||||
PermissionAllowed(cameraId, aInitialConfig, promise);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
@@ -337,8 +337,7 @@ InternalRequest::MapChannelToRequestMode(nsIChannel* aChannel)
|
||||
return RequestMode::Same_origin;
|
||||
}
|
||||
|
||||
uint32_t securityMode;
|
||||
MOZ_ALWAYS_SUCCEEDS(loadInfo->GetSecurityMode(&securityMode));
|
||||
uint32_t securityMode = loadInfo->GetSecurityMode();
|
||||
|
||||
switch(securityMode) {
|
||||
case nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS:
|
||||
@@ -377,11 +376,9 @@ InternalRequest::MapChannelToRequestCredentials(nsIChannel* aChannel)
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
MOZ_ALWAYS_SUCCEEDS(aChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
||||
|
||||
uint32_t securityMode;
|
||||
MOZ_ALWAYS_SUCCEEDS(loadInfo->GetSecurityMode(&securityMode));
|
||||
|
||||
// TODO: Remove following code after stylesheet and image support cookie policy
|
||||
if (securityMode == nsILoadInfo::SEC_NORMAL) {
|
||||
if (loadInfo->GetSecurityMode() == nsILoadInfo::SEC_NORMAL) {
|
||||
uint32_t loadFlags;
|
||||
aChannel->GetLoadFlags(&loadFlags);
|
||||
|
||||
|
||||
@@ -196,19 +196,15 @@ nsGenericHTMLFrameElement::GetParentApplication(mozIApplication** aApplication)
|
||||
|
||||
*aApplication = nullptr;
|
||||
|
||||
uint32_t appId;
|
||||
nsIPrincipal *principal = NodePrincipal();
|
||||
nsresult rv = principal->GetAppId(&appId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
uint32_t appId = principal->GetAppId();
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (NS_WARN_IF(!appsService)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = appsService->GetAppByLocalId(appId, aApplication);
|
||||
nsresult rv = appsService->GetAppByLocalId(appId, aApplication);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -407,9 +407,7 @@ IDBFactory::AllowedForPrincipal(nsIPrincipal* aPrincipal,
|
||||
*aIsSystemPrincipal = false;
|
||||
}
|
||||
|
||||
bool isNullPrincipal;
|
||||
if (NS_WARN_IF(NS_FAILED(aPrincipal->GetIsNullPrincipal(&isNullPrincipal))) ||
|
||||
isNullPrincipal) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1129,9 +1129,7 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
||||
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||
}
|
||||
bool affectLifetime;
|
||||
docShell->GetAffectPrivateSessionLifetime(&affectLifetime);
|
||||
if (affectLifetime) {
|
||||
if (docShell->GetAffectPrivateSessionLifetime()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
||||
}
|
||||
|
||||
|
||||
@@ -1488,9 +1488,7 @@ TabChild::ApplyShowInfo(const ShowInfo& aInfo)
|
||||
nsCOMPtr<nsILoadContext> context = do_GetInterface(docShell);
|
||||
// No need to re-set private browsing mode.
|
||||
if (!context->UsePrivateBrowsing()) {
|
||||
bool nonBlank;
|
||||
docShell->GetHasLoadedNonBlankURI(&nonBlank);
|
||||
if (nonBlank) {
|
||||
if (docShell->GetHasLoadedNonBlankURI()) {
|
||||
nsContentUtils::ReportToConsoleNonLocalized(
|
||||
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
|
||||
nsIScriptError::warningFlag,
|
||||
|
||||
@@ -475,9 +475,7 @@ TabParent::IsVisible() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool visible = false;
|
||||
frameLoader->GetVisible(&visible);
|
||||
return visible;
|
||||
return frameLoader->GetVisible();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1925,11 +1925,9 @@ MediaManager::NotifyRecordingStatusChange(nsPIDOMWindowInner* aWindow,
|
||||
nsString requestURL;
|
||||
|
||||
if (nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell()) {
|
||||
nsresult rv = docShell->GetIsApp(&isApp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
isApp = docShell->GetIsApp();
|
||||
if (isApp) {
|
||||
rv = docShell->GetAppManifestURL(requestURL);
|
||||
nsresult rv = docShell->GetAppManifestURL(requestURL);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,11 +719,9 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t appStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
doc->NodePrincipal()->GetAppStatus(&appStatus);
|
||||
|
||||
// Certified applications can always assign AUDIO_3GPP
|
||||
if (appStatus == nsIPrincipal::APP_STATUS_CERTIFIED) {
|
||||
if (doc->NodePrincipal()->GetAppStatus() ==
|
||||
nsIPrincipal::APP_STATUS_CERTIFIED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,11 +79,8 @@ UDPSocketParent::OfflineNotification(nsISupports *aSubject)
|
||||
uint32_t
|
||||
UDPSocketParent::GetAppId()
|
||||
{
|
||||
uint32_t appId;
|
||||
if (!mPrincipal || NS_FAILED(mPrincipal->GetAppId(&appId))) {
|
||||
return nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
}
|
||||
return appId;
|
||||
return mPrincipal ? mPrincipal->GetAppId()
|
||||
: nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -4655,17 +4655,14 @@ QuotaManager::GetInfoFromPrincipal(nsIPrincipal* aPrincipal,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isNullPrincipal;
|
||||
nsresult rv = aPrincipal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isNullPrincipal) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
NS_WARNING("IndexedDB not supported from this principal!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCString origin;
|
||||
rv = aPrincipal->GetOrigin(origin);
|
||||
nsresult rv = aPrincipal->GetOrigin(origin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (origin.EqualsLiteral(kChromeOrigin)) {
|
||||
|
||||
@@ -430,8 +430,7 @@ nsContentSecurityManager::doContentSecurityCheck(nsIChannel* aChannel,
|
||||
// please note that some implementations of ::AsyncOpen2 might already
|
||||
// have set that flag to true (e.g. nsViewSourceChannel) in which case
|
||||
// we just set the flag again.
|
||||
rv = loadInfo->SetEnforceSecurity(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
loadInfo->SetEnforceSecurity(true);
|
||||
|
||||
if (loadInfo->GetSecurityMode() == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) {
|
||||
rv = DoCORSChecks(aChannel, loadInfo, aInAndOutListener);
|
||||
@@ -446,8 +445,7 @@ nsContentSecurityManager::doContentSecurityCheck(nsIChannel* aChannel,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// now lets set the initalSecurityFlag for subsequent calls
|
||||
rv = loadInfo->SetInitialSecurityCheckDone(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
loadInfo->SetInitialSecurityCheckDone(true);
|
||||
|
||||
// all security checks passed - lets allow the load
|
||||
return NS_OK;
|
||||
|
||||
@@ -64,8 +64,8 @@ TVChannel::Init(nsITVChannelData* aData)
|
||||
aData->GetServiceId(mServiceId);
|
||||
aData->GetName(mName);
|
||||
aData->GetNumber(mNumber);
|
||||
aData->GetIsEmergency(&mIsEmergency);
|
||||
aData->GetIsFree(&mIsFree);
|
||||
mIsEmergency = aData->GetIsEmergency();
|
||||
mIsFree = aData->GetIsFree();
|
||||
|
||||
mTVService = TVServiceFactory::AutoCreateTVService();
|
||||
NS_ENSURE_TRUE(mTVService, false);
|
||||
|
||||
@@ -33,8 +33,8 @@ TVProgram::TVProgram(nsISupports* aOwner,
|
||||
|
||||
aData->GetEventId(mEventId);
|
||||
aData->GetTitle(mTitle);
|
||||
aData->GetStartTime(&mStartTime);
|
||||
aData->GetDuration(&mDuration);
|
||||
mStartTime = aData->GetStartTime();
|
||||
mDuration = aData->GetDuration();
|
||||
aData->GetDescription(mDescription);
|
||||
aData->GetRating(mRating);
|
||||
|
||||
|
||||
@@ -147,9 +147,9 @@ private:
|
||||
bool isNullPrincipal = false;
|
||||
bool isSystemPrincipal = false;
|
||||
if (principal) {
|
||||
principal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
isNullPrincipal = principal->GetIsNullPrincipal();
|
||||
MOZ_ASSERT(!isNullPrincipal);
|
||||
principal->GetIsSystemPrincipal(&isSystemPrincipal);
|
||||
isSystemPrincipal = principal->GetIsSystemPrincipal();
|
||||
MOZ_ASSERT(!isSystemPrincipal);
|
||||
}
|
||||
|
||||
|
||||
@@ -487,11 +487,7 @@ CheckUserContextCompatibility(nsIDocShell* aDocShell)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t principalUserContextId;
|
||||
nsresult rv = subjectPrincipal->GetUserContextId(&principalUserContextId);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
return principalUserContextId == userContextId;
|
||||
return subjectPrincipal->GetUserContextId() == userContextId;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@@ -1537,10 +1537,7 @@ nsPermissionManager::AddFromPrincipal(nsIPrincipal* aPrincipal,
|
||||
|
||||
// Null principals can't meaningfully have persisted permissions attached to
|
||||
// them, so we don't allow adding permissions for them.
|
||||
bool isNullPrincipal;
|
||||
nsresult rv = aPrincipal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (isNullPrincipal) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2431,10 +2428,7 @@ nsPermissionManager::RemoveExpiredPermissionsForApp(uint32_t aAppId)
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
GetPrincipalFromOrigin(entry->GetKey()->mOrigin, getter_AddRefs(principal));
|
||||
|
||||
uint32_t appId;
|
||||
principal->GetAppId(&appId);
|
||||
|
||||
if (appId != aAppId) {
|
||||
if (principal->GetAppId() != aAppId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -512,15 +512,13 @@ public:
|
||||
nsCOMPtr<nsIPrincipal> principal = PrincipalInfoToPrincipal(mPrincipalInfo);
|
||||
AssertAppPrincipal(mContentParent, principal);
|
||||
|
||||
bool isNullPrincipal;
|
||||
nsresult rv = principal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || isNullPrincipal) {
|
||||
if (principal->GetIsNullPrincipal()) {
|
||||
mContentParent->KillHard("BroadcastChannel killed: no null principal.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString origin;
|
||||
rv = principal->GetOrigin(origin);
|
||||
nsresult rv = principal->GetOrigin(origin);
|
||||
if (NS_FAILED(rv)) {
|
||||
mContentParent->KillHard("BroadcastChannel killed: principal::GetOrigin failed.");
|
||||
return NS_OK;
|
||||
|
||||
@@ -130,17 +130,12 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
MOZ_ASSERT(aPrincipalInfo);
|
||||
|
||||
bool isNullPrin;
|
||||
nsresult rv = aPrincipal->GetIsNullPrincipal(&isNullPrin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (isNullPrin) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
*aPrincipalInfo = NullPrincipalInfo(BasePrincipal::Cast(aPrincipal)->OriginAttributesRef());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
||||
@@ -941,9 +941,7 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader,
|
||||
mSheet->GetIntegrity(sriMetadata);
|
||||
if (sriMetadata.IsEmpty()) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
|
||||
bool enforceSRI = false;
|
||||
loadInfo->GetEnforceSRI(&enforceSRI);
|
||||
if (enforceSRI) {
|
||||
if (loadInfo->GetEnforceSRI()) {
|
||||
LOG((" Load was blocked by SRI"));
|
||||
MOZ_LOG(gSriPRLog, mozilla::LogLevel::Debug,
|
||||
("css::Loader::OnStreamComplete, required SRI not found"));
|
||||
|
||||
@@ -1046,9 +1046,7 @@ nsJARChannel::OnDownloadComplete(MemoryDownloader* aDownloader,
|
||||
} else {
|
||||
nsCOMPtr<nsIJARChannel> innerJARChannel(do_QueryInterface(channel));
|
||||
if (innerJARChannel) {
|
||||
bool unsafe;
|
||||
innerJARChannel->GetIsUnsafe(&unsafe);
|
||||
mIsUnsafe = unsafe;
|
||||
mIsUnsafe = innerJARChannel->GetIsUnsafe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
if (channel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
|
||||
if (loadInfo) {
|
||||
loadInfo->GetVerifySignedContent(&mEnforceSRI);
|
||||
mEnforceSRI = loadInfo->GetVerifySignedContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,10 +554,7 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
|
||||
// If this is a null principal then the load group doesn't really matter.
|
||||
// The principal will not be allowed to perform any actions that actually
|
||||
// use the load group. Unconditionally treat null principals as a match.
|
||||
bool isNullPrincipal;
|
||||
nsresult rv = aPrincipal->GetIsNullPrincipal(&isNullPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
if (isNullPrincipal) {
|
||||
if (aPrincipal->GetIsNullPrincipal()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -573,20 +570,13 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
|
||||
// Verify load context appId and browser flag match the principal
|
||||
uint32_t contextAppId;
|
||||
bool contextInIsolatedBrowser;
|
||||
rv = loadContext->GetAppId(&contextAppId);
|
||||
nsresult rv = loadContext->GetAppId(&contextAppId);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
rv = loadContext->GetIsInIsolatedMozBrowserElement(&contextInIsolatedBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
uint32_t principalAppId;
|
||||
bool principalInIsolatedBrowser;
|
||||
rv = aPrincipal->GetAppId(&principalAppId);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
rv = aPrincipal->GetIsInIsolatedMozBrowserElement(&principalInIsolatedBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
return contextAppId == principalAppId &&
|
||||
contextInIsolatedBrowser == principalInIsolatedBrowser;
|
||||
return contextAppId == aPrincipal->GetAppId() &&
|
||||
contextInIsolatedBrowser == aPrincipal->GetIsInIsolatedMozBrowserElement();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -1534,8 +1524,7 @@ NS_IsAppOffline(nsIPrincipal *principal)
|
||||
if (!principal) {
|
||||
return NS_IsOffline();
|
||||
}
|
||||
uint32_t appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
principal->GetAppId(&appId);
|
||||
uint32_t appId = principal->GetAppId();
|
||||
|
||||
return NS_IsAppOffline(appId);
|
||||
}
|
||||
@@ -2455,11 +2444,7 @@ NS_CompareLoadInfoAndLoadContext(nsIChannel *aChannel)
|
||||
DocShellOriginAttributes originAttrsLoadContext;
|
||||
loadContext->GetOriginAttributes(originAttrsLoadContext);
|
||||
|
||||
bool loadInfoUsePB = false;
|
||||
rv = loadInfo->GetUsePrivateBrowsing(&loadInfoUsePB);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
bool loadInfoUsePB = loadInfo->GetUsePrivateBrowsing();
|
||||
bool loadContextUsePB = false;
|
||||
rv = loadContext->GetUsePrivateBrowsing(&loadContextUsePB);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
||||
@@ -596,15 +596,9 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal,
|
||||
}
|
||||
|
||||
if (aPrincipal) {
|
||||
nsresult rv = aPrincipal->GetAppId(&mAppId);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = aPrincipal->GetIsInIsolatedMozBrowserElement(&mIsInIsolatedMozBrowserElement);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
mAppId = aPrincipal->GetAppId();
|
||||
mIsInIsolatedMozBrowserElement =
|
||||
aPrincipal->GetIsInIsolatedMozBrowserElement();
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
|
||||
@@ -329,12 +329,9 @@ public:
|
||||
nsCOMPtr<nsISupports> secInfo;
|
||||
mConnection->GetSecurityInfo(getter_AddRefs(secInfo));
|
||||
nsCOMPtr<nsISSLSocketControl> socketControl = do_QueryInterface(secInfo);
|
||||
bool bypassAuth = false;
|
||||
|
||||
if (!socketControl ||
|
||||
NS_FAILED(socketControl->GetBypassAuthentication(&bypassAuth))) {
|
||||
bypassAuth = false;
|
||||
}
|
||||
bool bypassAuth = socketControl
|
||||
? socketControl->GetBypassAuthentication()
|
||||
: false;
|
||||
|
||||
LOG(("AltSvcTransaction::MaybeValidate() %p socketControl=%p bypass=%d",
|
||||
this, socketControl.get(), bypassAuth));
|
||||
|
||||
@@ -414,10 +414,7 @@ nsHttpConnectionMgr::SpeculativeConnect(nsHttpConnectionInfo *ci,
|
||||
nsCOMPtr<nsISpeculativeConnectionOverrider> overrider =
|
||||
do_GetInterface(callbacks);
|
||||
|
||||
bool allow1918 = false;
|
||||
if (overrider) {
|
||||
overrider->GetAllow1918(&allow1918);
|
||||
}
|
||||
bool allow1918 = overrider ? overrider->GetAllow1918() : false;
|
||||
|
||||
// Hosts that are Local IP Literals should not be speculatively
|
||||
// connected - Bug 853423.
|
||||
@@ -440,11 +437,11 @@ nsHttpConnectionMgr::SpeculativeConnect(nsHttpConnectionInfo *ci,
|
||||
|
||||
if (overrider) {
|
||||
args->mOverridesOK = true;
|
||||
overrider->GetParallelSpeculativeConnectLimit(
|
||||
&args->mParallelSpeculativeConnectLimit);
|
||||
overrider->GetIgnoreIdle(&args->mIgnoreIdle);
|
||||
overrider->GetIsFromPredictor(&args->mIsFromPredictor);
|
||||
overrider->GetAllow1918(&args->mAllow1918);
|
||||
args->mParallelSpeculativeConnectLimit =
|
||||
overrider->GetParallelSpeculativeConnectLimit();
|
||||
args->mIgnoreIdle = overrider->GetIgnoreIdle();
|
||||
args->mIsFromPredictor = overrider->GetIsFromPredictor();
|
||||
args->mAllow1918 = overrider->GetAllow1918();
|
||||
}
|
||||
|
||||
return PostEvent(&nsHttpConnectionMgr::OnMsgSpeculativeConnect, 0, args);
|
||||
|
||||
@@ -1133,9 +1133,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) {
|
||||
: Telemetry::SSL_KEY_EXCHANGE_ALGORITHM_RESUMED,
|
||||
cipherInfo.keaType);
|
||||
|
||||
DebugOnly<int16_t> KEAUsed;
|
||||
MOZ_ASSERT(NS_SUCCEEDED(infoObject->GetKEAUsed(&KEAUsed)) &&
|
||||
(KEAUsed == cipherInfo.keaType));
|
||||
MOZ_ASSERT(infoObject->GetKEAUsed() == cipherInfo.keaType);
|
||||
|
||||
if (infoObject->IsFullHandshake()) {
|
||||
switch (cipherInfo.keaType) {
|
||||
|
||||
@@ -113,14 +113,6 @@ public:
|
||||
|
||||
void SetMACAlgorithmUsed(int16_t mac) { mMACAlgorithmUsed = mac; }
|
||||
|
||||
inline bool GetBypassAuthentication()
|
||||
{
|
||||
bool result = false;
|
||||
mozilla::DebugOnly<nsresult> rv = GetBypassAuthentication(&result);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return result;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~nsNSSSocketInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user