зеркало из https://github.com/mozilla/gecko-dev.git
bug 1477409 - Part 1 - Instead of passing tabId, passing outerWindowId to Payment UI component. r=baku
--HG-- extra : histedit_source : 5480494582d1de6bcdac2ff295815d3182909697
This commit is contained in:
Родитель
cd9a46a8d0
Коммит
7020e04316
|
@ -81,7 +81,7 @@ interface nsIPaymentOptions : nsISupports
|
|||
[scriptable, builtinclass, uuid(2fa36783-d684-4487-b7a8-9def6ae3128f)]
|
||||
interface nsIPaymentRequest : nsISupports
|
||||
{
|
||||
readonly attribute uint64_t tabId;
|
||||
readonly attribute uint64_t topOuterWindowId;
|
||||
readonly attribute nsIPrincipal topLevelPrincipal;
|
||||
readonly attribute AString requestId;
|
||||
readonly attribute AString completeStatus;
|
||||
|
|
|
@ -3217,7 +3217,7 @@ TabParent::DeallocPPluginWidgetParent(mozilla::plugins::PPluginWidgetParent* aAc
|
|||
PPaymentRequestParent*
|
||||
TabParent::AllocPPaymentRequestParent()
|
||||
{
|
||||
RefPtr<PaymentRequestParent> actor = new PaymentRequestParent(GetTabId());
|
||||
RefPtr<PaymentRequestParent> actor = new PaymentRequestParent();
|
||||
return actor.forget().take();
|
||||
}
|
||||
|
||||
|
|
|
@ -674,14 +674,14 @@ PaymentOptions::GetShippingType(nsAString& aShippingType)
|
|||
NS_IMPL_ISUPPORTS(PaymentRequest,
|
||||
nsIPaymentRequest)
|
||||
|
||||
PaymentRequest::PaymentRequest(const uint64_t aTabId,
|
||||
PaymentRequest::PaymentRequest(const uint64_t aTopOuterWindowId,
|
||||
const nsAString& aRequestId,
|
||||
nsIPrincipal* aTopLevelPrincipal,
|
||||
nsIArray* aPaymentMethods,
|
||||
nsIPaymentDetails* aPaymentDetails,
|
||||
nsIPaymentOptions* aPaymentOptions,
|
||||
const nsAString& aShippingOption)
|
||||
: mTabId(aTabId)
|
||||
: mTopOuterWindowId(aTopOuterWindowId)
|
||||
, mRequestId(aRequestId)
|
||||
, mTopLevelPrincipal(aTopLevelPrincipal)
|
||||
, mPaymentMethods(aPaymentMethods)
|
||||
|
@ -693,10 +693,10 @@ PaymentRequest::PaymentRequest(const uint64_t aTabId,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PaymentRequest::GetTabId(uint64_t* aTabId)
|
||||
PaymentRequest::GetTopOuterWindowId(uint64_t* aTopOuterWindowId)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTabId);
|
||||
*aTabId = mTabId;
|
||||
NS_ENSURE_ARG_POINTER(aTopOuterWindowId);
|
||||
*aTopOuterWindowId = mTopOuterWindowId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPAYMENTREQUEST
|
||||
|
||||
PaymentRequest(const uint64_t aTabId,
|
||||
PaymentRequest(const uint64_t aTopOuterWindowId,
|
||||
const nsAString& aRequestId,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIArray* aPaymentMethods,
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
private:
|
||||
~PaymentRequest() = default;
|
||||
|
||||
uint64_t mTabId;
|
||||
uint64_t mTopOuterWindowId;
|
||||
nsString mRequestId;
|
||||
nsString mCompleteStatus;
|
||||
nsCOMPtr<nsIPrincipal> mTopLevelPrincipal;
|
||||
|
|
|
@ -463,7 +463,15 @@ PaymentRequestManager::CreatePayment(JSContext* aCx,
|
|||
IPCPaymentOptions options;
|
||||
ConvertOptions(aOptions, options);
|
||||
|
||||
IPCPaymentCreateActionRequest action(internalId,
|
||||
nsCOMPtr<nsPIDOMWindowOuter> outerWindow = aWindow->GetOuterWindow();
|
||||
MOZ_ASSERT(outerWindow);
|
||||
if (nsCOMPtr<nsPIDOMWindowOuter> topOuterWindow = outerWindow->GetTop()) {
|
||||
outerWindow = topOuterWindow;
|
||||
}
|
||||
uint64_t topOuterWindowId = outerWindow->WindowID();
|
||||
|
||||
IPCPaymentCreateActionRequest action(topOuterWindowId,
|
||||
internalId,
|
||||
IPC::Principal(aTopLevelPrincipal),
|
||||
methodData,
|
||||
details,
|
||||
|
|
|
@ -234,7 +234,6 @@ PaymentRequestService::RequestPayment(const nsAString& aRequestId,
|
|||
case IPCPaymentActionRequest::TIPCPaymentCreateActionRequest: {
|
||||
MOZ_ASSERT(!request);
|
||||
const IPCPaymentCreateActionRequest& action = aAction;
|
||||
uint64_t tabId = aIPC->GetTabId();
|
||||
nsCOMPtr<nsIMutableArray> methodData = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
MOZ_ASSERT(methodData);
|
||||
for (IPCPaymentMethodData data : action.methodData()) {
|
||||
|
@ -251,7 +250,7 @@ PaymentRequestService::RequestPayment(const nsAString& aRequestId,
|
|||
rv = payments::PaymentOptions::Create(action.options(), getter_AddRefs(options));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
RefPtr<payments::PaymentRequest> request =
|
||||
new payments::PaymentRequest(tabId,
|
||||
new payments::PaymentRequest(action.topOuterWindowId(),
|
||||
aRequestId,
|
||||
action.topLevelPrincipal(),
|
||||
methodData,
|
||||
|
|
|
@ -70,6 +70,7 @@ struct IPCPaymentOptions
|
|||
|
||||
struct IPCPaymentCreateActionRequest
|
||||
{
|
||||
uint64_t topOuterWindowId;
|
||||
nsString requestId;
|
||||
Principal topLevelPrincipal;
|
||||
IPCPaymentMethodData[] methodData;
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
PaymentRequestParent::PaymentRequestParent(uint64_t aTabId)
|
||||
PaymentRequestParent::PaymentRequestParent()
|
||||
: mActorAlive(true)
|
||||
, mTabId(aTabId)
|
||||
, mRequestId(EmptyString())
|
||||
{
|
||||
}
|
||||
|
@ -88,12 +87,6 @@ PaymentRequestParent::RecvRequestPayment(const IPCPaymentActionRequest& aRequest
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
uint64_t
|
||||
PaymentRequestParent::GetTabId()
|
||||
{
|
||||
return mTabId;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PaymentRequestParent::RespondPayment(nsIPaymentActionResponse* aResponse)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,8 @@ class PaymentRequestParent final : public PPaymentRequestParent
|
|||
{
|
||||
NS_INLINE_DECL_REFCOUNTING(PaymentRequestParent)
|
||||
public:
|
||||
explicit PaymentRequestParent(uint64_t aTabId);
|
||||
PaymentRequestParent();
|
||||
|
||||
uint64_t GetTabId();
|
||||
nsresult RespondPayment(nsIPaymentActionResponse* aResponse);
|
||||
nsresult ChangeShippingAddress(const nsAString& aRequestId,
|
||||
nsIPaymentAddress* aAddress);
|
||||
|
@ -47,7 +46,6 @@ private:
|
|||
nsIPaymentResponseData* aData);
|
||||
|
||||
bool mActorAlive;
|
||||
uint64_t mTabId;
|
||||
nsString mRequestId;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче