mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1003306 - part 2 - use services::GetPermissionManager everywhere that's appropriate; r=ehsan
This commit is contained in:
parent
e616ea9a4c
commit
4c20a67b0d
@ -2874,8 +2874,7 @@ TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, uint32_t aPerm, bool a
|
||||
return aPerm != nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService("@mozilla.org/permissionmanager;1");
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t perm;
|
||||
|
@ -2616,7 +2616,7 @@ nsFrameLoader::ResetPermissionManagerStatus()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
if (!permMgr) {
|
||||
NS_ERROR("No PermissionManager available!");
|
||||
return;
|
||||
|
@ -3121,8 +3121,8 @@ nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentTyp
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
nsCOMPtr<nsIDocument> topDoc = do_QueryInterface(topDocument);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager = services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permissionManager, false);
|
||||
|
||||
// For now we always say that the system principal uses click-to-play since
|
||||
// that maintains current behavior and we have tests that expect this.
|
||||
|
@ -396,7 +396,7 @@ nsXMLHttpRequest::InitParameters(bool aAnon, bool aSystem)
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permMgr)
|
||||
return;
|
||||
|
||||
|
@ -2338,7 +2338,7 @@ bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager) {
|
||||
return false;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ nsGenericHTMLFrameElement::GetReallyIsBrowserOrApp(bool *aOut)
|
||||
// Fail if the node principal isn't trusted.
|
||||
nsIPrincipal *principal = NodePrincipal();
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, NS_OK);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
@ -464,7 +464,7 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
|
||||
// Check permission.
|
||||
nsIPrincipal *principal = NodePrincipal();
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, NS_OK);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "AudioDestinationNode.h"
|
||||
#include "mozilla/dom/AudioDestinationNodeBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "AudioChannelAgent.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
@ -482,7 +483,7 @@ AudioDestinationNode::CheckAudioChannelPermissions(AudioChannel aValue)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager) {
|
||||
return false;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "prio.h"
|
||||
#include "private/pprio.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#define ASMJSCACHE_METADATA_FILE_NAME "metadata"
|
||||
#define ASMJSCACHE_ENTRY_FILE_NAME_BASE "module"
|
||||
@ -688,7 +689,7 @@ MainProcessRunnable::InitOnMainThread()
|
||||
MOZ_ASSERT(isApp);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> pm =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(pm, NS_ERROR_UNEXPECTED);
|
||||
|
||||
uint32_t permission;
|
||||
|
@ -1793,7 +1793,7 @@ Navigator::CheckPermission(nsPIDOMWindow* aWindow, const char* aType)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
@ -2189,7 +2189,7 @@ Navigator::HasWifiManagerSupport(JSContext* /* unused */,
|
||||
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(aGlobal);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -13653,7 +13653,7 @@ nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permMgr) {
|
||||
NS_ERROR("No PermissionManager available!");
|
||||
return;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/BluetoothManagerBinding.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -199,8 +200,7 @@ BluetoothManager::CheckPermission(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
NS_ASSERTION(aWindow, "Null pointer!");
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission;
|
||||
|
@ -90,7 +90,7 @@ bool
|
||||
nsDOMCameraManager::CheckPermission(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -3140,7 +3140,7 @@ nsDOMDeviceStorage::Init(nsPIDOMWindow* aWindow, const nsAString &aType,
|
||||
// if the caller has the "webapps-manage" permission.
|
||||
if (aType.EqualsLiteral(DEVICESTORAGE_APPS)) {
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager
|
||||
= do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
= services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permissionManager, NS_ERROR_FAILURE);
|
||||
|
||||
uint32_t permission;
|
||||
|
@ -63,8 +63,7 @@ GetIndexedDBPermissions(nsIDOMWindow* aWindow)
|
||||
return PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager = GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permissionManager, PERMISSION_DENIED);
|
||||
|
||||
uint32_t permission;
|
||||
@ -108,8 +107,7 @@ CheckPermissionsHelper::Run()
|
||||
nsIPrincipal* windowPrincipal = sop->GetPrincipal();
|
||||
NS_ASSERTION(windowPrincipal, "Null principal!");
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager = GetPermissionManager();
|
||||
NS_ENSURE_STATE(permissionManager);
|
||||
|
||||
rv = permissionManager->AddFromPrincipal(windowPrincipal,
|
||||
|
@ -225,7 +225,7 @@ CheckPermission(PContentParent* aActor,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> pm =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(pm, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
// Make sure that `aPermission' is an app permission before checking the origin.
|
||||
|
@ -1406,7 +1406,7 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission)
|
||||
{
|
||||
#if MOZ_PERMISSIONS
|
||||
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
|
@ -1705,7 +1705,7 @@ ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissio
|
||||
{
|
||||
#ifdef MOZ_PERMISSIONS
|
||||
nsCOMPtr<nsIPermissionManager> permissionManagerIface =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
nsPermissionManager* permissionManager =
|
||||
static_cast<nsPermissionManager*>(permissionManagerIface.get());
|
||||
NS_ABORT_IF_FALSE(permissionManager,
|
||||
|
@ -157,7 +157,7 @@ MobileConnection::CheckPermission(const char* aType)
|
||||
NS_ENSURE_TRUE(window, false);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
mozilla::services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/MozPowerManagerBinding.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -185,7 +186,7 @@ bool
|
||||
PowerManager::CheckPermission(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -122,7 +122,7 @@ CheckQuotaHelper::GetQuotaPermission(nsIPrincipal* aPrincipal)
|
||||
"Chrome windows shouldn't track quota!");
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> pm =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(pm, nsIPermissionManager::DENY_ACTION);
|
||||
|
||||
uint32_t permission;
|
||||
@ -161,7 +161,7 @@ CheckQuotaHelper::Run()
|
||||
NS_ENSURE_TRUE(sop, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_STATE(permissionManager);
|
||||
|
||||
rv = permissionManager->AddFromPrincipal(sop->GetPrincipal(),
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -147,8 +148,7 @@ SpeakerManager::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, nullptr);
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#ifdef MOZ_B2G
|
||||
#include "nsIDOMDesktopNotification.h"
|
||||
@ -674,7 +675,7 @@ Notification::GetPermissionInternal(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
uint32_t permission = nsIPermissionManager::UNKNOWN_ACTION;
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
|
||||
permissionManager->TestPermissionFromPrincipal(principal,
|
||||
"desktop-notification",
|
||||
|
@ -254,7 +254,7 @@ DOMStorage::CanUseStorage(DOMStorage* aStorage)
|
||||
// IsCallerChrome().
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "AudioChannelManager.h"
|
||||
#include "mozilla/dom/AudioChannelManagerBinding.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
using namespace mozilla::hal;
|
||||
|
||||
@ -85,7 +86,7 @@ AudioChannelManager::SetVolumeControlChannel(const nsAString& aChannel)
|
||||
// Only normal channel doesn't need permission.
|
||||
if (newChannel != AudioChannel::Normal) {
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager) {
|
||||
return false;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "GeneratedEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "mozilla/dom/DeviceLightEvent.h"
|
||||
#include "mozilla/dom/DeviceProximityEvent.h"
|
||||
@ -181,7 +182,7 @@ WindowCannotReceiveSensorEvent (nsPIDOMWindow* aWindow)
|
||||
|
||||
if (aWindow->GetOuterWindow()->IsBackground()) {
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
permMgr->TestPermissionFromWindow(aWindow, "background-sensors", &permission);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIURI.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
/**
|
||||
* The Popup Window Manager maintains popup window permissions by website.
|
||||
@ -40,7 +41,7 @@ nsresult
|
||||
nsPopupWindowManager::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
mPermissionManager = mozilla::services::GetPermissionManager();
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
|
@ -239,7 +239,7 @@ nsSubDocumentFrame::PassPointerEventsToChildren()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (permMgr) {
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
permMgr->TestPermissionFromPrincipal(GetContent()->NodePrincipal(),
|
||||
|
@ -618,7 +618,7 @@ nsHttpChannel::RetrieveSSLOptions()
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permMgr)
|
||||
return;
|
||||
|
||||
@ -1180,7 +1180,7 @@ nsHttpChannel::ProcessSSLInformation()
|
||||
// use via RetrieveSSLOptions(()
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permMgr)
|
||||
return;
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ nsUrlClassifierDBService::LookupURI(nsIPrincipal* aPrincipal,
|
||||
|
||||
if (!clean) {
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
|
||||
if (permissionManager) {
|
||||
uint32_t perm;
|
||||
|
@ -695,7 +695,7 @@ OfflineAppPermForPrincipal(nsIPrincipal *aPrincipal,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -767,7 +767,7 @@ nsOfflineCacheUpdateService::AllowOfflineApp(nsIDOMWindow *aWindow,
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIPermissionManager> permissionManager =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
services::GetPermissionManager();
|
||||
if (!permissionManager)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user