зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1580176) for causing hazard bustages CLOSED TREE
Backed out changeset 59f7472b2ad4 (bug 1580176) Backed out changeset 6f33e6cec3c1 (bug 1580176)
This commit is contained in:
Родитель
3e332e686a
Коммит
507497e864
|
@ -15,13 +15,10 @@
|
|||
#include "mozilla/dom/MessageManagerBinding.h"
|
||||
#include "mozilla/dom/PWindowGlobal.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/WindowGlobalActor.h"
|
||||
#include "js/Promise.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "nsASCIIMask.h"
|
||||
|
||||
static mozilla::LazyLogModule gJSWindowActorLog("JSWindowActor");
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -50,56 +47,11 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(JSWindowActor)
|
|||
|
||||
JSWindowActor::JSWindowActor() : mNextQueryId(0) {}
|
||||
|
||||
void JSWindowActor::LogMessage(const char* aCallerName,
|
||||
const JSWindowActorMessageMeta* aMetadata) {
|
||||
if (!MOZ_UNLIKELY(MOZ_LOG_TEST(gJSWindowActorLog, LogLevel::Debug))) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCString str;
|
||||
str.AppendPrintf("%s, this=%p", aCallerName, this);
|
||||
|
||||
if (WindowGlobalActor* manager = GetManager()) {
|
||||
const char* side =
|
||||
manager->GetSide() == JSWindowActor::Type::Parent ? "Parent" : "Child";
|
||||
str.AppendPrintf(", name=%s%s", NS_ConvertUTF16toUTF8(Name()).get(), side);
|
||||
str.AppendPrintf(", inProcess=%d", manager->IsInProcess());
|
||||
}
|
||||
|
||||
if (aMetadata) {
|
||||
const nsString& messageName = aMetadata->messageName();
|
||||
str.AppendPrintf(", messageName=\"%s\"",
|
||||
NS_ConvertUTF16toUTF8(messageName).get());
|
||||
|
||||
str.Append(", kind=");
|
||||
switch (aMetadata->kind()) {
|
||||
case JSWindowActorMessageKind::Message:
|
||||
str.Append("Message");
|
||||
break;
|
||||
case JSWindowActorMessageKind::Query:
|
||||
str.Append("Query");
|
||||
break;
|
||||
case JSWindowActorMessageKind::QueryResolve:
|
||||
str.Append("QueryResolve");
|
||||
break;
|
||||
case JSWindowActorMessageKind::QueryReject:
|
||||
str.Append("QueryReject");
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("invalid JSWindowActorMessageKind value!");
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_LOG(gJSWindowActorLog, LogLevel::Debug, ("%s", str.get()));
|
||||
}
|
||||
|
||||
void JSWindowActor::StartDestroy() {
|
||||
LogMessage("StartDestroy");
|
||||
InvokeCallback(CallbackFunction::WillDestroy);
|
||||
}
|
||||
|
||||
void JSWindowActor::AfterDestroy() {
|
||||
LogMessage("AfterDestroy");
|
||||
InvokeCallback(CallbackFunction::DidDestroy);
|
||||
// Clear out & reject mPendingQueries
|
||||
RejectPendingQueries();
|
||||
|
@ -291,7 +243,6 @@ already_AddRefed<Promise> JSWindowActor::SendQuery(
|
|||
void JSWindowActor::ReceiveRawMessage(const JSWindowActorMessageMeta& aMetadata,
|
||||
ipc::StructuredCloneData&& aData,
|
||||
ipc::StructuredCloneData&& aStack) {
|
||||
LogMessage("ReceiveRawMessage", &aMetadata);
|
||||
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
|
||||
|
||||
AutoEntryScript aes(GetParentObject(), "JSWindowActor message handler");
|
||||
|
|
|
@ -30,7 +30,6 @@ enum class JSWindowActorMessageKind {
|
|||
EndGuard_,
|
||||
};
|
||||
|
||||
class WindowGlobalActor;
|
||||
class JSWindowActorMessageMeta;
|
||||
class QueryPromiseHandler;
|
||||
|
||||
|
@ -60,7 +59,6 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
|
|||
ipc::StructuredCloneData&& aStack);
|
||||
|
||||
virtual nsIGlobalObject* GetParentObject() const = 0;
|
||||
virtual WindowGlobalActor* GetManager() const = 0;
|
||||
|
||||
void RejectPendingQueries();
|
||||
|
||||
|
@ -88,9 +86,6 @@ class JSWindowActor : public nsISupports, public nsWrapperCache {
|
|||
|
||||
void InvokeCallback(CallbackFunction willDestroy);
|
||||
|
||||
void LogMessage(const char* aCallerName,
|
||||
const JSWindowActorMessageMeta* aMetadata = nullptr);
|
||||
|
||||
private:
|
||||
friend class ::nsQueryActor; // for QueryInterfaceActor
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ void JSWindowActorChild::Init(const nsAString& aName,
|
|||
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorChild twice!");
|
||||
SetName(aName);
|
||||
mManager = aManager;
|
||||
LogMessage("Init");
|
||||
|
||||
InvokeCallback(CallbackFunction::ActorCreated);
|
||||
}
|
||||
|
@ -76,8 +75,6 @@ void JSWindowActorChild::SendRawMessage(const JSWindowActorMessageMeta& aMeta,
|
|||
ipc::StructuredCloneData&& aData,
|
||||
ipc::StructuredCloneData&& aStack,
|
||||
ErrorResult& aRv) {
|
||||
LogMessage("SendRawMessage", &aMeta);
|
||||
|
||||
if (NS_WARN_IF(!mCanSend || !mManager || !mManager->CanSend())) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/JSWindowActor.h"
|
||||
#include "mozilla/dom/WindowGlobalChild.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
@ -23,6 +22,7 @@ template <typename>
|
|||
struct Nullable;
|
||||
|
||||
class Document;
|
||||
class WindowGlobalChild;
|
||||
class WindowProxyHolder;
|
||||
|
||||
} // namespace dom
|
||||
|
@ -51,7 +51,7 @@ class JSWindowActorChild final : public JSWindowActor {
|
|||
return MakeAndAddRef<JSWindowActorChild>(global);
|
||||
}
|
||||
|
||||
WindowGlobalChild* GetManager() const override;
|
||||
WindowGlobalChild* GetManager() const;
|
||||
void Init(const nsAString& aName, WindowGlobalChild* aManager);
|
||||
void StartDestroy();
|
||||
void AfterDestroy();
|
||||
|
|
|
@ -30,7 +30,6 @@ void JSWindowActorParent::Init(const nsAString& aName,
|
|||
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");
|
||||
SetName(aName);
|
||||
mManager = aManager;
|
||||
LogMessage("Init");
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -69,8 +68,6 @@ void JSWindowActorParent::SendRawMessage(const JSWindowActorMessageMeta& aMeta,
|
|||
ipc::StructuredCloneData&& aData,
|
||||
ipc::StructuredCloneData&& aStack,
|
||||
ErrorResult& aRv) {
|
||||
LogMessage("SendRawMessage", &aMeta);
|
||||
|
||||
if (NS_WARN_IF(!mCanSend || !mManager || !mManager->CanSend())) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
|
|
|
@ -12,13 +12,20 @@
|
|||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/JSWindowActor.h"
|
||||
#include "mozilla/dom/WindowGlobalParent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class WindowGlobalParent;
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class JSWindowActorParent final : public JSWindowActor {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -35,7 +42,7 @@ class JSWindowActorParent final : public JSWindowActor {
|
|||
|
||||
nsIGlobalObject* GetParentObject() const override;
|
||||
|
||||
WindowGlobalParent* GetManager() const override;
|
||||
WindowGlobalParent* GetManager() const;
|
||||
void Init(const nsAString& aName, WindowGlobalParent* aManager);
|
||||
void StartDestroy();
|
||||
void AfterDestroy();
|
||||
|
|
|
@ -24,9 +24,6 @@ class WindowGlobalActor : public nsISupports {
|
|||
static WindowGlobalInit AboutBlankInitializer(
|
||||
dom::BrowsingContext* aBrowsingContext, nsIPrincipal* aPrincipal);
|
||||
|
||||
virtual bool IsInProcess() = 0;
|
||||
virtual JSWindowActor::Type GetSide() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~WindowGlobalActor() = default;
|
||||
|
||||
|
@ -37,6 +34,7 @@ class WindowGlobalActor : public nsISupports {
|
|||
ErrorResult& aRv);
|
||||
virtual nsIURI* GetDocumentURI() = 0;
|
||||
virtual const nsAString& GetRemoteType() = 0;
|
||||
virtual JSWindowActor::Type GetSide() = 0;
|
||||
virtual dom::BrowsingContext* BrowsingContext() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class WindowGlobalChild final : public WindowGlobalActor,
|
|||
|
||||
// Check if this actor is managed by PInProcess, as-in the document is loaded
|
||||
// in the chrome process.
|
||||
bool IsInProcess() override { return XRE_IsParentProcess(); }
|
||||
bool IsInProcess() { return XRE_IsParentProcess(); }
|
||||
|
||||
nsIURI* GetDocumentURI() override { return mDocumentURI; }
|
||||
void SetDocumentURI(nsIURI* aDocumentURI);
|
||||
|
|
|
@ -63,7 +63,7 @@ class WindowGlobalParent final : public WindowContext,
|
|||
|
||||
// Check if this actor is managed by PInProcess, as-in the document is loaded
|
||||
// in-process.
|
||||
bool IsInProcess() override { return mInProcess; }
|
||||
bool IsInProcess() { return mInProcess; }
|
||||
|
||||
// Get the other side of this actor if it is an in-process actor. Returns
|
||||
// |nullptr| if the actor has been torn down, or is not in-process.
|
||||
|
|
Загрузка…
Ссылка в новой задаче