mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 1614462: Part 1 - Remove unused message principals. r=nika
These were added for the sake of app browsers, and all of the code which actually needed them has since been removed. Differential Revision: https://phabricator.services.mozilla.com/D70741
This commit is contained in:
parent
65f33dc1b9
commit
4660e2ccc6
@ -46,8 +46,8 @@ InProcessBrowserChildMessageManager::Create(nsDocShell* aShell,
|
||||
|
||||
bool InProcessBrowserChildMessageManager::DoSendBlockingMessage(
|
||||
JSContext* aCx, const nsAString& aMessage, StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal, bool aIsSync) {
|
||||
JS::Handle<JSObject*> aCpows, nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) {
|
||||
SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
|
||||
queue->Flush();
|
||||
|
||||
@ -55,8 +55,8 @@ bool InProcessBrowserChildMessageManager::DoSendBlockingMessage(
|
||||
SameProcessCpowHolder cpows(JS::RootingContext::get(aCx), aCpows);
|
||||
RefPtr<nsFrameMessageManager> mm = mChromeMessageManager;
|
||||
RefPtr<nsFrameLoader> fl = GetFrameLoader();
|
||||
mm->ReceiveMessage(mOwner, fl, aMessage, true, &aData, &cpows, aPrincipal,
|
||||
aRetVal, IgnoreErrors());
|
||||
mm->ReceiveMessage(mOwner, fl, aMessage, true, &aData, &cpows, aRetVal,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -81,13 +81,13 @@ class nsAsyncMessageToParent : public nsSameProcessAsyncMessageBase,
|
||||
|
||||
nsresult InProcessBrowserChildMessageManager::DoSendAsyncMessage(
|
||||
JSContext* aCx, const nsAString& aMessage, StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
|
||||
JS::RootingContext* rcx = JS::RootingContext::get(aCx);
|
||||
RefPtr<nsAsyncMessageToParent> ev =
|
||||
new nsAsyncMessageToParent(rcx, aCpows, this);
|
||||
|
||||
nsresult rv = ev->Init(aMessage, aData, aPrincipal);
|
||||
nsresult rv = ev->Init(aMessage, aData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -76,13 +76,11 @@ class InProcessBrowserChildMessageManager final
|
||||
virtual bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) override;
|
||||
virtual nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override;
|
||||
JS::Handle<JSObject*> aCpows) override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
|
||||
|
@ -30,7 +30,7 @@ class MessageBroadcaster : public MessageListenerManager {
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
mozilla::ErrorResult& aError) {
|
||||
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
|
||||
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects,
|
||||
JS::UndefinedHandleValue, aError);
|
||||
}
|
||||
uint32_t ChildCount() { return mChildManagers.Length(); }
|
||||
|
@ -59,14 +59,13 @@ class MessageManagerGlobal {
|
||||
void SendAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JS::Value> aTransfers, ErrorResult& aError) {
|
||||
if (!mMessageManager) {
|
||||
aError.Throw(NS_ERROR_NOT_INITIALIZED);
|
||||
return;
|
||||
}
|
||||
mMessageManager->SendAsyncMessage(aCx, aMessageName, aObj, aObjects,
|
||||
aPrincipal, aTransfers, aError);
|
||||
aTransfers, aError);
|
||||
}
|
||||
already_AddRefed<ProcessMessageManager> GetProcessMessageManager(
|
||||
mozilla::ErrorResult& aError) {
|
||||
@ -88,25 +87,25 @@ class MessageManagerGlobal {
|
||||
// SyncMessageSender
|
||||
void SendSyncMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsTArray<JS::Value>& aResult, ErrorResult& aError) {
|
||||
if (!mMessageManager) {
|
||||
aError.Throw(NS_ERROR_NOT_INITIALIZED);
|
||||
return;
|
||||
}
|
||||
mMessageManager->SendSyncMessage(aCx, aMessageName, aObj, aObjects,
|
||||
aPrincipal, aResult, aError);
|
||||
mMessageManager->SendSyncMessage(aCx, aMessageName, aObj, aObjects, aResult,
|
||||
aError);
|
||||
}
|
||||
void SendRpcMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsTArray<JS::Value>& aResult, ErrorResult& aError) {
|
||||
if (!mMessageManager) {
|
||||
aError.Throw(NS_ERROR_NOT_INITIALIZED);
|
||||
return;
|
||||
}
|
||||
mMessageManager->SendRpcMessage(aCx, aMessageName, aObj, aObjects,
|
||||
aPrincipal, aResult, aError);
|
||||
mMessageManager->SendRpcMessage(aCx, aMessageName, aObj, aObjects, aResult,
|
||||
aError);
|
||||
}
|
||||
|
||||
// MessageManagerGlobal
|
||||
|
@ -2824,8 +2824,7 @@ class nsAsyncMessageToChild : public nsSameProcessAsyncMessageBase,
|
||||
nsresult nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
auto* browserParent = GetBrowserParent();
|
||||
if (browserParent) {
|
||||
ClonedMessageData data;
|
||||
@ -2839,8 +2838,7 @@ nsresult nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
|
||||
if (aCpows && (!mgr || !mgr->Wrap(aCx, aCpows, &cpows))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (browserParent->SendAsyncMessage(nsString(aMessage), cpows, aPrincipal,
|
||||
data)) {
|
||||
if (browserParent->SendAsyncMessage(nsString(aMessage), cpows, data)) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@ -2851,7 +2849,7 @@ nsresult nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
|
||||
JS::RootingContext* rcx = JS::RootingContext::get(aCx);
|
||||
RefPtr<nsAsyncMessageToChild> ev =
|
||||
new nsAsyncMessageToChild(rcx, aCpows, this);
|
||||
nsresult rv = ev->Init(aMessage, aData, aPrincipal);
|
||||
nsresult rv = ev->Init(aMessage, aData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||
virtual nsresult DoSendAsyncMessage(
|
||||
JSContext* aCx, const nsAString& aMessage,
|
||||
mozilla::dom::ipc::StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal) override;
|
||||
JS::Handle<JSObject*> aCpows) override;
|
||||
|
||||
/**
|
||||
* Called from the layout frame associated with this frame loader;
|
||||
|
@ -446,8 +446,8 @@ static bool AllowMessage(size_t aDataLength, const nsAString& aMessageName) {
|
||||
|
||||
void nsFrameMessageManager::SendMessage(
|
||||
JSContext* aCx, const nsAString& aMessageName, JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal, bool aIsSync,
|
||||
nsTArray<JS::Value>& aResult, ErrorResult& aError) {
|
||||
JS::Handle<JSObject*> aObjects, bool aIsSync, nsTArray<JS::Value>& aResult,
|
||||
ErrorResult& aError) {
|
||||
NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
|
||||
NS_ASSERTION(!IsBroadcaster(), "Should not call SendSyncMessage in chrome");
|
||||
NS_ASSERTION(!GetParentManager(),
|
||||
@ -491,7 +491,7 @@ void nsFrameMessageManager::SendMessage(
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
sSendingSyncMessage |= aIsSync;
|
||||
bool ok = mCallback->DoSendBlockingMessage(aCx, aMessageName, data, aObjects,
|
||||
aPrincipal, &retval, aIsSync);
|
||||
&retval, aIsSync);
|
||||
if (aIsSync) {
|
||||
sSendingSyncMessage = false;
|
||||
}
|
||||
@ -526,12 +526,12 @@ void nsFrameMessageManager::SendMessage(
|
||||
|
||||
nsresult nsFrameMessageManager::DispatchAsyncMessageInternal(
|
||||
JSContext* aCx, const nsAString& aMessage, StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
if (mIsBroadcaster) {
|
||||
uint32_t len = mChildManagers.Length();
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
mChildManagers[i]->DispatchAsyncMessageInternal(aCx, aMessage, aData,
|
||||
aCpows, aPrincipal);
|
||||
aCpows);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -540,8 +540,7 @@ nsresult nsFrameMessageManager::DispatchAsyncMessageInternal(
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
mCallback->DoSendAsyncMessage(aCx, aMessage, aData, aCpows, aPrincipal);
|
||||
nsresult rv = mCallback->DoSendAsyncMessage(aCx, aMessage, aData, aCpows);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -550,8 +549,8 @@ nsresult nsFrameMessageManager::DispatchAsyncMessageInternal(
|
||||
|
||||
void nsFrameMessageManager::DispatchAsyncMessage(
|
||||
JSContext* aCx, const nsAString& aMessageName, JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JS::Value> aTransfers, ErrorResult& aError) {
|
||||
JS::Handle<JSObject*> aObjects, JS::Handle<JS::Value> aTransfers,
|
||||
ErrorResult& aError) {
|
||||
StructuredCloneData data;
|
||||
if (!aObj.isUndefined() &&
|
||||
!GetParamsForMessage(aCx, aObj, aTransfers, data)) {
|
||||
@ -570,8 +569,7 @@ void nsFrameMessageManager::DispatchAsyncMessage(
|
||||
return;
|
||||
}
|
||||
|
||||
aError = DispatchAsyncMessageInternal(aCx, aMessageName, data, aObjects,
|
||||
aPrincipal);
|
||||
aError = DispatchAsyncMessageInternal(aCx, aMessageName, data, aObjects);
|
||||
}
|
||||
|
||||
class MMListenerRemover {
|
||||
@ -596,8 +594,8 @@ class MMListenerRemover {
|
||||
void nsFrameMessageManager::ReceiveMessage(
|
||||
nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader, bool aTargetClosed,
|
||||
const nsAString& aMessage, bool aIsSync, StructuredCloneData* aCloneData,
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal, ErrorResult& aError) {
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsTArray<StructuredCloneData>* aRetVal,
|
||||
ErrorResult& aError) {
|
||||
MOZ_ASSERT(aTarget);
|
||||
|
||||
nsAutoTObserverArray<nsMessageListenerInfo, 1>* listeners =
|
||||
@ -696,7 +694,6 @@ void nsFrameMessageManager::ReceiveMessage(
|
||||
}
|
||||
|
||||
argument.mName = aMessage;
|
||||
argument.mPrincipal = aPrincipal;
|
||||
argument.mSync = aIsSync;
|
||||
argument.mTarget = aTarget;
|
||||
if (aTargetFrameLoader) {
|
||||
@ -804,7 +801,7 @@ void nsFrameMessageManager::ReceiveMessage(
|
||||
if (kungFuDeathGrip) {
|
||||
kungFuDeathGrip->ReceiveMessage(aTarget, aTargetFrameLoader, aTargetClosed,
|
||||
aMessage, aIsSync, aCloneData, aCpows,
|
||||
aPrincipal, aRetVal, aError);
|
||||
aRetVal, aError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1383,13 +1380,12 @@ class SameParentProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
|
||||
nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override {
|
||||
JS::Handle<JSObject*> aCpows) override {
|
||||
JS::RootingContext* rcx = JS::RootingContext::get(aCx);
|
||||
RefPtr<nsAsyncMessageToSameProcessChild> ev =
|
||||
new nsAsyncMessageToSameProcessChild(rcx, aCpows);
|
||||
|
||||
nsresult rv = ev->Init(aMessage, aData, aPrincipal);
|
||||
nsresult rv = ev->Init(aMessage, aData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -1416,7 +1412,6 @@ class ChildProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) override {
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
@ -1433,16 +1428,15 @@ class ChildProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
}
|
||||
if (aIsSync) {
|
||||
return cc->SendSyncMessage(PromiseFlatString(aMessage), data, cpows,
|
||||
IPC::Principal(aPrincipal), aRetVal);
|
||||
aRetVal);
|
||||
}
|
||||
return cc->SendRpcMessage(PromiseFlatString(aMessage), data, cpows,
|
||||
IPC::Principal(aPrincipal), aRetVal);
|
||||
aRetVal);
|
||||
}
|
||||
|
||||
nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override {
|
||||
JS::Handle<JSObject*> aCpows) override {
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
if (!cc) {
|
||||
return NS_OK;
|
||||
@ -1455,8 +1449,7 @@ class ChildProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
if (aCpows && !cc->GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!cc->SendAsyncMessage(PromiseFlatString(aMessage), cpows,
|
||||
IPC::Principal(aPrincipal), data)) {
|
||||
if (!cc->SendAsyncMessage(PromiseFlatString(aMessage), cpows, data)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -1494,7 +1487,6 @@ class SameChildProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) override {
|
||||
SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
|
||||
@ -1504,21 +1496,20 @@ class SameChildProcessMessageManagerCallback : public MessageManagerCallback {
|
||||
SameProcessCpowHolder cpows(JS::RootingContext::get(aCx), aCpows);
|
||||
RefPtr<nsFrameMessageManager> ppm =
|
||||
nsFrameMessageManager::sSameProcessParentManager;
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMessage, true, &aData, &cpows,
|
||||
aPrincipal, aRetVal, IgnoreErrors());
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMessage, true, &aData, &cpows, aRetVal,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override {
|
||||
JS::Handle<JSObject*> aCpows) override {
|
||||
SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
|
||||
JS::RootingContext* rcx = JS::RootingContext::get(aCx);
|
||||
RefPtr<nsAsyncMessageToSameProcessParent> ev =
|
||||
new nsAsyncMessageToSameProcessParent(rcx, aCpows);
|
||||
nsresult rv = ev->Init(aMessage, aData, aPrincipal);
|
||||
nsresult rv = ev->Init(aMessage, aData);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -1612,8 +1603,7 @@ nsSameProcessAsyncMessageBase::nsSameProcessAsyncMessageBase(
|
||||
}
|
||||
|
||||
nsresult nsSameProcessAsyncMessageBase::Init(const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
StructuredCloneData& aData) {
|
||||
if (!mData.Copy(aData)) {
|
||||
Telemetry::Accumulate(Telemetry::IPC_SAME_PROCESS_MESSAGE_COPY_OOM_KB,
|
||||
aData.DataLength());
|
||||
@ -1621,7 +1611,6 @@ nsresult nsSameProcessAsyncMessageBase::Init(const nsAString& aMessage,
|
||||
}
|
||||
|
||||
mMessage = aMessage;
|
||||
mPrincipal = aPrincipal;
|
||||
#ifdef DEBUG
|
||||
mCalledInit = true;
|
||||
#endif
|
||||
@ -1639,6 +1628,6 @@ void nsSameProcessAsyncMessageBase::ReceiveMessage(
|
||||
|
||||
RefPtr<nsFrameMessageManager> mm = aManager;
|
||||
mm->ReceiveMessage(aTarget, aTargetFrameLoader, mMessage, false, &mData,
|
||||
&cpows, mPrincipal, nullptr, IgnoreErrors());
|
||||
&cpows, nullptr, IgnoreErrors());
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,6 @@ class MessageManagerCallback {
|
||||
virtual bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) {
|
||||
return true;
|
||||
@ -95,8 +94,7 @@ class MessageManagerCallback {
|
||||
|
||||
virtual nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -193,11 +191,9 @@ class nsFrameMessageManager : public nsIMessageSender {
|
||||
void SendAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JS::Value> aTransfers,
|
||||
mozilla::ErrorResult& aError) {
|
||||
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, aPrincipal,
|
||||
aTransfers, aError);
|
||||
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, aTransfers, aError);
|
||||
}
|
||||
already_AddRefed<mozilla::dom::ProcessMessageManager>
|
||||
GetProcessMessageManager(mozilla::ErrorResult& aError);
|
||||
@ -207,19 +203,17 @@ class nsFrameMessageManager : public nsIMessageSender {
|
||||
// SyncMessageSender
|
||||
void SendSyncMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsTArray<JS::Value>& aResult,
|
||||
mozilla::ErrorResult& aError) {
|
||||
SendMessage(aCx, aMessageName, aObj, aObjects, aPrincipal, true, aResult,
|
||||
aError);
|
||||
SendMessage(aCx, aMessageName, aObj, aObjects, true, aResult, aError);
|
||||
}
|
||||
void SendRpcMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects, nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsTArray<JS::Value>& aResult,
|
||||
mozilla::ErrorResult& aError) {
|
||||
SendMessage(aCx, aMessageName, aObj, aObjects, aPrincipal, false, aResult,
|
||||
aError);
|
||||
SendMessage(aCx, aMessageName, aObj, aObjects, false, aResult, aError);
|
||||
}
|
||||
|
||||
// GlobalProcessScriptLoader
|
||||
@ -238,11 +232,10 @@ class nsFrameMessageManager : public nsIMessageSender {
|
||||
const nsAString& aMessage, bool aIsSync,
|
||||
StructuredCloneData* aCloneData,
|
||||
mozilla::jsipc::CpowHolder* aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
mozilla::ErrorResult& aError) {
|
||||
ReceiveMessage(aTarget, aTargetFrameLoader, mClosed, aMessage, aIsSync,
|
||||
aCloneData, aCpows, aPrincipal, aRetVal, aError);
|
||||
aCloneData, aCpows, aRetVal, aError);
|
||||
}
|
||||
|
||||
void Disconnect(bool aRemoveFromParent = true);
|
||||
@ -255,8 +248,7 @@ class nsFrameMessageManager : public nsIMessageSender {
|
||||
nsresult DispatchAsyncMessageInternal(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal);
|
||||
JS::Handle<JSObject*> aCpows);
|
||||
bool IsGlobal() { return mGlobal; }
|
||||
bool IsBroadcaster() { return mIsBroadcaster; }
|
||||
bool IsChrome() { return mChrome; }
|
||||
@ -295,20 +287,18 @@ class nsFrameMessageManager : public nsIMessageSender {
|
||||
void DispatchAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj,
|
||||
JS::Handle<JSObject*> aObjects,
|
||||
nsIPrincipal* aPrincipal,
|
||||
JS::Handle<JS::Value> aTransfers,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
void SendMessage(JSContext* aCx, const nsAString& aMessageName,
|
||||
JS::Handle<JS::Value> aObj, JS::Handle<JSObject*> aObjects,
|
||||
nsIPrincipal* aPrincipal, bool aIsSync,
|
||||
nsTArray<JS::Value>& aResult, mozilla::ErrorResult& aError);
|
||||
bool aIsSync, nsTArray<JS::Value>& aResult,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
|
||||
bool aTargetClosed, const nsAString& aMessage,
|
||||
bool aIsSync, StructuredCloneData* aCloneData,
|
||||
mozilla::jsipc::CpowHolder* aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
@ -376,8 +366,7 @@ class nsSameProcessAsyncMessageBase {
|
||||
|
||||
nsSameProcessAsyncMessageBase(JS::RootingContext* aRootingCx,
|
||||
JS::Handle<JSObject*> aCpows);
|
||||
nsresult Init(const nsAString& aMessage, StructuredCloneData& aData,
|
||||
nsIPrincipal* aPrincipal);
|
||||
nsresult Init(const nsAString& aMessage, StructuredCloneData& aData);
|
||||
|
||||
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
|
||||
nsFrameMessageManager* aManager);
|
||||
@ -388,7 +377,6 @@ class nsSameProcessAsyncMessageBase {
|
||||
nsString mMessage;
|
||||
StructuredCloneData mData;
|
||||
JS::PersistentRooted<JSObject*> mCpows;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
#ifdef DEBUG
|
||||
bool mCalledInit;
|
||||
#endif
|
||||
@ -431,7 +419,6 @@ class nsMessageManagerScriptExecutor {
|
||||
bool Init();
|
||||
void Trace(const TraceCallbacks& aCallbacks, void* aClosure);
|
||||
void Unlink();
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
AutoTArray<JS::Heap<JSObject*>, 2> mAnonymousGlobalScopes;
|
||||
|
||||
// Returns true if this is a process message manager. There should only be a
|
||||
|
@ -26,7 +26,6 @@ support-files =
|
||||
[test_anchor_target_blank_referrer.html]
|
||||
[test_domrequesthelper.xhtml]
|
||||
[test_fragment_sanitization.xhtml]
|
||||
[test_messagemanager_principal.html]
|
||||
[test_messagemanager_send_principal.html]
|
||||
[test_mozbrowser_apis_allowed.html]
|
||||
[test_navigator_resolve_identity_xrays.xhtml]
|
||||
|
@ -1,88 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Principal in MessageManager</title>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
var permManager = Cc["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Ci.nsIPermissionManager);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const childFrameURL =
|
||||
"data:text/html,<!DOCTYPE HTML><html><body></body></html>";
|
||||
|
||||
function childFrameScript() {
|
||||
"use strict";
|
||||
|
||||
addMessageListener("test:ipcMessage", function(message) {
|
||||
sendAsyncMessage(message.name, "principal: " + (message.principal ? "OK" : "KO"));
|
||||
|
||||
sendAsyncMessage(message.name, "principal.origin: " +
|
||||
("origin" in message.principal ? "OK" : "KO"));
|
||||
|
||||
sendAsyncMessage(message.name, "principal.isInIsolatedMozBrowserElement: " +
|
||||
("isInIsolatedMozBrowserElement" in message.principal ? "OK" : "KO"));
|
||||
|
||||
sendAsyncMessage(message.name, "DONE");
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
ok("Browser prefs set.");
|
||||
|
||||
let iframe = document.createElement("iframe");
|
||||
SpecialPowers.wrap(iframe).mozbrowser = true;
|
||||
iframe.id = "iframe";
|
||||
iframe.src = childFrameURL;
|
||||
|
||||
iframe.addEventListener("mozbrowserloadend", function() {
|
||||
ok(true, "Got iframe load event.");
|
||||
|
||||
let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
|
||||
mm.addMessageListener("test:ipcMessage", function(message) {
|
||||
// We need to wrap to access message.json, and unwrap to do the
|
||||
// identity check.
|
||||
var msg = SpecialPowers.unwrap(SpecialPowers.wrap(message).json);
|
||||
if (/OK$/.exec(msg)) {
|
||||
ok(true, msg);
|
||||
} else if(/KO$/.exec(msg)) {
|
||||
ok(true, false);
|
||||
} else if (/DONE/.exec(msg)) {
|
||||
permManager.removeFromPrincipal(window.document.nodePrincipal, "browser",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
mm.loadFrameScript("data:,(" + childFrameScript.toString() + ")();",
|
||||
false);
|
||||
|
||||
mm.sendAsyncMessage("test:ipcMessage", 42, null, window.document.nodePrincipal);
|
||||
});
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
addEventListener("load", function() {
|
||||
info("Got load event.");
|
||||
|
||||
permManager.addFromPrincipal(window.document.nodePrincipal, "browser",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true],
|
||||
["browser.pagethumbnails.capturing_disabled", true]
|
||||
]
|
||||
}, runTests);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -195,11 +195,6 @@ dictionary ReceiveMessageArgument
|
||||
|
||||
sequence<MessagePort> ports;
|
||||
|
||||
/**
|
||||
* Principal for the window app.
|
||||
*/
|
||||
required Principal? principal;
|
||||
|
||||
FrameLoader targetFrameLoader;
|
||||
};
|
||||
|
||||
@ -316,7 +311,6 @@ interface mixin MessageSenderMixin {
|
||||
void sendAsyncMessage(optional DOMString? messageName = null,
|
||||
optional any obj,
|
||||
optional object? objects = null,
|
||||
optional Principal? principal = null,
|
||||
optional any transfers);
|
||||
|
||||
/**
|
||||
@ -357,8 +351,7 @@ interface mixin SyncMessageSenderMixin
|
||||
[Throws]
|
||||
sequence<any> sendSyncMessage(optional DOMString? messageName = null,
|
||||
optional any obj,
|
||||
optional object? objects = null,
|
||||
optional Principal? principal = null);
|
||||
optional object? objects = null);
|
||||
|
||||
/**
|
||||
* Like |sendSyncMessage()|, except re-entrant. New RPC messages may be
|
||||
@ -372,8 +365,7 @@ interface mixin SyncMessageSenderMixin
|
||||
[Throws]
|
||||
sequence<any> sendRpcMessage(optional DOMString? messageName = null,
|
||||
optional any obj,
|
||||
optional object? objects = null,
|
||||
optional Principal? principal = null);
|
||||
optional object? objects = null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -201,7 +201,7 @@ void BrowserChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
|
||||
mBrowserChildMessageManager);
|
||||
RefPtr<nsFrameMessageManager> mm = kungFuDeathGrip->GetMessageManager();
|
||||
mm->ReceiveMessage(static_cast<EventTarget*>(kungFuDeathGrip), nullptr,
|
||||
aMessageName, false, &data, nullptr, nullptr, nullptr,
|
||||
aMessageName, false, &data, nullptr, nullptr,
|
||||
IgnoreErrors());
|
||||
}
|
||||
|
||||
@ -2198,7 +2198,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvLoadRemoteScript(
|
||||
|
||||
mozilla::ipc::IPCResult BrowserChild::RecvAsyncMessage(
|
||||
const nsString& aMessage, nsTArray<CpowEntry>&& aCpows,
|
||||
nsIPrincipal* aPrincipal, const ClonedMessageData& aData) {
|
||||
const ClonedMessageData& aData) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("BrowserChild::RecvAsyncMessage",
|
||||
OTHER, aMessage);
|
||||
MMPrinter::Print("BrowserChild::RecvAsyncMessage", aMessage, aData);
|
||||
@ -2224,8 +2224,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvAsyncMessage(
|
||||
StructuredCloneData data;
|
||||
UnpackClonedMessageDataForChild(aData, data);
|
||||
mm->ReceiveMessage(static_cast<EventTarget*>(mBrowserChildMessageManager),
|
||||
nullptr, aMessage, false, &data, &cpows, aPrincipal,
|
||||
nullptr, IgnoreErrors());
|
||||
nullptr, aMessage, false, &data, &cpows, nullptr,
|
||||
IgnoreErrors());
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
@ -2952,10 +2952,12 @@ void BrowserChild::SetTabId(const TabId& aTabId) {
|
||||
NestedBrowserChildMap()[mUniqueId] = this;
|
||||
}
|
||||
|
||||
bool BrowserChild::DoSendBlockingMessage(
|
||||
JSContext* aCx, const nsAString& aMessage, StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal, bool aIsSync) {
|
||||
bool BrowserChild::DoSendBlockingMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) {
|
||||
ClonedMessageData data;
|
||||
if (!BuildClonedMessageDataForChild(Manager(), aData, data)) {
|
||||
return false;
|
||||
@ -2968,19 +2970,16 @@ bool BrowserChild::DoSendBlockingMessage(
|
||||
}
|
||||
}
|
||||
if (aIsSync) {
|
||||
return SendSyncMessage(PromiseFlatString(aMessage), data, cpows, aPrincipal,
|
||||
aRetVal);
|
||||
return SendSyncMessage(PromiseFlatString(aMessage), data, cpows, aRetVal);
|
||||
}
|
||||
|
||||
return SendRpcMessage(PromiseFlatString(aMessage), data, cpows, aPrincipal,
|
||||
aRetVal);
|
||||
return SendRpcMessage(PromiseFlatString(aMessage), data, cpows, aRetVal);
|
||||
}
|
||||
|
||||
nsresult BrowserChild::DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
ClonedMessageData data;
|
||||
if (!BuildClonedMessageDataForChild(Manager(), aData, data)) {
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
@ -2992,7 +2991,7 @@ nsresult BrowserChild::DoSendAsyncMessage(JSContext* aCx,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
if (!SendAsyncMessage(PromiseFlatString(aMessage), cpows, aPrincipal, data)) {
|
||||
if (!SendAsyncMessage(PromiseFlatString(aMessage), cpows, data)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -227,7 +227,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
||||
return mBrowserChildMessageManager->WrapObject(aCx, aGivenProto);
|
||||
}
|
||||
|
||||
nsIPrincipal* GetPrincipal() { return mPrincipal; }
|
||||
// Get the Document for the top-level window in this tab.
|
||||
already_AddRefed<Document> GetTopLevelDocument() const;
|
||||
|
||||
@ -246,14 +245,12 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
||||
virtual bool DoSendBlockingMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal,
|
||||
bool aIsSync) override;
|
||||
|
||||
virtual nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override;
|
||||
JS::Handle<JSObject*> aCpows) override;
|
||||
|
||||
bool DoUpdateZoomConstraints(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
@ -417,7 +414,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMessage,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const ClonedMessageData& aData);
|
||||
mozilla::ipc::IPCResult RecvSwappedWithOtherRemoteLoader(
|
||||
const IPCTabContext& aContext);
|
||||
|
@ -2034,8 +2034,7 @@ bool BrowserParent::SendHandleTap(TapType aType,
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvSyncMessage(
|
||||
const nsString& aMessage, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal) {
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetVal) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("BrowserParent::RecvSyncMessage",
|
||||
OTHER, aMessage);
|
||||
MMPrinter::Print("BrowserParent::RecvSyncMessage", aMessage, aData);
|
||||
@ -2044,7 +2043,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvSyncMessage(
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
CrossProcessCpowHolder cpows(Manager(), aCpows);
|
||||
if (!ReceiveMessage(aMessage, true, &data, &cpows, aPrincipal, aRetVal)) {
|
||||
if (!ReceiveMessage(aMessage, true, &data, &cpows, aRetVal)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
@ -2052,8 +2051,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvSyncMessage(
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvRpcMessage(
|
||||
const nsString& aMessage, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetVal) {
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetVal) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("BrowserParent::RecvRpcMessage",
|
||||
OTHER, aMessage);
|
||||
MMPrinter::Print("BrowserParent::RecvRpcMessage", aMessage, aData);
|
||||
@ -2062,7 +2060,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvRpcMessage(
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
CrossProcessCpowHolder cpows(Manager(), aCpows);
|
||||
if (!ReceiveMessage(aMessage, true, &data, &cpows, aPrincipal, aRetVal)) {
|
||||
if (!ReceiveMessage(aMessage, true, &data, &cpows, aRetVal)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
@ -2070,7 +2068,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvRpcMessage(
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvAsyncMessage(
|
||||
const nsString& aMessage, nsTArray<CpowEntry>&& aCpows,
|
||||
nsIPrincipal* aPrincipal, const ClonedMessageData& aData) {
|
||||
const ClonedMessageData& aData) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("BrowserParent::RecvAsyncMessage",
|
||||
OTHER, aMessage);
|
||||
MMPrinter::Print("BrowserParent::RecvAsyncMessage", aMessage, aData);
|
||||
@ -2079,7 +2077,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvAsyncMessage(
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
CrossProcessCpowHolder cpows(Manager(), aCpows);
|
||||
if (!ReceiveMessage(aMessage, false, &data, &cpows, aPrincipal, nullptr)) {
|
||||
if (!ReceiveMessage(aMessage, false, &data, &cpows, nullptr)) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
@ -3266,7 +3264,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvDispatchFocusToTopLevelWindow() {
|
||||
|
||||
bool BrowserParent::ReceiveMessage(const nsString& aMessage, bool aSync,
|
||||
StructuredCloneData* aData,
|
||||
CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
CpowHolder* aCpows,
|
||||
nsTArray<StructuredCloneData>* aRetVal) {
|
||||
// If we're for an oop iframe, don't deliver messages to the wrong place.
|
||||
if (mBrowserBridgeParent) {
|
||||
@ -3279,7 +3277,7 @@ bool BrowserParent::ReceiveMessage(const nsString& aMessage, bool aSync,
|
||||
frameLoader->GetFrameMessageManager();
|
||||
|
||||
manager->ReceiveMessage(mFrameElement, frameLoader, aMessage, aSync, aData,
|
||||
aCpows, aPrincipal, aRetVal, IgnoreErrors());
|
||||
aCpows, aRetVal, IgnoreErrors());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -345,17 +345,16 @@ class BrowserParent final : public PBrowserParent,
|
||||
|
||||
mozilla::ipc::IPCResult RecvSyncMessage(
|
||||
const nsString& aMessage, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
nsTArray<ipc::StructuredCloneData>* aRetVal);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRpcMessage(
|
||||
const nsString& aMessage, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, nsIPrincipal* aPrincipal,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
nsTArray<ipc::StructuredCloneData>* aRetVal);
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMessage,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const ClonedMessageData& aData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyIMEFocus(
|
||||
@ -751,7 +750,7 @@ class BrowserParent final : public PBrowserParent,
|
||||
|
||||
bool ReceiveMessage(
|
||||
const nsString& aMessage, bool aSync, ipc::StructuredCloneData* aData,
|
||||
mozilla::jsipc::CpowHolder* aCpows, nsIPrincipal* aPrincipal,
|
||||
mozilla::jsipc::CpowHolder* aCpows,
|
||||
nsTArray<ipc::StructuredCloneData>* aJSONRetVal = nullptr);
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncAuthPrompt(const nsCString& aUri,
|
||||
|
@ -2356,7 +2356,7 @@ mozilla::ipc::IPCResult ContentChild::RecvLoadProcessScript(
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvAsyncMessage(
|
||||
const nsString& aMsg, nsTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal, const ClonedMessageData& aData) {
|
||||
const ClonedMessageData& aData) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("ContentChild::RecvAsyncMessage",
|
||||
OTHER, aMsg);
|
||||
MMPrinter::Print("ContentChild::RecvAsyncMessage", aMsg, aData);
|
||||
@ -2367,8 +2367,8 @@ mozilla::ipc::IPCResult ContentChild::RecvAsyncMessage(
|
||||
if (cpm) {
|
||||
StructuredCloneData data;
|
||||
ipc::UnpackClonedMessageDataForChild(aData, data);
|
||||
cpm->ReceiveMessage(cpm, nullptr, aMsg, false, &data, &cpows, aPrincipal,
|
||||
nullptr, IgnoreErrors());
|
||||
cpm->ReceiveMessage(cpm, nullptr, aMsg, false, &data, &cpows, nullptr,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -343,7 +343,6 @@ class ContentChild final
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal,
|
||||
const ClonedMessageData& aData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRegisterStringBundles(
|
||||
|
@ -1545,9 +1545,9 @@ void ContentParent::ShutDownMessageManager() {
|
||||
return;
|
||||
}
|
||||
|
||||
mMessageManager->ReceiveMessage(
|
||||
mMessageManager, nullptr, CHILD_PROCESS_SHUTDOWN_MESSAGE, false, nullptr,
|
||||
nullptr, nullptr, nullptr, IgnoreErrors());
|
||||
mMessageManager->ReceiveMessage(mMessageManager, nullptr,
|
||||
CHILD_PROCESS_SHUTDOWN_MESSAGE, false,
|
||||
nullptr, nullptr, nullptr, IgnoreErrors());
|
||||
|
||||
mMessageManager->SetOsPid(-1);
|
||||
mMessageManager->Disconnect();
|
||||
@ -3908,8 +3908,7 @@ mozilla::ipc::IPCResult ContentParent::RecvNotificationEvent(
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvSyncMessage(
|
||||
const nsString& aMsg, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, const IPC::Principal& aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetvals) {
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetvals) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("ContentParent::RecvSyncMessage",
|
||||
OTHER, aMsg);
|
||||
MMPrinter::Print("ContentParent::RecvSyncMessage", aMsg, aData);
|
||||
@ -3920,16 +3919,15 @@ mozilla::ipc::IPCResult ContentParent::RecvSyncMessage(
|
||||
ipc::StructuredCloneData data;
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, true, &data, &cpows, aPrincipal,
|
||||
aRetvals, IgnoreErrors());
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, true, &data, &cpows, aRetvals,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvRpcMessage(
|
||||
const nsString& aMsg, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, const IPC::Principal& aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetvals) {
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetvals) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("ContentParent::RecvRpcMessage",
|
||||
OTHER, aMsg);
|
||||
MMPrinter::Print("ContentParent::RecvRpcMessage", aMsg, aData);
|
||||
@ -3940,15 +3938,15 @@ mozilla::ipc::IPCResult ContentParent::RecvRpcMessage(
|
||||
ipc::StructuredCloneData data;
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, true, &data, &cpows, aPrincipal,
|
||||
aRetvals, IgnoreErrors());
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, true, &data, &cpows, aRetvals,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvAsyncMessage(
|
||||
const nsString& aMsg, nsTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal, const ClonedMessageData& aData) {
|
||||
const ClonedMessageData& aData) {
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING("ContentParent::RecvAsyncMessage",
|
||||
OTHER, aMsg);
|
||||
MMPrinter::Print("ContentParent::RecvAsyncMessage", aMsg, aData);
|
||||
@ -3959,8 +3957,8 @@ mozilla::ipc::IPCResult ContentParent::RecvAsyncMessage(
|
||||
ipc::StructuredCloneData data;
|
||||
ipc::UnpackClonedMessageDataForParent(aData, data);
|
||||
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, false, &data, &cpows, aPrincipal,
|
||||
nullptr, IgnoreErrors());
|
||||
ppm->ReceiveMessage(ppm, nullptr, aMsg, false, &data, &cpows, nullptr,
|
||||
IgnoreErrors());
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
@ -4157,8 +4155,7 @@ bool ContentParent::DoLoadMessageManagerScript(const nsAString& aURL,
|
||||
nsresult ContentParent::DoSendAsyncMessage(JSContext* aCx,
|
||||
const nsAString& aMessage,
|
||||
StructuredCloneData& aHelper,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) {
|
||||
JS::Handle<JSObject*> aCpows) {
|
||||
ClonedMessageData data;
|
||||
if (!BuildClonedMessageDataForParent(this, aHelper, data)) {
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
@ -4168,8 +4165,7 @@ nsresult ContentParent::DoSendAsyncMessage(JSContext* aCx,
|
||||
if (aCpows && (!mgr || !mgr->Wrap(aCx, aCpows, &cpows))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
if (!SendAsyncMessage(nsString(aMessage), cpows, Principal(aPrincipal),
|
||||
data)) {
|
||||
if (!SendAsyncMessage(nsString(aMessage), cpows, data)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -351,8 +351,7 @@ class ContentParent final
|
||||
|
||||
virtual nsresult DoSendAsyncMessage(JSContext* aCx, const nsAString& aMessage,
|
||||
StructuredCloneData& aData,
|
||||
JS::Handle<JSObject*> aCpows,
|
||||
nsIPrincipal* aPrincipal) override;
|
||||
JS::Handle<JSObject*> aCpows) override;
|
||||
|
||||
/** Notify that a tab is beginning its destruction sequence. */
|
||||
void NotifyTabDestroying();
|
||||
@ -1030,17 +1029,14 @@ class ContentParent final
|
||||
|
||||
mozilla::ipc::IPCResult RecvSyncMessage(
|
||||
const nsString& aMsg, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, const IPC::Principal& aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetvals);
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetvals);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRpcMessage(
|
||||
const nsString& aMsg, const ClonedMessageData& aData,
|
||||
nsTArray<CpowEntry>&& aCpows, const IPC::Principal& aPrincipal,
|
||||
nsTArray<StructuredCloneData>* aRetvals);
|
||||
nsTArray<CpowEntry>&& aCpows, nsTArray<StructuredCloneData>* aRetvals);
|
||||
|
||||
mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
|
||||
nsTArray<CpowEntry>&& aCpows,
|
||||
const IPC::Principal& aPrincipal,
|
||||
const ClonedMessageData& aData);
|
||||
|
||||
// MOZ_CAN_RUN_SCRIPT_BOUNDARY because we don't have MOZ_CAN_RUN_SCRIPT bits
|
||||
|
@ -185,7 +185,7 @@ nested(upto inside_cpow) sync refcounted protocol PBrowser
|
||||
|
||||
both:
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
nsIPrincipal aPrincipal, ClonedMessageData aData);
|
||||
ClonedMessageData aData);
|
||||
|
||||
parent:
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -256,11 +256,11 @@ parent:
|
||||
async Event(RemoteDOMEvent aEvent);
|
||||
|
||||
sync SyncMessage(nsString aMessage, ClonedMessageData aData,
|
||||
CpowEntry[] aCpows, nsIPrincipal aPrincipal)
|
||||
CpowEntry[] aCpows)
|
||||
returns (StructuredCloneData[] retval);
|
||||
|
||||
nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
|
||||
CpowEntry[] aCpows, nsIPrincipal aPrincipal)
|
||||
CpowEntry[] aCpows)
|
||||
returns (StructuredCloneData[] retval);
|
||||
|
||||
/**
|
||||
|
@ -941,11 +941,11 @@ parent:
|
||||
sync GetGfxVars() returns (GfxVarUpdate[] vars);
|
||||
|
||||
sync SyncMessage(nsString aMessage, ClonedMessageData aData,
|
||||
CpowEntry[] aCpows, Principal aPrincipal)
|
||||
CpowEntry[] aCpows)
|
||||
returns (StructuredCloneData[] retval);
|
||||
|
||||
nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
|
||||
CpowEntry[] aCpows, Principal aPrincipal)
|
||||
CpowEntry[] aCpows)
|
||||
returns (StructuredCloneData[] retval);
|
||||
|
||||
async ShowAlert(nsIAlertNotification alert);
|
||||
@ -1557,7 +1557,7 @@ both:
|
||||
uint64_t aEpoch);
|
||||
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
Principal aPrincipal, ClonedMessageData aData);
|
||||
ClonedMessageData aData);
|
||||
|
||||
/**
|
||||
* Notify `push-subscription-modified` observers in the parent and child.
|
||||
|
@ -61,9 +61,7 @@ function basic_test(finish) {
|
||||
let channel = new MessageChannel();
|
||||
port = channel.port2;
|
||||
mm.addMessageListener("BasicTest:FinishPrepare", finishPrepare);
|
||||
mm.sendAsyncMessage("BasicTest:PortCreated", {}, {}, undefined, [
|
||||
channel.port1,
|
||||
]);
|
||||
mm.sendAsyncMessage("BasicTest:PortCreated", {}, {}, [channel.port1]);
|
||||
}
|
||||
|
||||
// Communicate with closed port.
|
||||
@ -87,9 +85,7 @@ function close_test(finish) {
|
||||
let channel = new MessageChannel();
|
||||
port = channel.port2;
|
||||
mm.addMessageListener("CloseTest:FinishPrepare", finishPrepare);
|
||||
mm.sendAsyncMessage("CloseTest:PortCreated", {}, {}, undefined, [
|
||||
channel.port1,
|
||||
]);
|
||||
mm.sendAsyncMessage("CloseTest:PortCreated", {}, {}, [channel.port1]);
|
||||
}
|
||||
|
||||
// Empty transferable object
|
||||
@ -103,7 +99,7 @@ function empty_transferable(finish) {
|
||||
};
|
||||
|
||||
mm.addMessageListener("EmptyTest:FinishPrepare", finishPrepare);
|
||||
mm.sendAsyncMessage("EmptyTest:PortCreated", {}, {}, undefined, []);
|
||||
mm.sendAsyncMessage("EmptyTest:PortCreated", {}, {}, []);
|
||||
}
|
||||
|
||||
// Not transferable object.
|
||||
@ -116,9 +112,7 @@ function not_transferable(finish) {
|
||||
};
|
||||
|
||||
mm.addMessageListener("NotTransferableTest:FinishPrepare", finishPrepare);
|
||||
mm.sendAsyncMessage("NotTransferableTest:PortCreated", {}, {}, undefined, [
|
||||
"",
|
||||
]);
|
||||
mm.sendAsyncMessage("NotTransferableTest:PortCreated", {}, {}, [""]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -225,7 +225,7 @@ Object.assign(PushServiceParent.prototype, {
|
||||
if (!this._isValidMessage(message)) {
|
||||
return;
|
||||
}
|
||||
let { name, principal, target, data } = message;
|
||||
let { name, target, data } = message;
|
||||
if (name === "Push:NotificationForOriginShown") {
|
||||
this.notificationForOriginShown(data);
|
||||
return;
|
||||
@ -238,7 +238,7 @@ Object.assign(PushServiceParent.prototype, {
|
||||
this.reportDeliveryError(data.messageId, data.reason);
|
||||
return;
|
||||
}
|
||||
this._handleRequest(name, principal, data)
|
||||
this._handleRequest(name, data.principal, data)
|
||||
.then(
|
||||
result => {
|
||||
target.sendAsyncMessage(this._getResponseName(name, "OK"), {
|
||||
@ -382,42 +382,30 @@ Object.assign(PushServiceContent.prototype, {
|
||||
|
||||
subscribeWithKey(scope, principal, key, callback) {
|
||||
let requestID = this._addRequest(callback);
|
||||
this._mm.sendAsyncMessage(
|
||||
"Push:Register",
|
||||
{
|
||||
scope,
|
||||
appServerKey: key,
|
||||
requestID,
|
||||
},
|
||||
null,
|
||||
principal
|
||||
);
|
||||
this._mm.sendAsyncMessage("Push:Register", {
|
||||
scope,
|
||||
appServerKey: key,
|
||||
requestID,
|
||||
principal,
|
||||
});
|
||||
},
|
||||
|
||||
unsubscribe(scope, principal, callback) {
|
||||
let requestID = this._addRequest(callback);
|
||||
this._mm.sendAsyncMessage(
|
||||
"Push:Unregister",
|
||||
{
|
||||
scope,
|
||||
requestID,
|
||||
},
|
||||
null,
|
||||
principal
|
||||
);
|
||||
this._mm.sendAsyncMessage("Push:Unregister", {
|
||||
scope,
|
||||
requestID,
|
||||
principal,
|
||||
});
|
||||
},
|
||||
|
||||
getSubscription(scope, principal, callback) {
|
||||
let requestID = this._addRequest(callback);
|
||||
this._mm.sendAsyncMessage(
|
||||
"Push:Registration",
|
||||
{
|
||||
scope,
|
||||
requestID,
|
||||
},
|
||||
null,
|
||||
principal
|
||||
);
|
||||
this._mm.sendAsyncMessage("Push:Registration", {
|
||||
scope,
|
||||
requestID,
|
||||
principal,
|
||||
});
|
||||
},
|
||||
|
||||
clearForDomain(domain, callback) {
|
||||
|
@ -120,7 +120,12 @@ var MockService = {
|
||||
sendAsyncMessage("service-request", {
|
||||
name,
|
||||
id,
|
||||
params,
|
||||
// The request params from the real push service may contain a
|
||||
// principal, which cannot be passed to the unprivileged
|
||||
// mochitest scope, and will cause the message to be dropped if
|
||||
// present. The mochitest scope fortunately does not need the
|
||||
// principal, though, so set it to null before sending.
|
||||
params: Object.assign({}, params, { principal: null }),
|
||||
});
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user