Backed out changeset 5bb547481faf (bug 1451973) for testChild failures on a CLOSED TREE

This commit is contained in:
Gurzau Raul 2018-05-25 14:16:34 +03:00
Родитель 0ebb40fcee
Коммит c406b410bc
35 изменённых файлов: 211 добавлений и 442 удалений

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

@ -7,11 +7,34 @@
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "AccessCheck.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ChromeMessageBroadcaster::ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(nullptr, aParentManager,
aFlags |
MessageManagerFlags::MM_BROADCASTER |
MessageManagerFlags::MM_CHROME)
{
if (mIsProcessManager) {
mozilla::HoldJSObjects(this);
}
if (aParentManager) {
aParentManager->AddChildManager(this);
}
}
ChromeMessageBroadcaster::~ChromeMessageBroadcaster()
{
if (mIsProcessManager) {
mozilla::DropJSObjects(this);
}
}
JSObject*
ChromeMessageBroadcaster::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
@ -21,5 +44,28 @@ ChromeMessageBroadcaster::WrapObject(JSContext* aCx,
return ChromeMessageBroadcasterBinding::Wrap(aCx, this, aGivenProto);
}
void
ChromeMessageBroadcaster::ReleaseCachedProcesses()
{
ContentParent::ReleaseCachedProcesses();
}
void
ChromeMessageBroadcaster::AddChildManager(MessageListenerManager* aManager)
{
mChildManagers.AppendElement(aManager);
RefPtr<nsFrameMessageManager> kungfuDeathGrip = this;
RefPtr<nsFrameMessageManager> kungfuDeathGrip2 = aManager;
LoadPendingScripts(this, aManager);
}
void
ChromeMessageBroadcaster::RemoveChildManager(MessageListenerManager* aManager)
{
mChildManagers.RemoveElement(aManager);
}
} // namespace dom
} // namespace mozilla

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

@ -7,31 +7,74 @@
#ifndef mozilla_dom_ChromeMessageBroadcaster_h
#define mozilla_dom_ChromeMessageBroadcaster_h
#include "mozilla/dom/MessageBroadcaster.h"
#include "mozilla/dom/MessageListenerManager.h"
namespace mozilla {
namespace dom {
/**
* Implementation for the WebIDL ChromeMessageBroadcaster interface. Used for window and
* group message managers.
*/
class ChromeMessageBroadcaster final : public MessageBroadcaster
class ChromeMessageBroadcaster final : public MessageListenerManager
{
public:
explicit ChromeMessageBroadcaster(MessageManagerFlags aFlags)
: ChromeMessageBroadcaster(nullptr, aFlags)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK)));
}
explicit ChromeMessageBroadcaster(MessageBroadcaster* aParentManager)
explicit ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager)
: ChromeMessageBroadcaster(aParentManager, MessageManagerFlags::MM_NONE)
{}
static ChromeMessageBroadcaster* From(nsFrameMessageManager* aManager)
{
if (aManager->IsBroadcaster() && aManager->IsChrome()) {
return static_cast<ChromeMessageBroadcaster*>(aManager);
}
return nullptr;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void BroadcastAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
JS::Handle<JS::Value> aObj,
JS::Handle<JSObject*> aObjects,
mozilla::ErrorResult& aError)
{
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
JS::UndefinedHandleValue, aError);
}
uint32_t ChildCount()
{
return mChildManagers.Length();
}
MessageListenerManager* GetChildAt(uint32_t aIndex)
{
return mChildManagers.SafeElementAt(aIndex);
}
void ReleaseCachedProcesses();
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// GlobalProcessScriptLoader
using nsFrameMessageManager::GetInitialProcessData;
// FrameScriptLoader
void LoadFrameScript(const nsAString& aUrl, bool aAllowDelayedLoad,
bool aRunInGlobalScope, mozilla::ErrorResult& aError)
@ -49,14 +92,13 @@ public:
GetDelayedScripts(aCx, aScripts, aError);
}
void AddChildManager(MessageListenerManager* aManager);
void RemoveChildManager(MessageListenerManager* aManager);
private:
ChromeMessageBroadcaster(MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageBroadcaster(aParentManager,
aFlags |
MessageManagerFlags::MM_BROADCASTER |
MessageManagerFlags::MM_CHROME)
{}
ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags);
virtual ~ChromeMessageBroadcaster();
};
} // namespace dom

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

@ -10,6 +10,24 @@
namespace mozilla {
namespace dom {
ChromeMessageSender::ChromeMessageSender(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageSender(aCallback, aParentManager, aFlags | MessageManagerFlags::MM_CHROME)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK)));
// This is a bit hackish. We attach to the parent, but only if we have a callback. We
// don't have a callback for the frame message manager, and for parent process message
// managers (except the parent in-process message manager). In those cases we wait until
// the child process is running (see MessageSender::InitWithCallback).
if (aParentManager && mCallback) {
aParentManager->AddChildManager(this);
}
}
JSObject*
ChromeMessageSender::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)

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

@ -12,21 +12,35 @@
namespace mozilla {
namespace dom {
class MessageBroadcaster;
class ChromeMessageBroadcaster;
class ChromeMessageSender final : public MessageSender
{
public:
explicit ChromeMessageSender(MessageBroadcaster* aParentManager)
: MessageSender(nullptr, aParentManager, MessageManagerFlags::MM_CHROME)
{
// This is a bit hackish, we wait until the child process is running before attaching
// to the parent manager (see MessageSender::InitWithCallback).
}
ChromeMessageSender(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags=MessageManagerFlags::MM_NONE);
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// FrameScriptLoader
void LoadFrameScript(const nsAString& aUrl, bool aAllowDelayedLoad,
bool aRunInGlobalScope, mozilla::ErrorResult& aError)

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

@ -13,7 +13,6 @@
#include "nsIdentifierMapEntry.h"
class nsContentList;
class nsIDocument;
class nsINode;
namespace mozilla {
@ -21,7 +20,6 @@ class StyleSheet;
namespace dom {
class Element;
class StyleSheetList;
class ShadowRoot;

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

@ -1,48 +0,0 @@
/* -*- 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/MessageBroadcaster.h"
#include "mozilla/dom/ContentParent.h"
namespace mozilla {
namespace dom {
MessageBroadcaster::MessageBroadcaster(MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(nullptr, aParentManager,
aFlags |
MessageManagerFlags::MM_BROADCASTER)
{
if (aParentManager) {
aParentManager->AddChildManager(this);
}
}
void
MessageBroadcaster::ReleaseCachedProcesses()
{
ContentParent::ReleaseCachedProcesses();
}
void
MessageBroadcaster::AddChildManager(MessageListenerManager* aManager)
{
mChildManagers.AppendElement(aManager);
RefPtr<nsFrameMessageManager> kungfuDeathGrip = this;
RefPtr<nsFrameMessageManager> kungfuDeathGrip2 = aManager;
LoadPendingScripts(this, aManager);
}
void
MessageBroadcaster::RemoveChildManager(MessageListenerManager* aManager)
{
mChildManagers.RemoveElement(aManager);
}
} // namespace dom
} // namespace mozilla

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

@ -1,58 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_MessageBroadcaster_h
#define mozilla_dom_MessageBroadcaster_h
#include "mozilla/dom/MessageListenerManager.h"
namespace mozilla {
namespace dom {
/**
* Implementation for the WebIDL MessageBroadcaster interface. Base class for window and
* process broadcaster message managers.
*/
class MessageBroadcaster : public MessageListenerManager
{
public:
static MessageBroadcaster* From(MessageListenerManager* aManager)
{
if (aManager->IsBroadcaster()) {
return static_cast<MessageBroadcaster*>(aManager);
}
return nullptr;
}
void BroadcastAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
JS::Handle<JS::Value> aObj,
JS::Handle<JSObject*> aObjects,
mozilla::ErrorResult& aError)
{
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
JS::UndefinedHandleValue, aError);
}
uint32_t ChildCount()
{
return mChildManagers.Length();
}
MessageListenerManager* GetChildAt(uint32_t aIndex)
{
return mChildManagers.SafeElementAt(aIndex);
}
void ReleaseCachedProcesses();
void AddChildManager(MessageListenerManager* aManager);
void RemoveChildManager(MessageListenerManager* aManager);
protected:
MessageBroadcaster(MessageBroadcaster* aParentManager, MessageManagerFlags aFlags);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_MessageBroadcaster_h

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

@ -10,7 +10,7 @@ namespace mozilla {
namespace dom {
MessageListenerManager::MessageListenerManager(ipc::MessageManagerCallback* aCallback,
MessageBroadcaster* aParentManager,
ChromeMessageBroadcaster* aParentManager,
ipc::MessageManagerFlags aFlags)
: nsFrameMessageManager(aCallback, aFlags),
mParentManager(aParentManager)

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

@ -14,12 +14,6 @@
namespace mozilla {
namespace dom {
class MessageBroadcaster;
/**
* Implementation for the WebIDL MessageListenerManager interface. Base class for message
* managers that are exposed to script.
*/
class MessageListenerManager : public nsFrameMessageManager,
public nsWrapperCache
{
@ -28,12 +22,12 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(MessageListenerManager,
nsFrameMessageManager)
MessageBroadcaster* GetParentObject()
ChromeMessageBroadcaster* GetParentObject()
{
return mParentManager;
}
virtual MessageBroadcaster* GetParentManager() override
virtual ChromeMessageBroadcaster* GetParentManager() override
{
return mParentManager;
}
@ -46,11 +40,11 @@ public:
protected:
MessageListenerManager(ipc::MessageManagerCallback* aCallback,
MessageBroadcaster* aParentManager,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags);
virtual ~MessageListenerManager();
RefPtr<MessageBroadcaster> mParentManager;
RefPtr<ChromeMessageBroadcaster> mParentManager;
};
} // namespace dom

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

@ -78,7 +78,7 @@ public:
mMessageManager->SendAsyncMessage(aCx, aMessageName, aObj, aObjects,
aPrincipal, aTransfers, aError);
}
already_AddRefed<ProcessMessageManager> GetProcessMessageManager(mozilla::ErrorResult& aError)
already_AddRefed<ChromeMessageSender> GetProcessMessageManager(mozilla::ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);

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

@ -12,12 +12,6 @@
namespace mozilla {
namespace dom {
class MessageBroadcaster;
/**
* Implementation for the WebIDL MessageSender interface. Base class for frame and child
* process message managers.
*/
class MessageSender : public MessageListenerManager
{
public:
@ -25,7 +19,7 @@ public:
protected:
MessageSender(ipc::MessageManagerCallback* aCallback,
MessageBroadcaster* aParentManager,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(aCallback, aParentManager, aFlags)
{}

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

@ -20,9 +20,8 @@
*/
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/ChromeUtilsBinding.h"
#include "mozilla/ErrorResult.h"
#include "nsID.h"
namespace mozilla {
namespace dom {

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

@ -7,8 +7,6 @@
#ifndef mozilla_dom_NameSpaceConstants_h__
#define mozilla_dom_NameSpaceConstants_h__
#include <stdint.h>
#define kNameSpaceID_Unknown -1
// 0 is special at C++, so use a static const int32_t for
// kNameSpaceID_None to keep if from being cast to pointers

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

@ -1,36 +0,0 @@
/* -*- 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/ParentProcessMessageManager.h"
#include "AccessCheck.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ParentProcessMessageManager::ParentProcessMessageManager()
: MessageBroadcaster(nullptr, MessageManagerFlags::MM_PROCESSMANAGER)
{
mozilla::HoldJSObjects(this);
}
ParentProcessMessageManager::~ParentProcessMessageManager()
{
mozilla::DropJSObjects(this);
}
JSObject*
ParentProcessMessageManager::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
return ParentProcessMessageManagerBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

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

@ -1,55 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_ParentProcessMessageManager_h
#define mozilla_dom_ParentProcessMessageManager_h
#include "mozilla/dom/MessageBroadcaster.h"
namespace mozilla {
namespace dom {
/**
* Implementation for the WebIDL ParentProcessMessageManager interface.
* ParentProcessMessageManager is used in a parent process to communicate with all the
* child processes.
*/
class ParentProcessMessageManager final : public MessageBroadcaster
{
public:
ParentProcessMessageManager();
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// GlobalProcessScriptLoader
using nsFrameMessageManager::GetInitialProcessData;
private:
virtual ~ParentProcessMessageManager();
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ParentProcessMessageManager_h

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

@ -1,41 +0,0 @@
/* -*- 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/ProcessMessageManager.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ProcessMessageManager::ProcessMessageManager(ipc::MessageManagerCallback* aCallback,
ParentProcessMessageManager* aParentManager,
MessageManagerFlags aFlags)
: MessageSender(aCallback, aParentManager,
aFlags | MessageManagerFlags::MM_CHROME |
MessageManagerFlags::MM_PROCESSMANAGER)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_OWNSCALLBACK)));
// This is a bit hackish. We attach to the parent manager, but only if we have a
// callback (which is only for the in-process message manager). For other cases we wait
// until the child process is running (see MessageSender::InitWithCallback).
if (aParentManager && mCallback) {
aParentManager->AddChildManager(this);
}
}
JSObject*
ProcessMessageManager::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
return ProcessMessageManagerBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

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

@ -1,52 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_ProcessMessageManager_h
#define mozilla_dom_ProcessMessageManager_h
#include "mozilla/dom/MessageSender.h"
namespace mozilla {
namespace dom {
class ParentProcessMessageManager;
/**
* ProcessMessageManager is used in a parent process to communicate with a child process
* (or with the process itself in a single-process scenario).
*/
class ProcessMessageManager final : public MessageSender
{
public:
ProcessMessageManager(ipc::MessageManagerCallback* aCallback,
ParentProcessMessageManager* aParentManager,
MessageManagerFlags aFlags=MessageManagerFlags::MM_NONE);
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ProcessMessageManager_h

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

@ -18,7 +18,6 @@
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/StyleSheetList.h"
using namespace mozilla;
using namespace mozilla::dom;

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

@ -7,7 +7,6 @@
#include "mozilla/dom/StyleSheetList.h"
#include "mozilla/dom/StyleSheetListBinding.h"
#include "nsINode.h"
namespace mozilla {
namespace dom {

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

@ -190,7 +190,6 @@ EXPORTS.mozilla.dom += [
'IntlUtils.h',
'Link.h',
'Location.h',
'MessageBroadcaster.h',
'MessageListenerManager.h',
'MessageManagerGlobal.h',
'MessageSender.h',
@ -200,10 +199,8 @@ EXPORTS.mozilla.dom += [
'NodeInfo.h',
'NodeInfoInlines.h',
'NodeIterator.h',
'ParentProcessMessageManager.h',
'Pose.h',
'ProcessGlobal.h',
'ProcessMessageManager.h',
'ResponsiveImageSelector.h',
'SameProcessMessageQueue.h',
'ScreenOrientation.h',
@ -274,7 +271,6 @@ UNIFIED_SOURCES += [
'IntlUtils.cpp',
'Link.cpp',
'Location.cpp',
'MessageBroadcaster.cpp',
'MessageListenerManager.cpp',
'MessageManagerGlobal.cpp',
'MessageSender.cpp',
@ -348,11 +344,9 @@ UNIFIED_SOURCES += [
'nsXHTMLContentSerializer.cpp',
'nsXMLContentSerializer.cpp',
'nsXMLNameSpaceMap.cpp',
'ParentProcessMessageManager.cpp',
'Pose.cpp',
'PostMessageEvent.cpp',
'ProcessGlobal.cpp',
'ProcessMessageManager.cpp',
'ResponsiveImageSelector.cpp',
'SameProcessMessageQueue.cpp',
'ScreenOrientation.cpp',

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

@ -30,9 +30,7 @@
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TimeoutManager.h"
@ -88,7 +86,7 @@ nsCCUncollectableMarker::Init()
}
static void
MarkChildMessageManagers(MessageBroadcaster* aMM)
MarkChildMessageManagers(ChromeMessageBroadcaster* aMM)
{
aMM->MarkForCC();
@ -99,8 +97,9 @@ MarkChildMessageManagers(MessageBroadcaster* aMM)
continue;
}
RefPtr<MessageBroadcaster> strongNonLeafMM = MessageBroadcaster::From(childMM);
MessageBroadcaster* nonLeafMM = strongNonLeafMM;
RefPtr<ChromeMessageBroadcaster> strongNonLeafMM =
ChromeMessageBroadcaster::From(childMM);
ChromeMessageBroadcaster* nonLeafMM = strongNonLeafMM;
MessageListenerManager* tabMM = childMM;

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

@ -39,7 +39,6 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/MessageBroadcaster.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
@ -7719,7 +7718,7 @@ nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost)
}
bool
nsContentUtils::CallOnAllRemoteChildren(MessageBroadcaster* aManager,
nsContentUtils::CallOnAllRemoteChildren(ChromeMessageBroadcaster* aManager,
CallOnRemoteChildFunction aCallback,
void* aArg)
{
@ -7730,7 +7729,7 @@ nsContentUtils::CallOnAllRemoteChildren(MessageBroadcaster* aManager,
continue;
}
RefPtr<MessageBroadcaster> nonLeafMM = MessageBroadcaster::From(childMM);
RefPtr<ChromeMessageBroadcaster> nonLeafMM = ChromeMessageBroadcaster::From(childMM);
if (nonLeafMM) {
if (CallOnAllRemoteChildren(nonLeafMM, aCallback, aArg)) {
return true;
@ -7760,7 +7759,7 @@ nsContentUtils::CallOnAllRemoteChildren(nsPIDOMWindowOuter* aWindow,
{
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(aWindow);
if (window->IsChromeWindow()) {
RefPtr<MessageBroadcaster> windowMM = window->GetMessageManager();
RefPtr<ChromeMessageBroadcaster> windowMM = window->GetMessageManager();
if (windowMM) {
CallOnAllRemoteChildren(windowMM, aCallback, aArg);
}

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

@ -125,6 +125,7 @@ class EventListenerManager;
class HTMLEditor;
namespace dom {
class ChromeMessageBroadcaster;
struct CustomElementDefinition;
class DocumentFragment;
class Element;
@ -135,7 +136,6 @@ class IPCDataTransfer;
class IPCDataTransferItem;
struct LifecycleCallbackArgs;
struct LifecycleAdoptedCallbackArgs;
class MessageBroadcaster;
class NodeInfo;
class nsIContentChild;
class nsIContentParent;
@ -3329,7 +3329,7 @@ private:
mozilla::dom::AutocompleteInfo& aInfo,
bool aGrantAllValidValue = false);
static bool CallOnAllRemoteChildren(mozilla::dom::MessageBroadcaster* aManager,
static bool CallOnAllRemoteChildren(mozilla::dom::ChromeMessageBroadcaster* aManager,
CallOnRemoteChildFunction aCallback,
void* aArg);

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

@ -23,7 +23,10 @@
#include "nsThreadUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
using mozilla::dom::TreeOrderComparator;
using mozilla::dom::Animation;
using mozilla::dom::Element;
AutoTArray<RefPtr<nsDOMMutationObserver>, 4>*
nsDOMMutationObserver::sScheduledMutationObservers = nullptr;

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

@ -2947,7 +2947,7 @@ nsFrameLoader::EnsureMessageManager()
parentManager = nsFrameMessageManager::GetGlobalMessageManager();
}
mMessageManager = new ChromeMessageSender(parentManager);
mMessageManager = new ChromeMessageSender(nullptr, parentManager);
if (!IsRemoteFrame()) {
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
@ -3388,7 +3388,7 @@ nsFrameLoader::PopulateUserContextIdFromAttribute(OriginAttributes& aAttr)
return NS_OK;
}
ProcessMessageManager*
ChromeMessageSender*
nsFrameLoader::GetProcessMessageManager() const
{
return mRemoteBrowser ? mRemoteBrowser->Manager()->GetMessageManager()

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

@ -53,7 +53,6 @@ class ChromeMessageSender;
class ContentParent;
class MessageSender;
class PBrowserParent;
class ProcessMessageManager;
class Promise;
class TabParent;
class MutableTabContext;
@ -334,7 +333,7 @@ public:
// Properly retrieves documentSize of any subdocument type.
nsresult GetWindowDimensions(nsIntRect& aRect);
virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager() const override;
virtual mozilla::dom::ChromeMessageSender* GetProcessMessageManager() const override;
// public because a callback needs these.
RefPtr<mozilla::dom::ChromeMessageSender> mMessageManager;

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

@ -36,14 +36,13 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ChildProcessMessageManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/ChromeMessageSender.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MessageManagerBinding.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/ResolveSystemBinding.h"
#include "mozilla/dom/SameProcessMessageQueue.h"
#include "mozilla/dom/ScriptSettings.h"
@ -162,7 +161,7 @@ nsresult
MessageManagerCallback::DoGetRemoteType(nsAString& aRemoteType) const
{
aRemoteType.Truncate();
mozilla::dom::ProcessMessageManager* parent = GetProcessMessageManager();
mozilla::dom::ChromeMessageSender* parent = GetProcessMessageManager();
if (!parent) {
return NS_OK;
}
@ -952,7 +951,8 @@ nsFrameMessageManager::Close()
if (!mClosed) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(this, "message-manager-close", nullptr);
obs->NotifyObservers(NS_ISUPPORTS_CAST(nsIContentFrameMessageManager*, this),
"message-manager-close", nullptr);
}
}
mClosed = true;
@ -969,7 +969,8 @@ nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
if (!mDisconnected) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(this, "message-manager-disconnect", nullptr);
obs->NotifyObservers(NS_ISUPPORTS_CAST(nsIContentFrameMessageManager*, this),
"message-manager-disconnect", nullptr);
}
}
@ -1034,10 +1035,10 @@ nsFrameMessageManager::GetInitialProcessData(JSContext* aCx,
aInitialProcessData.set(init);
}
already_AddRefed<ProcessMessageManager>
already_AddRefed<ChromeMessageSender>
nsFrameMessageManager::GetProcessMessageManager(ErrorResult& aError)
{
RefPtr<ProcessMessageManager> pmm;
RefPtr<ChromeMessageSender> pmm;
if (mCallback) {
pmm = mCallback->GetProcessMessageManager();
}
@ -1476,7 +1477,7 @@ nsMessageManagerScriptExecutor::MarkScopesForCC()
NS_IMPL_ISUPPORTS(nsScriptCacheCleaner, nsIObserver)
ChildProcessMessageManager* nsFrameMessageManager::sChildProcessManager = nullptr;
ParentProcessMessageManager* nsFrameMessageManager::sParentProcessManager = nullptr;
ChromeMessageBroadcaster* nsFrameMessageManager::sParentProcessManager = nullptr;
nsFrameMessageManager* nsFrameMessageManager::sSameProcessParentManager = nullptr;
class nsAsyncMessageToSameProcessChild : public nsSameProcessAsyncMessageBase,
@ -1491,7 +1492,7 @@ public:
NS_IMETHOD Run() override
{
nsFrameMessageManager* ppm = nsFrameMessageManager::GetChildProcessManager();
ReceiveMessage(ppm, nullptr, ppm);
ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm), nullptr, ppm);
return NS_OK;
}
};
@ -1628,7 +1629,7 @@ public:
nsresult HandleMessage() override
{
nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager;
ReceiveMessage(ppm, nullptr, ppm);
ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm), nullptr, ppm);
return NS_OK;
}
};
@ -1696,7 +1697,8 @@ NS_NewParentProcessMessageManager(nsISupports** aResult)
{
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
"Re-creating sParentProcessManager");
RefPtr<ParentProcessMessageManager> mm = new ParentProcessMessageManager();
RefPtr<ChromeMessageBroadcaster> mm =
new ChromeMessageBroadcaster(MessageManagerFlags::MM_PROCESSMANAGER);
nsFrameMessageManager::sParentProcessManager = mm;
nsFrameMessageManager::NewProcessMessageManager(false); // Create same process message manager.
mm.forget(aResult);
@ -1704,7 +1706,7 @@ NS_NewParentProcessMessageManager(nsISupports** aResult)
}
ProcessMessageManager*
ChromeMessageSender*
nsFrameMessageManager::NewProcessMessageManager(bool aIsRemote)
{
if (!nsFrameMessageManager::sParentProcessManager) {
@ -1714,16 +1716,18 @@ nsFrameMessageManager::NewProcessMessageManager(bool aIsRemote)
MOZ_ASSERT(nsFrameMessageManager::sParentProcessManager,
"parent process manager not created");
ProcessMessageManager* mm;
ChromeMessageSender* mm;
if (aIsRemote) {
// Callback is set in ContentParent::InitInternal so that the process has
// already started when we send pending scripts.
mm = new ProcessMessageManager(nullptr,
nsFrameMessageManager::sParentProcessManager);
mm = new ChromeMessageSender(nullptr,
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_PROCESSMANAGER);
} else {
mm = new ProcessMessageManager(new SameParentProcessMessageManagerCallback(),
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_OWNSCALLBACK);
mm = new ChromeMessageSender(new SameParentProcessMessageManagerCallback(),
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK);
sSameProcessParentManager = mm;
}
return mm;

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

@ -43,14 +43,12 @@ class nsIContentParent;
class nsIContentChild;
class ChildProcessMessageManager;
class ChromeMessageBroadcaster;
class ChromeMessageSender;
class ClonedMessageData;
class MessageBroadcaster;
class MessageListener;
class MessageListenerManager;
class MessageManagerReporter;
template<typename T> class Optional;
class ParentProcessMessageManager;
class ProcessMessageManager;
namespace ipc {
@ -98,7 +96,7 @@ public:
return NS_OK;
}
virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager() const
virtual mozilla::dom::ChromeMessageSender* GetProcessMessageManager() const
{
return nullptr;
}
@ -203,7 +201,7 @@ public:
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, aPrincipal, aTransfers,
aError);
}
already_AddRefed<mozilla::dom::ProcessMessageManager>
already_AddRefed<mozilla::dom::ChromeMessageSender>
GetProcessMessageManager(mozilla::ErrorResult& aError);
void GetRemoteType(nsAString& aRemoteType, mozilla::ErrorResult& aError) const;
@ -235,7 +233,8 @@ public:
NS_DECL_NSIMESSAGESENDER
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
static mozilla::dom::ProcessMessageManager* NewProcessMessageManager(bool aIsRemote);
static mozilla::dom::ChromeMessageSender*
NewProcessMessageManager(bool aIsRemote);
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
const nsAString& aMessage, bool aIsSync,
@ -269,7 +268,7 @@ public:
// GetGlobalMessageManager creates the global message manager if it hasn't been yet.
static already_AddRefed<mozilla::dom::ChromeMessageBroadcaster>
GetGlobalMessageManager();
static mozilla::dom::ParentProcessMessageManager* GetParentProcessManager()
static mozilla::dom::ChromeMessageBroadcaster* GetParentProcessManager()
{
return sParentProcessManager;
}
@ -289,7 +288,7 @@ public:
protected:
friend class MMListenerRemover;
virtual mozilla::dom::MessageBroadcaster* GetParentManager()
virtual mozilla::dom::ChromeMessageBroadcaster* GetParentManager()
{
return nullptr;
}
@ -366,7 +365,7 @@ protected:
void LoadPendingScripts(nsFrameMessageManager* aManager,
nsFrameMessageManager* aChildMM);
public:
static mozilla::dom::ParentProcessMessageManager* sParentProcessManager;
static mozilla::dom::ChromeMessageBroadcaster* sParentProcessManager;
static nsFrameMessageManager* sSameProcessParentManager;
static nsTArray<nsCOMPtr<nsIRunnable> >* sPendingSameProcessAsyncMessages;
private:

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

@ -19,7 +19,6 @@
#include "nsCOMPtr.h"
#include "nsAtom.h"
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
@ -27,12 +26,6 @@ class nsIContent;
class nsContentList;
class nsBaseContentList;
namespace mozilla {
namespace dom {
class Element;
}
}
/**
* Right now our identifier map entries contain information for 'name'
* and 'id' mappings of a given string. This is so that

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

@ -19,7 +19,7 @@ interface Principal;
*
* Message managers that always have exactly one "other side" are of
* type MessageSender. Parent-side message managers that have many
* "other sides" are of type MessageBroadcaster.
* "other sides" are of type ChromeMessageBroadcaster.
*
* Child-side message managers can send synchronous messages to their
* parent side, but not the other way around.
@ -94,13 +94,13 @@ interface Principal;
* ----------
*
* The global MMg and window MMw's are message broadcasters implementing
* MessageBroadcaster while the frame MMp's are simple message senders (MessageSender).
* Their counterparts in the content processes are message senders implementing
* ContentFrameMessageManager.
* ChromeMessageBroadcaster while the frame MMp's are simple message
* senders (MessageSender). Their counterparts in the content processes
* are message senders implementing ContentFrameMessageManager.
*
* MessageListenerManager
* / \
* MessageSender MessageBroadcaster
* MessageSender ChromeMessageBroadcaster
* |
* SyncMessageSender (content process/in-process only)
* |
@ -352,10 +352,6 @@ interface SyncMessageSender : MessageSender
optional Principal? principal = null);
};
/**
* ChildProcessMessageManager is used in a child process to communicate with the parent
* process.
*/
[ChromeOnly]
interface ChildProcessMessageManager : SyncMessageSender
{
@ -507,7 +503,7 @@ ContentProcessMessageManager implements MessageManagerGlobal;
* managers within its window.
*/
[ChromeOnly]
interface MessageBroadcaster : MessageListenerManager
interface ChromeMessageBroadcaster : MessageListenerManager
{
/**
* Like |sendAsyncMessage()|, but also broadcasts this message to
@ -538,38 +534,12 @@ interface MessageBroadcaster : MessageListenerManager
*/
void releaseCachedProcesses();
};
/**
* ChromeMessageBroadcaster is used for window and group message managers.
*/
[ChromeOnly]
interface ChromeMessageBroadcaster : MessageBroadcaster
{
};
ChromeMessageBroadcaster implements GlobalProcessScriptLoader;
ChromeMessageBroadcaster implements FrameScriptLoader;
/**
* ParentProcessMessageManager is used in a parent process to communicate with all the
* child processes.
*/
[ChromeOnly]
interface ParentProcessMessageManager : MessageBroadcaster
{
};
ParentProcessMessageManager implements GlobalProcessScriptLoader;
[ChromeOnly]
interface ChromeMessageSender : MessageSender
{
};
ChromeMessageSender implements ProcessScriptLoader;
ChromeMessageSender implements FrameScriptLoader;
/**
* ProcessMessageManager is used in a parent process to communicate with a child process
* (or with the process itself in a single-process scenario).
*/
[ChromeOnly]
interface ProcessMessageManager : MessageSender
{
};
ProcessMessageManager implements ProcessScriptLoader;

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

@ -5,7 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/ChromeMessageSender.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "nsXULAppAPI.h"

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

@ -157,8 +157,7 @@
#include "nsThread.h"
#include "nsWindowWatcher.h"
#include "nsIXULRuntime.h"
#include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/nsMixedContentBlocker.h"
#include "nsMemoryInfoDumper.h"
#include "nsMemoryReporterManager.h"
@ -535,7 +534,7 @@ ScriptableCPInfo::GetMessageManager(nsISupports** aMessenger)
return NS_ERROR_NOT_INITIALIZED;
}
RefPtr<ProcessMessageManager> manager = mContentParent->GetMessageManager();
RefPtr<ChromeMessageSender> manager = mContentParent->GetMessageManager();
manager.forget(aMessenger);
return NS_OK;
}
@ -2239,7 +2238,7 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority)
if (ssm) {
ssm->CloneDomainPolicy(&xpcomInit.domainPolicy());
if (ParentProcessMessageManager* mm = nsFrameMessageManager::sParentProcessManager) {
if (ChromeMessageBroadcaster* mm = nsFrameMessageManager::sParentProcessManager) {
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
MOZ_CRASH();

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

@ -8,12 +8,12 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/ChromeMessageSender.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/ContentProcessManager.h"
#include "mozilla/dom/PTabContext.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"

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

@ -44,7 +44,7 @@ namespace dom {
class Blob;
class BlobConstructorParams;
class BlobImpl;
class ProcessMessageManager;
class ChromeMessageSender;
class ContentParent;
class ContentBridgeParent;
class IPCTabContext;
@ -89,7 +89,7 @@ public:
ContentBridgeParent* AsContentBridgeParent();
mozilla::dom::ProcessMessageManager* GetMessageManager() const { return mMessageManager; }
mozilla::dom::ChromeMessageSender* GetMessageManager() const { return mMessageManager; }
virtual bool SendActivate(PBrowserParent* aTab) = 0;
@ -162,7 +162,7 @@ protected: // IPDL methods
const ClonedMessageData& aData);
protected: // members
RefPtr<mozilla::dom::ProcessMessageManager> mMessageManager;
RefPtr<mozilla::dom::ChromeMessageSender> mMessageManager;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentParent, NS_ICONTENTPARENT_IID)

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

@ -14,7 +14,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/StyleComplexColor.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/Element.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nscore.h"