mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 853356: backout p3
This commit is contained in:
parent
9e71dcb1bc
commit
4ae26c99d7
@ -217,8 +217,6 @@
|
|||||||
#include "mozilla/dom/XPathEvaluator.h"
|
#include "mozilla/dom/XPathEvaluator.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
#include "nsIStructuredCloneContainer.h"
|
#include "nsIStructuredCloneContainer.h"
|
||||||
#include "nsIMutableArray.h"
|
|
||||||
#include "nsContentPermissionHelper.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
@ -10731,11 +10729,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPointerLockPermissionRequest,
|
|||||||
nsIContentPermissionRequest)
|
nsIContentPermissionRequest)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPointerLockPermissionRequest::GetTypes(nsIArray** aTypes)
|
nsPointerLockPermissionRequest::GetType(nsACString& aType)
|
||||||
{
|
{
|
||||||
return CreatePermissionArray(NS_LITERAL_CSTRING("pointerLock"),
|
aType = "pointerLock";
|
||||||
NS_LITERAL_CSTRING("unused"),
|
return NS_OK;
|
||||||
aTypes);
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsPointerLockPermissionRequest::GetAccess(nsACString& aAccess)
|
||||||
|
{
|
||||||
|
aAccess = "unused";
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -6,156 +6,20 @@
|
|||||||
#include "GonkPermission.h"
|
#include "GonkPermission.h"
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
#endif // MOZ_WIDGET_GONK
|
#endif // MOZ_WIDGET_GONK
|
||||||
|
#include "nsContentPermissionHelper.h"
|
||||||
|
#include "nsIContentPermissionPrompt.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/PContentPermission.h"
|
|
||||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
|
||||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsArrayUtils.h"
|
|
||||||
#include "nsIMutableArray.h"
|
|
||||||
#include "nsContentPermissionHelper.h"
|
|
||||||
|
|
||||||
using mozilla::unused; // <snicker>
|
using mozilla::unused; // <snicker>
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
|
||||||
Element* element,
|
|
||||||
const IPC::Principal& principal);
|
|
||||||
virtual ~ContentPermissionRequestParent();
|
|
||||||
|
|
||||||
bool IsBeingDestroyed();
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
||||||
nsCOMPtr<Element> mElement;
|
|
||||||
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
|
||||||
nsTArray<PermissionRequest> mRequests;
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual bool Recvprompt();
|
|
||||||
virtual void ActorDestroy(ActorDestroyReason why);
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
|
||||||
Element* aElement,
|
|
||||||
const IPC::Principal& aPrincipal)
|
|
||||||
{
|
|
||||||
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
|
||||||
|
|
||||||
mPrincipal = aPrincipal;
|
|
||||||
mElement = aElement;
|
|
||||||
mRequests = aRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentPermissionRequestParent::~ContentPermissionRequestParent()
|
|
||||||
{
|
|
||||||
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ContentPermissionRequestParent::Recvprompt()
|
|
||||||
{
|
|
||||||
mProxy = new nsContentPermissionRequestProxy();
|
|
||||||
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
|
||||||
if (NS_FAILED(mProxy->Init(mRequests, this))) {
|
|
||||||
mProxy->Cancel();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
|
|
||||||
{
|
|
||||||
if (mProxy) {
|
|
||||||
mProxy->OnParentDestroyed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ContentPermissionRequestParent::IsBeingDestroyed()
|
|
||||||
{
|
|
||||||
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
|
|
||||||
// to send out any message now.
|
|
||||||
TabParent* tabParent = static_cast<TabParent*>(Manager());
|
|
||||||
return tabParent->IsDestroyed();
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(ContentPermissionType, nsIContentPermissionType)
|
|
||||||
|
|
||||||
ContentPermissionType::ContentPermissionType(const nsACString& aType,
|
|
||||||
const nsACString& aAccess)
|
|
||||||
{
|
|
||||||
mType = aType;
|
|
||||||
mAccess = aAccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentPermissionType::~ContentPermissionType()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
ContentPermissionType::GetType(nsACString& aType)
|
|
||||||
{
|
|
||||||
aType = mType;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
ContentPermissionType::GetAccess(nsACString& aAccess)
|
|
||||||
{
|
|
||||||
aAccess = mAccess;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
|
|
||||||
nsIMutableArray* aDesArray)
|
|
||||||
{
|
|
||||||
uint32_t len = aSrcArray.Length();
|
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
|
||||||
nsRefPtr<ContentPermissionType> cpt =
|
|
||||||
new ContentPermissionType(aSrcArray[i].type(), aSrcArray[i].access());
|
|
||||||
aDesArray->AppendElement(cpt, false);
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
CreatePermissionArray(const nsACString& aType,
|
|
||||||
const nsACString& aAccess,
|
|
||||||
nsIArray** aTypesArray)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
|
||||||
nsRefPtr<ContentPermissionType> permType = new ContentPermissionType(aType,
|
|
||||||
aAccess);
|
|
||||||
types->AppendElement(permType, false);
|
|
||||||
types.forget(aTypesArray);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PContentPermissionRequestParent*
|
|
||||||
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
|
||||||
Element* element,
|
|
||||||
const IPC::Principal& principal)
|
|
||||||
{
|
|
||||||
return new ContentPermissionRequestParent(aRequests, element, principal);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsContentPermissionRequestProxy);
|
MOZ_COUNT_CTOR(nsContentPermissionRequestProxy);
|
||||||
@ -167,12 +31,14 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsContentPermissionRequestProxy::Init(const nsTArray<PermissionRequest>& requests,
|
nsContentPermissionRequestProxy::Init(const nsACString & type,
|
||||||
|
const nsACString & access,
|
||||||
ContentPermissionRequestParent* parent)
|
ContentPermissionRequestParent* parent)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(parent, "null parent");
|
NS_ASSERTION(parent, "null parent");
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
mPermissionRequests = requests;
|
mType = type;
|
||||||
|
mAccess = access;
|
||||||
|
|
||||||
nsCOMPtr<nsIContentPermissionPrompt> prompt = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
|
nsCOMPtr<nsIContentPermissionPrompt> prompt = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
|
||||||
if (!prompt) {
|
if (!prompt) {
|
||||||
@ -192,14 +58,17 @@ nsContentPermissionRequestProxy::OnParentDestroyed()
|
|||||||
NS_IMPL_ISUPPORTS1(nsContentPermissionRequestProxy, nsIContentPermissionRequest)
|
NS_IMPL_ISUPPORTS1(nsContentPermissionRequestProxy, nsIContentPermissionRequest)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentPermissionRequestProxy::GetTypes(nsIArray** aTypes)
|
nsContentPermissionRequestProxy::GetType(nsACString & aType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
aType = mType;
|
||||||
if (ConvertPermissionRequestToArray(mPermissionRequests, types)) {
|
return NS_OK;
|
||||||
types.forget(aTypes);
|
}
|
||||||
return NS_OK;
|
|
||||||
}
|
NS_IMETHODIMP
|
||||||
return NS_ERROR_FAILURE;
|
nsContentPermissionRequestProxy::GetAccess(nsACString & aAccess)
|
||||||
|
{
|
||||||
|
aAccess = mAccess;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -267,18 +136,10 @@ nsContentPermissionRequestProxy::Allow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
uint32_t len = mPermissionRequests.Length();
|
if (mType.Equals("audio-capture")) {
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
GonkPermissionService::GetInstance()->addGrantInfo(
|
||||||
if (mPermissionRequests[i].type().Equals("audio-capture")) {
|
"android.permission.RECORD_AUDIO",
|
||||||
GonkPermissionService::GetInstance()->addGrantInfo(
|
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
|
||||||
"android.permission.RECORD_AUDIO",
|
|
||||||
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
|
|
||||||
}
|
|
||||||
if (mPermissionRequests[i].type().Equals("video-capture")) {
|
|
||||||
GonkPermissionService::GetInstance()->addGrantInfo(
|
|
||||||
"android.permission.CAMERA",
|
|
||||||
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -286,3 +147,55 @@ nsContentPermissionRequestProxy::Allow()
|
|||||||
mParent = nullptr;
|
mParent = nullptr;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsACString& aType,
|
||||||
|
const nsACString& aAccess,
|
||||||
|
Element* aElement,
|
||||||
|
const IPC::Principal& aPrincipal)
|
||||||
|
{
|
||||||
|
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
||||||
|
|
||||||
|
mPrincipal = aPrincipal;
|
||||||
|
mElement = aElement;
|
||||||
|
mType = aType;
|
||||||
|
mAccess = aAccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentPermissionRequestParent::~ContentPermissionRequestParent()
|
||||||
|
{
|
||||||
|
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ContentPermissionRequestParent::Recvprompt()
|
||||||
|
{
|
||||||
|
mProxy = new nsContentPermissionRequestProxy();
|
||||||
|
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
||||||
|
if (NS_FAILED(mProxy->Init(mType, mAccess, this))) {
|
||||||
|
mProxy->Cancel();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
|
||||||
|
{
|
||||||
|
if (mProxy) {
|
||||||
|
mProxy->OnParentDestroyed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ContentPermissionRequestParent::IsBeingDestroyed()
|
||||||
|
{
|
||||||
|
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
|
||||||
|
// to send out any message now.
|
||||||
|
TabParent* tabParent = static_cast<TabParent*>(Manager());
|
||||||
|
return tabParent->IsDestroyed();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
@ -6,75 +6,60 @@
|
|||||||
#define nsContentPermissionHelper_h
|
#define nsContentPermissionHelper_h
|
||||||
|
|
||||||
#include "nsIContentPermissionPrompt.h"
|
#include "nsIContentPermissionPrompt.h"
|
||||||
#include "nsTArray.h"
|
#include "nsString.h"
|
||||||
#include "nsIMutableArray.h"
|
|
||||||
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||||
|
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||||
|
|
||||||
class nsContentPermissionRequestProxy;
|
class nsContentPermissionRequestProxy;
|
||||||
|
|
||||||
// Forward declare IPC::Principal here which is defined in
|
|
||||||
// PermissionMessageUtils.h. Include this file will transitively includes
|
|
||||||
// "windows.h" and it defines
|
|
||||||
// #define CreateEvent CreateEventW
|
|
||||||
// #define LoadImage LoadImageW
|
|
||||||
// That will mess up windows build.
|
|
||||||
namespace IPC {
|
|
||||||
class Principal;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class Element;
|
class Element;
|
||||||
class PermissionRequest;
|
|
||||||
class ContentPermissionRequestParent;
|
|
||||||
class PContentPermissionRequestParent;
|
|
||||||
|
|
||||||
class ContentPermissionType : public nsIContentPermissionType
|
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
ContentPermissionRequestParent(const nsACString& type,
|
||||||
NS_DECL_NSICONTENTPERMISSIONTYPE
|
const nsACString& access,
|
||||||
|
Element* element,
|
||||||
|
const IPC::Principal& principal);
|
||||||
|
virtual ~ContentPermissionRequestParent();
|
||||||
|
|
||||||
ContentPermissionType(const nsACString& aType, const nsACString& aAccess);
|
bool IsBeingDestroyed();
|
||||||
virtual ~ContentPermissionType();
|
|
||||||
|
|
||||||
protected:
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
|
nsCOMPtr<Element> mElement;
|
||||||
|
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
||||||
nsCString mType;
|
nsCString mType;
|
||||||
nsCString mAccess;
|
nsCString mAccess;
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual bool Recvprompt();
|
||||||
|
virtual void ActorDestroy(ActorDestroyReason why);
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
|
|
||||||
nsIMutableArray* aDesArray);
|
|
||||||
|
|
||||||
nsresult CreatePermissionArray(const nsACString& aType,
|
|
||||||
const nsACString& aAccess,
|
|
||||||
nsIArray** aTypesArray);
|
|
||||||
|
|
||||||
PContentPermissionRequestParent*
|
|
||||||
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
|
|
||||||
Element* element,
|
|
||||||
const IPC::Principal& principal);
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
|
class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
|
||||||
|
|
||||||
nsContentPermissionRequestProxy();
|
nsContentPermissionRequestProxy();
|
||||||
virtual ~nsContentPermissionRequestProxy();
|
virtual ~nsContentPermissionRequestProxy();
|
||||||
|
|
||||||
nsresult Init(const nsTArray<mozilla::dom::PermissionRequest>& requests,
|
nsresult Init(const nsACString& type, const nsACString& access, mozilla::dom::ContentPermissionRequestParent* parent);
|
||||||
mozilla::dom::ContentPermissionRequestParent* parent);
|
|
||||||
void OnParentDestroyed();
|
void OnParentDestroyed();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy.
|
// Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy.
|
||||||
mozilla::dom::ContentPermissionRequestParent* mParent;
|
mozilla::dom::ContentPermissionRequestParent* mParent;
|
||||||
nsTArray<mozilla::dom::PermissionRequest> mPermissionRequests;
|
nsCString mType;
|
||||||
|
nsCString mAccess;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsContentPermissionHelper_h
|
#endif // nsContentPermissionHelper_h
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "nsIStringBundle.h"
|
#include "nsIStringBundle.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "nsContentPermissionHelper.h"
|
|
||||||
|
|
||||||
#include "mozilla/dom/DeviceStorageBinding.h"
|
#include "mozilla/dom/DeviceStorageBinding.h"
|
||||||
|
|
||||||
@ -1734,14 +1733,17 @@ nsDOMDeviceStorageCursor::GetStorageType(nsAString & aType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMDeviceStorageCursor::GetTypes(nsIArray** aTypes)
|
nsDOMDeviceStorageCursor::GetType(nsACString & aType)
|
||||||
{
|
{
|
||||||
nsCString type;
|
return DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
|
||||||
nsresult rv =
|
aType);
|
||||||
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
return CreatePermissionArray(type, NS_LITERAL_CSTRING("read"), aTypes);
|
NS_IMETHODIMP
|
||||||
|
nsDOMDeviceStorageCursor::GetAccess(nsACString & aAccess)
|
||||||
|
{
|
||||||
|
aAccess = NS_LITERAL_CSTRING("read");
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -2249,10 +2251,8 @@ public:
|
|||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
nsTArray<PermissionRequest> permArray;
|
|
||||||
permArray.AppendElement(PermissionRequest(type, access));
|
|
||||||
child->SendPContentPermissionRequestConstructor(
|
child->SendPContentPermissionRequestConstructor(
|
||||||
this, permArray, IPC::Principal(mPrincipal));
|
this, type, access, IPC::Principal(mPrincipal));
|
||||||
|
|
||||||
Sendprompt();
|
Sendprompt();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -2266,23 +2266,26 @@ public:
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP GetTypes(nsIArray** aTypes)
|
NS_IMETHOD GetType(nsACString & aType)
|
||||||
{
|
{
|
||||||
nsCString type;
|
nsCString type;
|
||||||
nsresult rv =
|
nsresult rv
|
||||||
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
|
= DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
|
||||||
|
aType);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsCString access;
|
NS_IMETHOD GetAccess(nsACString & aAccess)
|
||||||
rv = DeviceStorageTypeChecker::GetAccessForRequest(
|
{
|
||||||
DeviceStorageRequestType(mRequestType), access);
|
nsresult rv = DeviceStorageTypeChecker::GetAccessForRequest(
|
||||||
|
DeviceStorageRequestType(mRequestType), aAccess);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
return NS_OK;
|
||||||
return CreatePermissionArray(type, access, aTypes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
NS_IMETHOD GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
||||||
@ -3296,10 +3299,8 @@ nsDOMDeviceStorage::EnumerateInternal(const nsAString& aPath,
|
|||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
nsTArray<PermissionRequest> permArray;
|
child->SendPContentPermissionRequestConstructor(r, type,
|
||||||
permArray.AppendElement(PermissionRequest(type, NS_LITERAL_CSTRING("read")));
|
NS_LITERAL_CSTRING("read"),
|
||||||
child->SendPContentPermissionRequestConstructor(r,
|
|
||||||
permArray,
|
|
||||||
IPC::Principal(mPrincipal));
|
IPC::Principal(mPrincipal));
|
||||||
|
|
||||||
r->Sendprompt();
|
r->Sendprompt();
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
interface nsIPrincipal;
|
interface nsIPrincipal;
|
||||||
interface nsIDOMWindow;
|
interface nsIDOMWindow;
|
||||||
interface nsIDOMElement;
|
interface nsIDOMElement;
|
||||||
interface nsIArray;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface provides the request type and its access.
|
* Interface allows access to a content to request
|
||||||
|
* permission to perform a privileged operation such as
|
||||||
|
* geolocation.
|
||||||
*/
|
*/
|
||||||
[scriptable, builtinclass, uuid(384b6cc4-a66b-4bea-98e0-eb10562a9ba4)]
|
[scriptable, uuid(1de67000-2de8-11e2-81c1-0800200c9a66)]
|
||||||
interface nsIContentPermissionType : nsISupports {
|
interface nsIContentPermissionRequest : nsISupports {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the permission request, such as
|
* The type of the permission request, such as
|
||||||
* "geolocation".
|
* "geolocation".
|
||||||
@ -25,22 +27,8 @@ interface nsIContentPermissionType : nsISupports {
|
|||||||
* "read".
|
* "read".
|
||||||
*/
|
*/
|
||||||
readonly attribute ACString access;
|
readonly attribute ACString access;
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface allows access to a content to request
|
|
||||||
* permission to perform a privileged operation such as
|
|
||||||
* geolocation.
|
|
||||||
*/
|
|
||||||
[scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)]
|
|
||||||
interface nsIContentPermissionRequest : nsISupports {
|
|
||||||
/**
|
/**
|
||||||
* The array will include the request types. Elements of this array are
|
|
||||||
* nsIContentPermissionType object.
|
|
||||||
*/
|
|
||||||
readonly attribute nsIArray types;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The principal of the permission request.
|
* The principal of the permission request.
|
||||||
*/
|
*/
|
||||||
readonly attribute nsIPrincipal principal;
|
readonly attribute nsIPrincipal principal;
|
||||||
|
@ -16,7 +16,6 @@ include protocol PIndexedDB;
|
|||||||
include DOMTypes;
|
include DOMTypes;
|
||||||
include JavaScriptTypes;
|
include JavaScriptTypes;
|
||||||
include URIParams;
|
include URIParams;
|
||||||
include PContentPermission;
|
|
||||||
|
|
||||||
|
|
||||||
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
||||||
@ -207,8 +206,10 @@ parent:
|
|||||||
* Initiates an asynchronous request for permission for the
|
* Initiates an asynchronous request for permission for the
|
||||||
* provided principal.
|
* provided principal.
|
||||||
*
|
*
|
||||||
* @param aRequests
|
* @param aType
|
||||||
* The array of permissions to request.
|
* The type of permission to request.
|
||||||
|
* @param aAccess
|
||||||
|
* Access type. "read" for example.
|
||||||
* @param aPrincipal
|
* @param aPrincipal
|
||||||
* The principal of the request.
|
* The principal of the request.
|
||||||
*
|
*
|
||||||
@ -216,7 +217,7 @@ parent:
|
|||||||
* principals that can live in the content process should
|
* principals that can live in the content process should
|
||||||
* provided.
|
* provided.
|
||||||
*/
|
*/
|
||||||
PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal);
|
PContentPermissionRequest(nsCString aType, nsCString aAccess, Principal principal);
|
||||||
|
|
||||||
PContentDialog(uint32_t aType, nsCString aName, nsCString aFeatures,
|
PContentDialog(uint32_t aType, nsCString aName, nsCString aFeatures,
|
||||||
int32_t[] aIntParams, nsString[] aStringParams);
|
int32_t[] aIntParams, nsString[] aStringParams);
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
struct PermissionRequest {
|
|
||||||
nsCString type;
|
|
||||||
nsCString access;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
@ -1157,11 +1157,12 @@ TabChild::ArraysToParams(const InfallibleTArray<int>& aIntParams,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
PContentPermissionRequestChild*
|
PContentPermissionRequestChild*
|
||||||
TabChild:: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
TabChild:: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||||
const InfallibleTArray<PermissionRequest>& aRequests,
|
const nsCString& aType,
|
||||||
|
const nsCString& aAccess,
|
||||||
const IPC::Principal& aPrincipal)
|
const IPC::Principal& aPrincipal)
|
||||||
{
|
{
|
||||||
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
||||||
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aRequests, aPrincipal);
|
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
||||||
child->mIPCOpen = true;
|
child->mIPCOpen = true;
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
@ -2013,8 +2014,7 @@ TabChild::DeallocPContentDialogChild(PContentDialogChild* aDialog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PContentPermissionRequestChild*
|
PContentPermissionRequestChild*
|
||||||
TabChild::AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
|
TabChild::AllocPContentPermissionRequestChild(const nsCString& aType, const nsCString& aAccess, const IPC::Principal&)
|
||||||
const IPC::Principal& aPrincipal)
|
|
||||||
{
|
{
|
||||||
NS_RUNTIMEABORT("unused");
|
NS_RUNTIMEABORT("unused");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -278,11 +278,13 @@ public:
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
virtual PContentPermissionRequestChild*
|
virtual PContentPermissionRequestChild*
|
||||||
SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
||||||
const InfallibleTArray<PermissionRequest>& aRequests,
|
const nsCString& aType,
|
||||||
|
const nsCString& aAccess,
|
||||||
const IPC::Principal& aPrincipal);
|
const IPC::Principal& aPrincipal);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
|
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType,
|
||||||
|
const nsCString& aAccess,
|
||||||
const IPC::Principal& aPrincipal);
|
const IPC::Principal& aPrincipal);
|
||||||
virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor);
|
virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor);
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "mozilla/BrowserElementParent.h"
|
#include "mozilla/BrowserElementParent.h"
|
||||||
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
|
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
|
||||||
#include "mozilla/dom/ContentParent.h"
|
#include "mozilla/dom/ContentParent.h"
|
||||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
|
||||||
#include "mozilla/Hal.h"
|
#include "mozilla/Hal.h"
|
||||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||||
#include "mozilla/layers/CompositorParent.h"
|
#include "mozilla/layers/CompositorParent.h"
|
||||||
@ -580,10 +579,9 @@ TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PContentPermissionRequestParent*
|
PContentPermissionRequestParent*
|
||||||
TabParent::AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
|
TabParent::AllocPContentPermissionRequestParent(const nsCString& type, const nsCString& access, const IPC::Principal& principal)
|
||||||
const IPC::Principal& aPrincipal)
|
|
||||||
{
|
{
|
||||||
return CreateContentPermissionRequestParent(aRequests, mFrameElement, aPrincipal);
|
return new ContentPermissionRequestParent(type, access, mFrameElement, principal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -225,8 +225,7 @@ public:
|
|||||||
virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor);
|
virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor);
|
||||||
|
|
||||||
virtual PContentPermissionRequestParent*
|
virtual PContentPermissionRequestParent*
|
||||||
AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
|
AllocPContentPermissionRequestParent(const nsCString& aType, const nsCString& aAccess, const IPC::Principal& aPrincipal);
|
||||||
const IPC::Principal& aPrincipal);
|
|
||||||
virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor);
|
virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor);
|
||||||
|
|
||||||
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent(
|
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent(
|
||||||
|
@ -68,7 +68,6 @@ IPDL_SOURCES += [
|
|||||||
'PBrowser.ipdl',
|
'PBrowser.ipdl',
|
||||||
'PContent.ipdl',
|
'PContent.ipdl',
|
||||||
'PContentDialog.ipdl',
|
'PContentDialog.ipdl',
|
||||||
'PContentPermission.ipdlh',
|
|
||||||
'PContentPermissionRequest.ipdl',
|
'PContentPermissionRequest.ipdl',
|
||||||
'PCrashReporter.ipdl',
|
'PCrashReporter.ipdl',
|
||||||
'PDocumentRenderer.ipdl',
|
'PDocumentRenderer.ipdl',
|
||||||
|
@ -386,11 +386,17 @@ nsGeolocationRequest::GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGeolocationRequest::GetTypes(nsIArray** aTypes)
|
nsGeolocationRequest::GetType(nsACString & aType)
|
||||||
{
|
{
|
||||||
return CreatePermissionArray(NS_LITERAL_CSTRING("geolocation"),
|
aType = "geolocation";
|
||||||
NS_LITERAL_CSTRING("unused"),
|
return NS_OK;
|
||||||
aTypes);
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGeolocationRequest::GetAccess(nsACString & aAccess)
|
||||||
|
{
|
||||||
|
aAccess = "unused";
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -1447,15 +1453,12 @@ Geolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTArray<PermissionRequest> permArray;
|
|
||||||
permArray.AppendElement(PermissionRequest(NS_LITERAL_CSTRING("geolocation"),
|
|
||||||
NS_LITERAL_CSTRING("unused")));
|
|
||||||
|
|
||||||
// Retain a reference so the object isn't deleted without IPDL's knowledge.
|
// Retain a reference so the object isn't deleted without IPDL's knowledge.
|
||||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||||
request->AddRef();
|
request->AddRef();
|
||||||
child->SendPContentPermissionRequestConstructor(request,
|
child->SendPContentPermissionRequestConstructor(request,
|
||||||
permArray,
|
NS_LITERAL_CSTRING("geolocation"),
|
||||||
|
NS_LITERAL_CSTRING("unused"),
|
||||||
IPC::Principal(mPrincipal));
|
IPC::Principal(mPrincipal));
|
||||||
|
|
||||||
request->Sendprompt();
|
request->Sendprompt();
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "PCOMContentPermissionRequestChild.h"
|
#include "PCOMContentPermissionRequestChild.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "PermissionMessageUtils.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
@ -180,12 +179,9 @@ DesktopNotification::Init()
|
|||||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||||
nsRefPtr<DesktopNotificationRequest> copy = request;
|
nsRefPtr<DesktopNotificationRequest> copy = request;
|
||||||
|
|
||||||
nsTArray<PermissionRequest> permArray;
|
|
||||||
permArray.AppendElement(PermissionRequest(
|
|
||||||
NS_LITERAL_CSTRING("desktop-notification"),
|
|
||||||
NS_LITERAL_CSTRING("unused")));
|
|
||||||
child->SendPContentPermissionRequestConstructor(copy.forget().get(),
|
child->SendPContentPermissionRequestConstructor(copy.forget().get(),
|
||||||
permArray,
|
NS_LITERAL_CSTRING("desktop-notification"),
|
||||||
|
NS_LITERAL_CSTRING("unused"),
|
||||||
IPC::Principal(mPrincipal));
|
IPC::Principal(mPrincipal));
|
||||||
|
|
||||||
request->Sendprompt();
|
request->Sendprompt();
|
||||||
@ -357,11 +353,17 @@ DesktopNotificationRequest::Allow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DesktopNotificationRequest::GetTypes(nsIArray** aTypes)
|
DesktopNotificationRequest::GetType(nsACString & aType)
|
||||||
{
|
{
|
||||||
return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
|
aType = "desktop-notification";
|
||||||
NS_LITERAL_CSTRING("unused"),
|
return NS_OK;
|
||||||
aTypes);
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
DesktopNotificationRequest::GetAccess(nsACString & aAccess)
|
||||||
|
{
|
||||||
|
aAccess = "unused";
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "nsDOMJSUtils.h"
|
#include "nsDOMJSUtils.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||||
#include "nsContentPermissionHelper.h"
|
|
||||||
#ifdef MOZ_B2G
|
#ifdef MOZ_B2G
|
||||||
#include "nsIDOMDesktopNotification.h"
|
#include "nsIDOMDesktopNotification.h"
|
||||||
#endif
|
#endif
|
||||||
@ -268,11 +267,9 @@ NotificationPermissionRequest::Run()
|
|||||||
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
// Corresponding release occurs in DeallocPContentPermissionRequest.
|
||||||
AddRef();
|
AddRef();
|
||||||
|
|
||||||
nsTArray<PermissionRequest> permArray;
|
NS_NAMED_LITERAL_CSTRING(type, "desktop-notification");
|
||||||
permArray.AppendElement(PermissionRequest(
|
NS_NAMED_LITERAL_CSTRING(access, "unused");
|
||||||
NS_LITERAL_CSTRING("desktop-notification"),
|
child->SendPContentPermissionRequestConstructor(this, type, access,
|
||||||
NS_LITERAL_CSTRING("unused")));
|
|
||||||
child->SendPContentPermissionRequestConstructor(this, permArray,
|
|
||||||
IPC::Principal(mPrincipal));
|
IPC::Principal(mPrincipal));
|
||||||
|
|
||||||
Sendprompt();
|
Sendprompt();
|
||||||
@ -345,11 +342,17 @@ NotificationPermissionRequest::CallCallback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
NotificationPermissionRequest::GetTypes(nsIArray** aTypes)
|
NotificationPermissionRequest::GetAccess(nsACString& aAccess)
|
||||||
{
|
{
|
||||||
return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
|
aAccess.AssignLiteral("unused");
|
||||||
NS_LITERAL_CSTRING("unused"),
|
return NS_OK;
|
||||||
aTypes);
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
NotificationPermissionRequest::GetType(nsACString& aType)
|
||||||
|
{
|
||||||
|
aType.AssignLiteral("desktop-notification");
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user