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