Bug 1448850 - Remove nsIMessageManagerGlobal. r=bz.

--HG--
extra : rebase_source : a1efbc58c4b379b77b9a4e06625597c403053bd1
This commit is contained in:
Peter Van der Beken 2018-03-26 16:10:45 +02:00
Родитель ae3b234726
Коммит 634aaa5c2e
11 изменённых файлов: 75 добавлений и 120 удалений

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

@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "mozilla/dom/MessageManagerGlobal.h"
#include "mozilla/IntentionalCrash.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsContentUtils.h"
#ifdef ANDROID
#include <android/log.h>
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
namespace mozilla {
namespace dom {
void
MessageManagerGlobal::Dump(const nsAString& aStr)
{
if (!DOMPrefs::DumpEnabled()) {
return;
}
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", NS_ConvertUTF16toUTF8(aStr).get());
#endif
#ifdef XP_WIN
if (IsDebuggerPresent()) {
OutputDebugStringW(PromiseFlatString(aStr).get());
}
#endif
fputs(NS_ConvertUTF16toUTF8(aStr).get(), stdout);
fflush(stdout);
}
void
MessageManagerGlobal::PrivateNoteIntentionalCrash(ErrorResult& aError)
{
if (XRE_IsContentProcess()) {
NoteIntentionalCrash("tab");
return;
}
aError.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
MessageManagerGlobal::Atob(const nsAString& aAsciiString, nsAString& aBase64Data,
ErrorResult& aError)
{
aError = nsContentUtils::Atob(aAsciiString, aBase64Data);
}
void
MessageManagerGlobal::Btoa(const nsAString& aBase64Data, nsAString& aAsciiString,
ErrorResult& aError)
{
aError = nsContentUtils::Btoa(aBase64Data, aAsciiString);
}
} // namespace dom
} // namespace mozilla

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

@ -127,40 +127,10 @@ public:
}
// MessageManagerGlobal
void Dump(const nsAString& aStr, ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);
return;
}
aError = mMessageManager->Dump(aStr);
}
void PrivateNoteIntentionalCrash(ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);
return;
}
aError = mMessageManager->PrivateNoteIntentionalCrash();
}
void Atob(const nsAString& aAsciiString, nsAString& aBase64Data,
ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);
return;
}
aError = mMessageManager->Atob(aAsciiString, aBase64Data);
}
void Btoa(const nsAString& aBase64Data, nsAString& aAsciiString,
ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);
return;
}
aError = mMessageManager->Btoa(aBase64Data, aAsciiString);
}
void Dump(const nsAString& aStr);
void PrivateNoteIntentionalCrash(ErrorResult& aError);
void Atob(const nsAString& aAsciiString, nsAString& aBase64Data, ErrorResult& aError);
void Btoa(const nsAString& aBase64Data, nsAString& aAsciiString, ErrorResult& aError);
bool MarkForCC()
{

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

@ -96,7 +96,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ProcessGlobal)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMessageManagerGlobal)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)

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

@ -26,7 +26,7 @@ namespace mozilla {
namespace dom {
class ProcessGlobal :
public nsIMessageManagerGlobal,
public nsISyncMessageSender,
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, nsIMessageManagerGlobal)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(ProcessGlobal, nsISyncMessageSender)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override
@ -72,10 +72,6 @@ public:
using MessageManagerGlobal::GetRemoteType;
using MessageManagerGlobal::SendSyncMessage;
using MessageManagerGlobal::SendRpcMessage;
using MessageManagerGlobal::Dump;
using MessageManagerGlobal::PrivateNoteIntentionalCrash;
using MessageManagerGlobal::Atob;
using MessageManagerGlobal::Btoa;
// ContentProcessMessageManager
void GetInitialProcessData(JSContext* aCx,
@ -92,7 +88,6 @@ public:
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
NS_FORWARD_SAFE_NSISYNCMESSAGESENDER(mMessageManager)
NS_FORWARD_SAFE_NSIMESSAGEMANAGERGLOBAL(mMessageManager)
virtual void LoadScript(const nsAString& aURL);

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

@ -278,6 +278,7 @@ UNIFIED_SOURCES += [
'Link.cpp',
'Location.cpp',
'MessageListenerManager.cpp',
'MessageManagerGlobal.cpp',
'MessageSender.cpp',
'Navigator.cpp',
'NodeInfo.cpp',

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

@ -30,11 +30,9 @@
#include "nsIScriptSecurityManager.h"
#include "xpcpublic.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/IntentionalCrash.h"
#include "mozilla/Preferences.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ChildProcessMessageManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/ChromeMessageSender.h"
@ -58,11 +56,7 @@
#include <algorithm>
#include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize
#ifdef ANDROID
#include <android/log.h>
#endif
#ifdef XP_WIN
#include <windows.h>
# if defined(SendMessage)
# undef SendMessage
# endif
@ -871,52 +865,6 @@ nsFrameMessageManager::ReleaseCachedProcesses()
return NS_OK;
}
// nsIContentFrameMessageManager
NS_IMETHODIMP
nsFrameMessageManager::Dump(const nsAString& aStr)
{
if (!DOMPrefs::DumpEnabled()) {
return NS_OK;
}
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", NS_ConvertUTF16toUTF8(aStr).get());
#endif
#ifdef XP_WIN
if (IsDebuggerPresent()) {
OutputDebugStringW(PromiseFlatString(aStr).get());
}
#endif
fputs(NS_ConvertUTF16toUTF8(aStr).get(), stdout);
fflush(stdout);
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::PrivateNoteIntentionalCrash()
{
if (XRE_IsContentProcess()) {
mozilla::NoteIntentionalCrash("tab");
return NS_OK;
}
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
nsAString& aAsciiBase64String)
{
return nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
}
NS_IMETHODIMP
nsFrameMessageManager::Atob(const nsAString& aAsciiString,
nsAString& aBinaryData)
{
return nsContentUtils::Atob(aAsciiString, aBinaryData);
}
class MMListenerRemover
{
public:

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

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

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

@ -376,29 +376,8 @@ interface nsISyncMessageSender : nsIMessageSender
[optional] in nsIPrincipal principal);
};
[uuid(13f3555f-769e-44ea-b607-5239230c3162)]
interface nsIMessageManagerGlobal : nsISyncMessageSender
{
/**
* Print a string to stdout.
*/
void dump(in DOMString aStr);
/**
* If leak detection is enabled, print a note to the leak log that this
* process will intentionally crash.
*/
void privateNoteIntentionalCrash();
/**
* Ascii base64 data to binary data and vice versa
*/
DOMString atob(in DOMString aAsciiString);
DOMString btoa(in DOMString aBase64Data);
};
[uuid(694e367c-aa25-4446-8499-2c527c4bd838)]
interface nsIContentFrameMessageManager : nsIMessageManagerGlobal
interface nsIContentFrameMessageManager : nsISyncMessageSender
{
};

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

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

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

@ -200,7 +200,6 @@ interface MessageManagerGlobal : SyncMessageSender
/**
* Print a string to stdout.
*/
[Throws]
void dump(DOMString str);
/**

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

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