diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 60ffc02f5d71..6a4d68ff9369 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -215,8 +215,6 @@ #include "mozilla/dom/XPathEvaluator.h" #include "nsIDocumentEncoder.h" #include "nsIStructuredCloneContainer.h" -#include "nsIMutableArray.h" -#include "nsContentPermissionHelper.h" using namespace mozilla; using namespace mozilla::dom; @@ -10649,11 +10647,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPointerLockPermissionRequest, nsIContentPermissionRequest) NS_IMETHODIMP -nsPointerLockPermissionRequest::GetTypes(nsIArray** aTypes) +nsPointerLockPermissionRequest::GetType(nsACString& aType) { - return CreatePermissionArray(NS_LITERAL_CSTRING("pointerLock"), - NS_LITERAL_CSTRING("unused"), - aTypes); + aType = "pointerLock"; + return NS_OK; +} + +NS_IMETHODIMP +nsPointerLockPermissionRequest::GetAccess(nsACString& aAccess) +{ + aAccess = "unused"; + return NS_OK; } NS_IMETHODIMP diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp index 50510512970d..b4b3c87dca5a 100644 --- a/dom/base/nsContentPermissionHelper.cpp +++ b/dom/base/nsContentPermissionHelper.cpp @@ -2,155 +2,19 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "nsContentPermissionHelper.h" +#include "nsIContentPermissionPrompt.h" #include "nsCOMPtr.h" #include "nsIDOMElement.h" #include "nsIPrincipal.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/unused.h" #include "nsComponentManagerUtils.h" -#include "nsArrayUtils.h" -#include "nsIMutableArray.h" -#include "nsContentPermissionHelper.h" using mozilla::unused; // using namespace mozilla::dom; -namespace mozilla { -namespace dom { - -class ContentPermissionRequestParent : public PContentPermissionRequestParent -{ - public: - ContentPermissionRequestParent(const nsTArray& aRequests, - Element* element, - const IPC::Principal& principal); - virtual ~ContentPermissionRequestParent(); - - bool IsBeingDestroyed(); - - nsCOMPtr mPrincipal; - nsCOMPtr mElement; - nsCOMPtr mProxy; - nsTArray mRequests; - - private: - virtual bool Recvprompt(); - virtual void ActorDestroy(ActorDestroyReason why); -}; - -ContentPermissionRequestParent::ContentPermissionRequestParent(const nsTArray& 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(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& aSrcArray, - nsIMutableArray* aDesArray) -{ - uint32_t len = aSrcArray.Length(); - for (uint32_t i = 0; i < len; i++) { - nsRefPtr 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 types = do_CreateInstance(NS_ARRAY_CONTRACTID); - nsRefPtr permType = new ContentPermissionType(aType, - aAccess); - types->AppendElement(permType, false); - types.forget(aTypesArray); - - return NS_OK; -} - -PContentPermissionRequestParent* -CreateContentPermissionRequestParent(const nsTArray& aRequests, - Element* element, - const IPC::Principal& principal) -{ - return new ContentPermissionRequestParent(aRequests, element, principal); -} - -} // namespace dom -} // namespace mozilla - nsContentPermissionRequestProxy::nsContentPermissionRequestProxy() { MOZ_COUNT_CTOR(nsContentPermissionRequestProxy); @@ -162,12 +26,14 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy() } nsresult -nsContentPermissionRequestProxy::Init(const nsTArray& requests, +nsContentPermissionRequestProxy::Init(const nsACString & type, + const nsACString & access, ContentPermissionRequestParent* parent) { NS_ASSERTION(parent, "null parent"); mParent = parent; - mPermissionRequests = requests; + mType = type; + mAccess = access; nsCOMPtr prompt = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID); if (!prompt) { @@ -187,14 +53,17 @@ nsContentPermissionRequestProxy::OnParentDestroyed() NS_IMPL_ISUPPORTS1(nsContentPermissionRequestProxy, nsIContentPermissionRequest) NS_IMETHODIMP -nsContentPermissionRequestProxy::GetTypes(nsIArray** aTypes) +nsContentPermissionRequestProxy::GetType(nsACString & aType) { - nsCOMPtr types = do_CreateInstance(NS_ARRAY_CONTRACTID); - if (ConvertPermissionRequestToArray(mPermissionRequests, types)) { - types.forget(aTypes); - return NS_OK; - } - return NS_ERROR_FAILURE; + aType = mType; + return NS_OK; +} + +NS_IMETHODIMP +nsContentPermissionRequestProxy::GetAccess(nsACString & aAccess) +{ + aAccess = mAccess; + return NS_OK; } NS_IMETHODIMP @@ -265,3 +134,55 @@ nsContentPermissionRequestProxy::Allow() mParent = nullptr; 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(Manager()); + return tabParent->IsDestroyed(); +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/base/nsContentPermissionHelper.h b/dom/base/nsContentPermissionHelper.h index 1baf2768b92b..9a750c6efb57 100644 --- a/dom/base/nsContentPermissionHelper.h +++ b/dom/base/nsContentPermissionHelper.h @@ -6,75 +6,60 @@ #define nsContentPermissionHelper_h #include "nsIContentPermissionPrompt.h" -#include "nsTArray.h" -#include "nsIMutableArray.h" +#include "nsString.h" + +#include "mozilla/dom/PermissionMessageUtils.h" +#include "mozilla/dom/PContentPermissionRequestParent.h" 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 dom { class Element; -class PermissionRequest; -class ContentPermissionRequestParent; -class PContentPermissionRequestParent; -class ContentPermissionType : public nsIContentPermissionType +class ContentPermissionRequestParent : public PContentPermissionRequestParent { -public: - NS_DECL_ISUPPORTS - NS_DECL_NSICONTENTPERMISSIONTYPE + public: + ContentPermissionRequestParent(const nsACString& type, + const nsACString& access, + Element* element, + const IPC::Principal& principal); + virtual ~ContentPermissionRequestParent(); - ContentPermissionType(const nsACString& aType, const nsACString& aAccess); - virtual ~ContentPermissionType(); + bool IsBeingDestroyed(); -protected: + nsCOMPtr mPrincipal; + nsCOMPtr mElement; + nsCOMPtr mProxy; nsCString mType; nsCString mAccess; + + private: + virtual bool Recvprompt(); + virtual void ActorDestroy(ActorDestroyReason why); }; -uint32_t ConvertPermissionRequestToArray(nsTArray& aSrcArray, - nsIMutableArray* aDesArray); - -nsresult CreatePermissionArray(const nsACString& aType, - const nsACString& aAccess, - nsIArray** aTypesArray); - -PContentPermissionRequestParent* -CreateContentPermissionRequestParent(const nsTArray& aRequests, - Element* element, - const IPC::Principal& principal); - } // namespace dom } // namespace mozilla class nsContentPermissionRequestProxy : public nsIContentPermissionRequest { public: - NS_DECL_ISUPPORTS - NS_DECL_NSICONTENTPERMISSIONREQUEST - nsContentPermissionRequestProxy(); virtual ~nsContentPermissionRequestProxy(); - nsresult Init(const nsTArray& requests, - mozilla::dom::ContentPermissionRequestParent* parent); + nsresult Init(const nsACString& type, const nsACString& access, mozilla::dom::ContentPermissionRequestParent* parent); void OnParentDestroyed(); + NS_DECL_ISUPPORTS + NS_DECL_NSICONTENTPERMISSIONREQUEST + private: // Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy. mozilla::dom::ContentPermissionRequestParent* mParent; - nsTArray mPermissionRequests; + nsCString mType; + nsCString mAccess; }; - #endif // nsContentPermissionHelper_h + diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 5659fb0176a8..9c503523e258 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -49,7 +49,6 @@ #include "nsIStringBundle.h" #include "nsIDocument.h" #include -#include "nsContentPermissionHelper.h" #include "mozilla/dom/DeviceStorageBinding.h" @@ -1696,14 +1695,17 @@ nsDOMDeviceStorageCursor::GetStorageType(nsAString & aType) } NS_IMETHODIMP -nsDOMDeviceStorageCursor::GetTypes(nsIArray** aTypes) +nsDOMDeviceStorageCursor::GetType(nsACString & aType) { - nsCString type; - nsresult rv = - DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type); - NS_ENSURE_SUCCESS(rv, rv); + return DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, + aType); +} - return CreatePermissionArray(type, NS_LITERAL_CSTRING("read"), aTypes); +NS_IMETHODIMP +nsDOMDeviceStorageCursor::GetAccess(nsACString & aAccess) +{ + aAccess = NS_LITERAL_CSTRING("read"); + return NS_OK; } NS_IMETHODIMP @@ -2178,10 +2180,8 @@ public: if (NS_FAILED(rv)) { return rv; } - nsTArray permArray; - permArray.AppendElement(PermissionRequest(type, access)); child->SendPContentPermissionRequestConstructor( - this, permArray, IPC::Principal(mPrincipal)); + this, type, access, IPC::Principal(mPrincipal)); Sendprompt(); return NS_OK; @@ -2195,23 +2195,26 @@ public: return NS_OK; } - NS_IMETHODIMP GetTypes(nsIArray** aTypes) + NS_IMETHOD GetType(nsACString & aType) { nsCString type; - nsresult rv = - DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type); + nsresult rv + = DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, + aType); if (NS_FAILED(rv)) { return rv; } + return NS_OK; + } - nsCString access; - rv = DeviceStorageTypeChecker::GetAccessForRequest( - DeviceStorageRequestType(mRequestType), access); + NS_IMETHOD GetAccess(nsACString & aAccess) + { + nsresult rv = DeviceStorageTypeChecker::GetAccessForRequest( + DeviceStorageRequestType(mRequestType), aAccess); if (NS_FAILED(rv)) { return rv; } - - return CreatePermissionArray(type, access, aTypes); + return NS_OK; } NS_IMETHOD GetPrincipal(nsIPrincipal * *aRequestingPrincipal) @@ -3188,10 +3191,8 @@ nsDOMDeviceStorage::EnumerateInternal(const nsAString& aPath, if (aRv.Failed()) { return nullptr; } - nsTArray permArray; - permArray.AppendElement(PermissionRequest(type, NS_LITERAL_CSTRING("read"))); - child->SendPContentPermissionRequestConstructor(r, - permArray, + child->SendPContentPermissionRequestConstructor(r, type, + NS_LITERAL_CSTRING("read"), IPC::Principal(mPrincipal)); r->Sendprompt(); diff --git a/dom/interfaces/base/nsIContentPermissionPrompt.idl b/dom/interfaces/base/nsIContentPermissionPrompt.idl index c51f5ed0bb72..0fdda0ea66e1 100644 --- a/dom/interfaces/base/nsIContentPermissionPrompt.idl +++ b/dom/interfaces/base/nsIContentPermissionPrompt.idl @@ -7,13 +7,15 @@ interface nsIPrincipal; interface nsIDOMWindow; 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)] -interface nsIContentPermissionType : nsISupports { +[scriptable, uuid(1de67000-2de8-11e2-81c1-0800200c9a66)] +interface nsIContentPermissionRequest : nsISupports { + /** * The type of the permission request, such as * "geolocation". @@ -25,22 +27,8 @@ interface nsIContentPermissionType : nsISupports { * "read". */ 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. */ readonly attribute nsIPrincipal principal; diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index b531ecb399c9..ea39cb6b26d0 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -16,7 +16,6 @@ include protocol PIndexedDB; include DOMTypes; include JavaScriptTypes; include URIParams; -include PContentPermission; using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h"; @@ -203,8 +202,10 @@ parent: * Initiates an asynchronous request for permission for the * provided principal. * - * @param aRequests - * The array of permissions to request. + * @param aType + * The type of permission to request. + * @param aAccess + * Access type. "read" for example. * @param aPrincipal * The principal of the request. * @@ -212,7 +213,7 @@ parent: * principals that can live in the content process should * provided. */ - PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal); + PContentPermissionRequest(nsCString aType, nsCString aAccess, Principal principal); PContentDialog(uint32_t aType, nsCString aName, nsCString aFeatures, int32_t[] aIntParams, nsString[] aStringParams); diff --git a/dom/ipc/PContentPermission.ipdlh b/dom/ipc/PContentPermission.ipdlh deleted file mode 100644 index 5db4f3b669f6..000000000000 --- a/dom/ipc/PContentPermission.ipdlh +++ /dev/null @@ -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 diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 0f402a2e338f..bba78399a77b 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1990,8 +1990,7 @@ TabChild::DeallocPContentDialogChild(PContentDialogChild* aDialog) } PContentPermissionRequestChild* -TabChild::AllocPContentPermissionRequestChild(const InfallibleTArray& aRequests, - const IPC::Principal& aPrincipal) +TabChild::AllocPContentPermissionRequestChild(const nsCString& aType, const nsCString& aAccess, const IPC::Principal&) { NS_RUNTIMEABORT("unused"); return nullptr; diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 971e9196fb23..cdfbc6271768 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -271,17 +271,19 @@ public: #ifdef DEBUG virtual PContentPermissionRequestChild* SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor, - const InfallibleTArray& aRequests, + const nsCString& aType, + const nsCString& aAccess, const IPC::Principal& aPrincipal) { PCOMContentPermissionRequestChild* child = static_cast(aActor); - PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aRequests, aPrincipal); + PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal); child->mIPCOpen = true; return request; } #endif /* DEBUG */ - virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const InfallibleTArray& aRequests, + virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType, + const nsCString& aAccess, const IPC::Principal& aPrincipal); virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor); diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index f9f8e3dc39d4..863445a92ddc 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -14,7 +14,6 @@ #include "mozilla/BrowserElementParent.h" #include "mozilla/docshell/OfflineCacheUpdateParent.h" #include "mozilla/dom/ContentParent.h" -#include "mozilla/dom/PContentPermissionRequestParent.h" #include "mozilla/Hal.h" #include "mozilla/ipc/DocumentRendererParent.h" #include "mozilla/layers/CompositorParent.h" @@ -571,10 +570,9 @@ TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor) } PContentPermissionRequestParent* -TabParent::AllocPContentPermissionRequestParent(const InfallibleTArray& aRequests, - const IPC::Principal& aPrincipal) +TabParent::AllocPContentPermissionRequestParent(const nsCString& type, const nsCString& access, const IPC::Principal& principal) { - return CreateContentPermissionRequestParent(aRequests, mFrameElement, aPrincipal); + return new ContentPermissionRequestParent(type, access, mFrameElement, principal); } bool diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 9928052af711..bfbc9644ebc8 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -215,8 +215,7 @@ public: virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor); virtual PContentPermissionRequestParent* - AllocPContentPermissionRequestParent(const InfallibleTArray& aRequests, - const IPC::Principal& aPrincipal); + AllocPContentPermissionRequestParent(const nsCString& aType, const nsCString& aAccess, const IPC::Principal& aPrincipal); virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor); virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent( diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 59aa034dcbee..254f7038be49 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -64,7 +64,6 @@ IPDL_SOURCES += [ 'PBrowser.ipdl', 'PContent.ipdl', 'PContentDialog.ipdl', - 'PContentPermission.ipdlh', 'PContentPermissionRequest.ipdl', 'PCrashReporter.ipdl', 'PDocumentRenderer.ipdl', diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index 36b67e3cf3a3..dde32decc69f 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -15,7 +15,6 @@ #include "nsServiceManagerUtils.h" #include "nsContentUtils.h" #include "nsCxPusher.h" -#include "nsContentPermissionHelper.h" #include "nsIDocument.h" #include "nsIObserverService.h" #include "nsPIDOMWindow.h" @@ -386,11 +385,17 @@ nsGeolocationRequest::GetPrincipal(nsIPrincipal * *aRequestingPrincipal) } NS_IMETHODIMP -nsGeolocationRequest::GetTypes(nsIArray** aTypes) +nsGeolocationRequest::GetType(nsACString & aType) { - return CreatePermissionArray(NS_LITERAL_CSTRING("geolocation"), - NS_LITERAL_CSTRING("unused"), - aTypes); + aType = "geolocation"; + return NS_OK; +} + +NS_IMETHODIMP +nsGeolocationRequest::GetAccess(nsACString & aAccess) +{ + aAccess = "unused"; + return NS_OK; } NS_IMETHODIMP @@ -1447,15 +1452,12 @@ Geolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request) return false; } - nsTArray 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. // Corresponding release occurs in DeallocPContentPermissionRequest. request->AddRef(); child->SendPContentPermissionRequestConstructor(request, - permArray, + NS_LITERAL_CSTRING("geolocation"), + NS_LITERAL_CSTRING("unused"), IPC::Principal(mPrincipal)); request->Sendprompt(); diff --git a/dom/src/notification/DesktopNotification.cpp b/dom/src/notification/DesktopNotification.cpp index 57c47a14d35a..15fe3be9c34b 100644 --- a/dom/src/notification/DesktopNotification.cpp +++ b/dom/src/notification/DesktopNotification.cpp @@ -177,12 +177,9 @@ DesktopNotification::Init() // Corresponding release occurs in DeallocPContentPermissionRequest. nsRefPtr copy = request; - nsTArray permArray; - permArray.AppendElement(PermissionRequest( - NS_LITERAL_CSTRING("desktop-notification"), - NS_LITERAL_CSTRING("unused"))); child->SendPContentPermissionRequestConstructor(copy.forget().get(), - permArray, + NS_LITERAL_CSTRING("desktop-notification"), + NS_LITERAL_CSTRING("unused"), IPC::Principal(mPrincipal)); request->Sendprompt(); @@ -354,11 +351,17 @@ DesktopNotificationRequest::Allow() } NS_IMETHODIMP -DesktopNotificationRequest::GetTypes(nsIArray** aTypes) +DesktopNotificationRequest::GetType(nsACString & aType) { - return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"), - NS_LITERAL_CSTRING("unused"), - aTypes); + aType = "desktop-notification"; + return NS_OK; +} + +NS_IMETHODIMP +DesktopNotificationRequest::GetAccess(nsACString & aAccess) +{ + aAccess = "unused"; + return NS_OK; } } // namespace dom diff --git a/dom/src/notification/Notification.cpp b/dom/src/notification/Notification.cpp index 4a4edc8a1345..7f4de6d609aa 100644 --- a/dom/src/notification/Notification.cpp +++ b/dom/src/notification/Notification.cpp @@ -24,7 +24,6 @@ #include "nsDOMJSUtils.h" #include "nsIScriptSecurityManager.h" #include "mozilla/dom/PermissionMessageUtils.h" -#include "nsContentPermissionHelper.h" #ifdef MOZ_B2G #include "nsIDOMDesktopNotification.h" #endif @@ -268,11 +267,9 @@ NotificationPermissionRequest::Run() // Corresponding release occurs in DeallocPContentPermissionRequest. AddRef(); - nsTArray permArray; - permArray.AppendElement(PermissionRequest( - NS_LITERAL_CSTRING("desktop-notification"), - NS_LITERAL_CSTRING("unused"))); - child->SendPContentPermissionRequestConstructor(this, permArray, + NS_NAMED_LITERAL_CSTRING(type, "desktop-notification"); + NS_NAMED_LITERAL_CSTRING(access, "unused"); + child->SendPContentPermissionRequestConstructor(this, type, access, IPC::Principal(mPrincipal)); Sendprompt(); @@ -345,11 +342,17 @@ NotificationPermissionRequest::CallCallback() } NS_IMETHODIMP -NotificationPermissionRequest::GetTypes(nsIArray** aTypes) +NotificationPermissionRequest::GetAccess(nsACString& aAccess) { - return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"), - NS_LITERAL_CSTRING("unused"), - aTypes); + aAccess.AssignLiteral("unused"); + return NS_OK; +} + +NS_IMETHODIMP +NotificationPermissionRequest::GetType(nsACString& aType) +{ + aType.AssignLiteral("desktop-notification"); + return NS_OK; } bool