Bug 1448850 - Remove nsISyncMessageSender. r=bz.

--HG--
extra : rebase_source : a240b840b0514671565bb4980cf7642ff06749ef
This commit is contained in:
Peter Van der Beken 2018-02-10 11:20:51 +01:00
Родитель 634aaa5c2e
Коммит 355e71640d
10 изменённых файлов: 10 добавлений и 124 удалений

Просмотреть файл

@ -59,7 +59,7 @@ ProcessGlobal::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
ProcessGlobal*
ProcessGlobal::Get()
{
nsCOMPtr<nsISyncMessageSender> service = do_GetService(NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID);
nsCOMPtr<nsIMessageSender> service = do_GetService(NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID);
if (!service) {
return nullptr;
}
@ -96,10 +96,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ProcessGlobal)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)

Просмотреть файл

@ -26,7 +26,7 @@ namespace mozilla {
namespace dom {
class ProcessGlobal :
public nsISyncMessageSender,
public nsIMessageSender,
public nsMessageManagerScriptExecutor,
public nsIGlobalObject,
public nsIScriptObjectPrincipal,
@ -52,7 +52,7 @@ public:
static ProcessGlobal* Get();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsISyncMessageSender)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsIMessageSender)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override
@ -70,8 +70,6 @@ public:
using MessageManagerGlobal::SendAsyncMessage;
using MessageManagerGlobal::GetProcessMessageManager;
using MessageManagerGlobal::GetRemoteType;
using MessageManagerGlobal::SendSyncMessage;
using MessageManagerGlobal::SendRpcMessage;
// ContentProcessMessageManager
void GetInitialProcessData(JSContext* aCx,
@ -87,7 +85,6 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_FORWARD_SAFE_NSISYNCMESSAGESENDER(mMessageManager)
virtual void LoadScript(const nsAString& aURL);

Просмотреть файл

@ -143,11 +143,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
static_cast<nsIMessageListenerManager*>(
static_cast<nsIMessageSender*>(this))))
/* Message managers in child process implement nsIMessageSender and
nsISyncMessageSender. Message managers in the chrome process are
/* Message managers in child process implement nsIMessageSender.
Message managers in the chrome process are
either broadcasters (if they have subordinate/child message
managers) or they're simple message senders. */
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageSender, !mChrome || !mIsBroadcaster)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageBroadcaster, mChrome && mIsBroadcaster)
@ -530,36 +529,9 @@ GetParamsForMessage(JSContext* aCx,
return true;
}
// nsISyncMessageSender
static bool sSendingSyncMessage = false;
NS_IMETHODIMP
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
{
return SendMessage(aMessageName, aJSON, aObjects, aPrincipal, aCx, aArgc,
aRetval, true);
}
NS_IMETHODIMP
nsFrameMessageManager::SendRpcMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval)
{
return SendMessage(aMessageName, aJSON, aObjects, aPrincipal, aCx, aArgc,
aRetval, false);
}
static bool
AllowMessage(size_t aDataLength, const nsAString& aMessageName)
{
@ -580,53 +552,6 @@ AllowMessage(size_t aDataLength, const nsAString& aMessageName)
return false;
}
nsresult
nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
JS::Handle<JS::Value> aJSON,
JS::Handle<JS::Value> aObjects,
nsIPrincipal* aPrincipal,
JSContext* aCx,
uint8_t aArgc,
JS::MutableHandle<JS::Value> aRetval,
bool aIsSync)
{
AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
"nsFrameMessageManager::SendMessage", EVENTS, aMessageName);
aRetval.setUndefined();
if (sSendingSyncMessage && aIsSync) {
// No kind of blocking send should be issued on top of a sync message.
return NS_ERROR_UNEXPECTED;
}
StructuredCloneData data;
if (aArgc >= 2 && !GetParamsForMessage(aCx, aJSON, JS::UndefinedHandleValue, data)) {
return NS_ERROR_DOM_DATA_CLONE_ERR;
}
JS::Rooted<JSObject*> objects(aCx);
if (aArgc >= 3 && aObjects.isObject()) {
objects = &aObjects.toObject();
}
nsTArray<JS::Value> result;
SequenceRooter<JS::Value> resultRooter(aCx, &result);
ErrorResult rv;
SendMessage(aCx, aMessageName, data, objects, aPrincipal, aIsSync, result, rv);
rv.WouldReportJSException();
if (rv.Failed()) {
return rv.StealNSResult();
}
JS::Rooted<JSObject*> dataArray(aCx);
if (!ToJSValue(aCx, result, aRetval)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
void
nsFrameMessageManager::SendMessage(JSContext* aCx,
const nsAString& aMessageName,
@ -1976,7 +1901,7 @@ nsFrameMessageManager::NewProcessMessageManager(bool aIsRemote)
}
nsresult
NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
NS_NewChildProcessMessageManager(nsIMessageSender** aResult)
{
NS_ASSERTION(!nsFrameMessageManager::GetChildProcessManager(),
"Re-creating sChildProcessManager");

Просмотреть файл

@ -253,7 +253,6 @@ public:
NS_DECL_NSIMESSAGELISTENERMANAGER
NS_DECL_NSIMESSAGESENDER
NS_DECL_NSIMESSAGEBROADCASTER
NS_DECL_NSISYNCMESSAGESENDER
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
static mozilla::dom::ChromeMessageSender*

Просмотреть файл

@ -346,38 +346,8 @@ interface nsIMessageBroadcaster : nsIMessageListenerManager
void releaseCachedProcesses();
};
[uuid(0e602c9e-1977-422a-a8e4-fe0d4a4f78d0)]
interface nsISyncMessageSender : nsIMessageSender
{
/**
* Like |sendAsyncMessage()|, except blocks the sender until all
* listeners of the message have been invoked. Returns an array
* containing return values from each listener invoked.
*/
[implicit_jscontext, optional_argc]
jsval sendSyncMessage([optional] in AString messageName,
[optional] in jsval obj,
[optional] in jsval objects,
[optional] in nsIPrincipal principal);
/**
* Like |sendSyncMessage()|, except re-entrant. New RPC messages may be
* issued even if, earlier on the call stack, we are waiting for a reply
* to an earlier sendRpcMessage() call.
*
* Both sendSyncMessage and sendRpcMessage will block until a reply is
* received, but they may be temporarily interrupted to process an urgent
* incoming message (such as a CPOW request).
*/
[implicit_jscontext, optional_argc]
jsval sendRpcMessage([optional] in AString messageName,
[optional] in jsval obj,
[optional] in jsval objects,
[optional] in nsIPrincipal principal);
};
[uuid(694e367c-aa25-4446-8499-2c527c4bd838)]
interface nsIContentFrameMessageManager : nsISyncMessageSender
interface nsIContentFrameMessageManager : nsIMessageSender
{
};

Просмотреть файл

@ -162,7 +162,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInProcessTabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)

Просмотреть файл

@ -68,7 +68,6 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_FORWARD_SAFE_NSISYNCMESSAGESENDER(mMessageManager);
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
NS_DECL_NSIINPROCESSCONTENTFRAMEMESSAGEMANAGER

Просмотреть файл

@ -3517,7 +3517,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)

Просмотреть файл

@ -106,7 +106,6 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_FORWARD_SAFE_NSISYNCMESSAGESENDER(mMessageManager);
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
nsresult

Просмотреть файл

@ -320,7 +320,7 @@ nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
nsresult NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult);
nsresult NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult);
nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult);
nsresult NS_NewChildProcessMessageManager(nsIMessageSender** aResult);
nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
@ -398,7 +398,7 @@ MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewCon
MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, NS_NewEventListenerService)
MAKE_CTOR(CreateGlobalMessageManager, nsIMessageBroadcaster, NS_NewGlobalMessageManager)
MAKE_CTOR(CreateParentMessageManager, nsIMessageBroadcaster, NS_NewParentProcessMessageManager)
MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender, NS_NewChildProcessMessageManager)
MAKE_CTOR(CreateChildMessageManager, nsIMessageSender, NS_NewChildProcessMessageManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)