зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1530550, bug 1529684) for bc crashes at [@ mozilla::dom::BrowsingContext::Detach(bool)]. CLOSED TREE
Backed out changeset 289c2b4126c9 (bug 1530550) Backed out changeset 9f3e65f6b1dd (bug 1529684) Backed out changeset 257d45117af3 (bug 1529684) Backed out changeset 7f2bda80e479 (bug 1529684)
This commit is contained in:
Родитель
1f6d297e33
Коммит
8a1c4fbd47
|
@ -58,6 +58,20 @@ static void Register(BrowsingContext* aBrowsingContext) {
|
|||
aBrowsingContext->Group()->Register(aBrowsingContext);
|
||||
}
|
||||
|
||||
static void Sync(BrowsingContext* aBrowsingContext) {
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
RefPtr<BrowsingContext> parent = aBrowsingContext->GetParent();
|
||||
BrowsingContext* opener = aBrowsingContext->GetOpener();
|
||||
cc->SendAttachBrowsingContext(parent, opener,
|
||||
BrowsingContextId(aBrowsingContext->Id()),
|
||||
aBrowsingContext->Name());
|
||||
}
|
||||
|
||||
BrowsingContext* BrowsingContext::TopLevelBrowsingContext() {
|
||||
BrowsingContext* bc = this;
|
||||
while (bc->mParent) {
|
||||
|
@ -147,7 +161,7 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateFromIPC(
|
|||
|
||||
Register(context);
|
||||
|
||||
// Caller handles attaching us to the tree.
|
||||
context->Attach();
|
||||
|
||||
return context.forget();
|
||||
}
|
||||
|
@ -158,11 +172,11 @@ BrowsingContext::BrowsingContext(BrowsingContext* aParent,
|
|||
uint64_t aBrowsingContextId, Type aType)
|
||||
: mName(aName),
|
||||
mClosed(false),
|
||||
mOpener(aOpener),
|
||||
mIsActivatedByUserGesture(false),
|
||||
mType(aType),
|
||||
mBrowsingContextId(aBrowsingContextId),
|
||||
mParent(aParent) {
|
||||
mParent(aParent),
|
||||
mOpener(aOpener),
|
||||
mIsActivatedByUserGesture(false) {
|
||||
// Specify our group in our constructor. We will explicitly join the group
|
||||
// when we are registered, as doing so will take a reference.
|
||||
if (mParent) {
|
||||
|
@ -183,7 +197,7 @@ void BrowsingContext::SetDocShell(nsIDocShell* aDocShell) {
|
|||
mDocShell = aDocShell;
|
||||
}
|
||||
|
||||
void BrowsingContext::Attach(bool aFromIPC) {
|
||||
void BrowsingContext::Attach() {
|
||||
MOZ_LOG(GetLog(), LogLevel::Debug,
|
||||
("%s: %s 0x%08" PRIx64 " to 0x%08" PRIx64,
|
||||
XRE_IsParentProcess() ? "Parent" : "Child",
|
||||
|
@ -197,16 +211,10 @@ void BrowsingContext::Attach(bool aFromIPC) {
|
|||
|
||||
children->AppendElement(this);
|
||||
|
||||
// Send attach to our parent if we need to.
|
||||
if (!aFromIPC && XRE_IsContentProcess()) {
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendAttachBrowsingContext(
|
||||
mParent, mOpener, BrowsingContextId(mBrowsingContextId), Name());
|
||||
}
|
||||
Sync(this);
|
||||
}
|
||||
|
||||
void BrowsingContext::Detach(bool aFromIPC) {
|
||||
void BrowsingContext::Detach() {
|
||||
MOZ_LOG(GetLog(), LogLevel::Debug,
|
||||
("%s: Detaching 0x%08" PRIx64 " from 0x%08" PRIx64,
|
||||
XRE_IsParentProcess() ? "Parent" : "Child", Id(),
|
||||
|
@ -234,18 +242,16 @@ void BrowsingContext::Detach(bool aFromIPC) {
|
|||
|
||||
Group()->Unregister(this);
|
||||
|
||||
// By definition, we no longer are the current process for this
|
||||
// BrowsingContext - clear our now-dead nsDocShell reference.
|
||||
mDocShell = nullptr;
|
||||
|
||||
if (!aFromIPC && XRE_IsContentProcess()) {
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendDetachBrowsingContext(this, false /* aMoveToBFCache */);
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendDetachBrowsingContext(this, false /* aMoveToBFCache */);
|
||||
}
|
||||
|
||||
void BrowsingContext::CacheChildren(bool aFromIPC) {
|
||||
void BrowsingContext::CacheChildren() {
|
||||
if (mChildren.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -261,11 +267,13 @@ void BrowsingContext::CacheChildren(bool aFromIPC) {
|
|||
}
|
||||
mChildren.Clear();
|
||||
|
||||
if (!aFromIPC && XRE_IsContentProcess()) {
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendDetachBrowsingContext(this, true /* aMoveToBFCache */);
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendDetachBrowsingContext(this, true /* aMoveToBFCache */);
|
||||
}
|
||||
|
||||
bool BrowsingContext::IsCached() { return sCachedBrowsingContexts->has(Id()); }
|
||||
|
@ -275,6 +283,22 @@ void BrowsingContext::GetChildren(
|
|||
MOZ_ALWAYS_TRUE(aChildren.AppendElements(mChildren));
|
||||
}
|
||||
|
||||
void BrowsingContext::SetOpener(BrowsingContext* aOpener) {
|
||||
if (mOpener == aOpener) {
|
||||
return;
|
||||
}
|
||||
|
||||
mOpener = aOpener;
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_DIAGNOSTIC_ASSERT(cc);
|
||||
cc->SendSetOpenerBrowsingContext(this, aOpener);
|
||||
}
|
||||
|
||||
// FindWithName follows the rules for choosing a browsing context,
|
||||
// with the exception of sandboxing for iframes. The implementation
|
||||
// for arbitrarily choosing between two browsing contexts with the
|
||||
|
@ -456,7 +480,14 @@ void BrowsingContext::NotifyUserGestureActivation() {
|
|||
RefPtr<BrowsingContext> topLevelBC = TopLevelBrowsingContext();
|
||||
USER_ACTIVATION_LOG("Get top level browsing context 0x%08" PRIx64,
|
||||
topLevelBC->Id());
|
||||
topLevelBC->SetIsActivatedByUserGesture(true);
|
||||
topLevelBC->SetUserGestureActivation();
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_ASSERT(cc);
|
||||
cc->SendSetUserGestureActivation(topLevelBC, true);
|
||||
}
|
||||
|
||||
void BrowsingContext::NotifyResetUserGestureActivation() {
|
||||
|
@ -466,19 +497,39 @@ void BrowsingContext::NotifyResetUserGestureActivation() {
|
|||
RefPtr<BrowsingContext> topLevelBC = TopLevelBrowsingContext();
|
||||
USER_ACTIVATION_LOG("Get top level browsing context 0x%08" PRIx64,
|
||||
topLevelBC->Id());
|
||||
topLevelBC->SetIsActivatedByUserGesture(false);
|
||||
topLevelBC->ResetUserGestureActivation();
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return;
|
||||
}
|
||||
auto cc = ContentChild::GetSingleton();
|
||||
MOZ_ASSERT(cc);
|
||||
cc->SendSetUserGestureActivation(topLevelBC, false);
|
||||
}
|
||||
|
||||
void BrowsingContext::SetUserGestureActivation() {
|
||||
MOZ_ASSERT(!mParent, "Set user activation flag on non top-level context!");
|
||||
USER_ACTIVATION_LOG(
|
||||
"Set user gesture activation for browsing context 0x%08" PRIx64, Id());
|
||||
mIsActivatedByUserGesture = true;
|
||||
}
|
||||
|
||||
bool BrowsingContext::GetUserGestureActivation() {
|
||||
RefPtr<BrowsingContext> topLevelBC = TopLevelBrowsingContext();
|
||||
return topLevelBC->GetIsActivatedByUserGesture();
|
||||
return topLevelBC->mIsActivatedByUserGesture;
|
||||
}
|
||||
|
||||
void BrowsingContext::ResetUserGestureActivation() {
|
||||
MOZ_ASSERT(!mParent, "Clear user activation flag on non top-level context!");
|
||||
USER_ACTIVATION_LOG(
|
||||
"Reset user gesture activation for browsing context 0x%08" PRIx64, Id());
|
||||
mIsActivatedByUserGesture = false;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(BrowsingContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowsingContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocShell, mChildren, mParent, mOpener,
|
||||
mGroup)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocShell, mChildren, mParent, mGroup)
|
||||
if (XRE_IsParentProcess()) {
|
||||
CanonicalBrowsingContext::Cast(tmp)->Unlink();
|
||||
}
|
||||
|
@ -486,8 +537,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowsingContext)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(BrowsingContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocShell, mChildren, mParent, mOpener,
|
||||
mGroup)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocShell, mChildren, mParent, mGroup)
|
||||
if (XRE_IsParentProcess()) {
|
||||
CanonicalBrowsingContext::Cast(tmp)->Traverse(cb);
|
||||
}
|
||||
|
@ -564,7 +614,7 @@ Nullable<WindowProxyHolder> BrowsingContext::GetTop(ErrorResult& aError) {
|
|||
void BrowsingContext::GetOpener(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aOpener,
|
||||
ErrorResult& aError) const {
|
||||
BrowsingContext* opener = GetOpener();
|
||||
auto* opener = GetOpener();
|
||||
if (!opener) {
|
||||
aOpener.setNull();
|
||||
return;
|
||||
|
|
|
@ -66,11 +66,9 @@ class WindowProxyHolder;
|
|||
// acts as a sentinel for callers of MOZ_FOR_EACH_SYNCED_FIELD.
|
||||
|
||||
// clang-format off
|
||||
#define MOZ_FOR_EACH_SYNCED_BC_FIELD(declare, ...) \
|
||||
declare(Name, nsString, nsAString) \
|
||||
declare(Closed, bool, bool) \
|
||||
declare(Opener, RefPtr<BrowsingContext>, BrowsingContext*) \
|
||||
declare(IsActivatedByUserGesture, bool, bool) \
|
||||
#define MOZ_FOR_EACH_SYNCED_BC_FIELD(declare, ...) \
|
||||
declare(Name, nsString, nsAString) \
|
||||
declare(Closed, bool, bool) \
|
||||
__VA_ARGS__
|
||||
// clang-format on
|
||||
|
||||
|
@ -78,9 +76,9 @@ class WindowProxyHolder;
|
|||
#define MOZ_SYNCED_BC_FIELD_ARGUMENT(name, type, atype) \
|
||||
transaction->MOZ_SYNCED_BC_FIELD_NAME(name),
|
||||
#define MOZ_SYNCED_BC_FIELD_GETTER(name, type, atype) \
|
||||
type const& Get##name() const { return MOZ_SYNCED_BC_FIELD_NAME(name); }
|
||||
const type& Get##name() const { return MOZ_SYNCED_BC_FIELD_NAME(name); }
|
||||
#define MOZ_SYNCED_BC_FIELD_SETTER(name, type, atype) \
|
||||
void Set##name(atype const& aValue) { \
|
||||
void Set##name(const atype& aValue) { \
|
||||
Transaction t; \
|
||||
t.MOZ_SYNCED_BC_FIELD_NAME(name).emplace(aValue); \
|
||||
t.Commit(this); \
|
||||
|
@ -180,15 +178,15 @@ class BrowsingContext : public nsWrapperCache,
|
|||
// parent process. BrowsingContext objects are created attached by default, so
|
||||
// this method need only be called when restoring cached BrowsingContext
|
||||
// objects.
|
||||
void Attach(bool aFromIPC = false);
|
||||
void Attach();
|
||||
|
||||
// Detach the current BrowsingContext from its parent, in both the
|
||||
// child and the parent process.
|
||||
void Detach(bool aFromIPC = false);
|
||||
void Detach();
|
||||
|
||||
// Remove all children from the current BrowsingContext and cache
|
||||
// them to allow them to be attached again.
|
||||
void CacheChildren(bool aFromIPC = false);
|
||||
void CacheChildren();
|
||||
|
||||
// Determine if the current BrowsingContext was 'cached' by the logic in
|
||||
// CacheChildren.
|
||||
|
@ -206,6 +204,10 @@ class BrowsingContext : public nsWrapperCache,
|
|||
|
||||
void GetChildren(nsTArray<RefPtr<BrowsingContext>>& aChildren);
|
||||
|
||||
BrowsingContext* GetOpener() const { return mOpener; }
|
||||
|
||||
void SetOpener(BrowsingContext* aOpener);
|
||||
|
||||
BrowsingContextGroup* Group() { return mGroup; }
|
||||
|
||||
// Using the rules for choosing a browsing context we try to find
|
||||
|
@ -239,6 +241,11 @@ class BrowsingContext : public nsWrapperCache,
|
|||
// activation flag of the top level browsing context.
|
||||
void NotifyResetUserGestureActivation();
|
||||
|
||||
// These functions would only be called in the top level browsing context.
|
||||
// They would set/reset the user gesture activation flag.
|
||||
void SetUserGestureActivation();
|
||||
void ResetUserGestureActivation();
|
||||
|
||||
// Return true if it corresponding document is activated by user gesture.
|
||||
bool GetUserGestureActivation();
|
||||
|
||||
|
@ -359,6 +366,7 @@ class BrowsingContext : public nsWrapperCache,
|
|||
RefPtr<BrowsingContextGroup> mGroup;
|
||||
RefPtr<BrowsingContext> mParent;
|
||||
Children mChildren;
|
||||
WeakPtr<BrowsingContext> mOpener;
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
// This is not a strong reference, but using a JS::Heap for that should be
|
||||
// fine. The JSObject stored in here should be a proxy with a
|
||||
|
@ -366,6 +374,10 @@ class BrowsingContext : public nsWrapperCache,
|
|||
// objectMoved hook and clear it from its finalize hook.
|
||||
JS::Heap<JSObject*> mWindowProxy;
|
||||
LocationProxy mLocation;
|
||||
|
||||
// This flag is only valid in the top level browsing context, it indicates
|
||||
// whether the corresponding document has been activated by user gesture.
|
||||
bool mIsActivatedByUserGesture;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,29 +37,6 @@ void BrowsingContextGroup::Unsubscribe(ContentParent* aOriginProcess) {
|
|||
aOriginProcess->OnBrowsingContextGroupUnsubscribe(this);
|
||||
}
|
||||
|
||||
void BrowsingContextGroup::EnsureSubscribed(ContentParent* aProcess) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aProcess);
|
||||
if (mSubscribers.Contains(aProcess)) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(
|
||||
mContexts.Count() == 1,
|
||||
"EnsureSubscribed doesn't work on non-fresh BrowsingContextGroups yet!");
|
||||
|
||||
// Subscribe to the BrowsingContext, and send down initial state!
|
||||
Subscribe(aProcess);
|
||||
|
||||
// XXX(nika): We can't send down existing BrowsingContextGroups reliably yet
|
||||
// due to ordering issues! (Bug ?)
|
||||
for (auto iter = mContexts.Iter(); !iter.Done(); iter.Next()) {
|
||||
RefPtr<BrowsingContext> bc = iter.Get()->GetKey();
|
||||
Unused << aProcess->SendAttachBrowsingContext(
|
||||
bc->GetParent(), bc->GetOpener(), BrowsingContextId(bc->Id()),
|
||||
bc->Name());
|
||||
}
|
||||
}
|
||||
|
||||
BrowsingContextGroup::~BrowsingContextGroup() {
|
||||
for (auto iter = mSubscribers.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsRefPtrHashKey<ContentParent>* entry = iter.Get();
|
||||
|
|
|
@ -43,9 +43,6 @@ class BrowsingContextGroup final : public nsWrapperCache {
|
|||
void Subscribe(ContentParent* aOriginProcess);
|
||||
void Unsubscribe(ContentParent* aOriginProcess);
|
||||
|
||||
// Force the given ContentParent to subscribe to our BrowsingContextGroup.
|
||||
void EnsureSubscribed(ContentParent* aProcess);
|
||||
|
||||
ContentParents::Iterator ContentParentsIter() { return mSubscribers.Iter(); }
|
||||
|
||||
// Get a reference to the list of toplevel contexts in this
|
||||
|
|
|
@ -89,6 +89,27 @@ JSObject* CanonicalBrowsingContext::WrapObject(
|
|||
return CanonicalBrowsingContext_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::NotifySetUserGestureActivationFromIPC(
|
||||
bool aIsUserGestureActivation) {
|
||||
if (!mCurrentWindowGlobal) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aIsUserGestureActivation) {
|
||||
SetUserGestureActivation();
|
||||
} else {
|
||||
ResetUserGestureActivation();
|
||||
}
|
||||
|
||||
USER_ACTIVATION_LOG("Chrome browsing context 0x%08" PRIx64
|
||||
" would notify other browsing contexts for updating "
|
||||
"user gesture activation flag.",
|
||||
Id());
|
||||
// XXX(alwu) : we need to sync the flag to other browsing contexts which are
|
||||
// not in the same child process where the flag was set. Will implement that
|
||||
// in bug1519229.
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::Traverse(
|
||||
nsCycleCollectionTraversalCallback& cb) {
|
||||
CanonicalBrowsingContext* tmp = this;
|
||||
|
|
|
@ -35,8 +35,6 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
}
|
||||
uint64_t OwnerProcessId() const { return mProcessId; }
|
||||
|
||||
void SetOwnerProcessId(uint64_t aProcessId) { mProcessId = aProcessId; }
|
||||
|
||||
void GetWindowGlobals(nsTArray<RefPtr<WindowGlobalParent>>& aWindows);
|
||||
|
||||
// Called by WindowGlobalParent to register and unregister window globals.
|
||||
|
|
|
@ -1848,20 +1848,6 @@ static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
|||
return BrowsingContext::Create(aParentContext, aOpenerContext, aName, type);
|
||||
}
|
||||
|
||||
static void GetFrameName(Element* aOwnerContent, nsAString& aFrameName) {
|
||||
int32_t namespaceID = aOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML && !aOwnerContent->IsInHTMLDocument()) {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aFrameName);
|
||||
} else {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, aFrameName);
|
||||
// XXX if no NAME then use ID, after a transition period this will be
|
||||
// changed so that XUL only uses ID too (bug 254284).
|
||||
if (aFrameName.IsEmpty() && namespaceID == kNameSpaceID_XUL) {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aFrameName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsFrameLoader::MaybeCreateDocShell() {
|
||||
if (mDocShell) {
|
||||
return NS_OK;
|
||||
|
@ -1903,7 +1889,18 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
|||
|
||||
// Determine the frame name for the new browsing context.
|
||||
nsAutoString frameName;
|
||||
GetFrameName(mOwnerContent, frameName);
|
||||
|
||||
int32_t namespaceID = mOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML && !mOwnerContent->IsInHTMLDocument()) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, frameName);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
|
||||
// XXX if no NAME then use ID, after a transition period this will be
|
||||
// changed so that XUL only uses ID too (bug 254284).
|
||||
if (frameName.IsEmpty() && namespaceID == kNameSpaceID_XUL) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, frameName);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if our new context is chrome or content
|
||||
bool isContent = parentBC->IsContent() ||
|
||||
|
@ -2536,17 +2533,8 @@ bool nsFrameLoader::TryRemoteBrowser() {
|
|||
|
||||
// If we're in a content process, create a RemoteFrameChild actor.
|
||||
if (XRE_IsContentProcess()) {
|
||||
// Determine the frame name for the new browsing context.
|
||||
nsAutoString frameName;
|
||||
GetFrameName(mOwnerContent, frameName);
|
||||
|
||||
// XXX(nika): due to limitations with Browsing Context Groups and multiple
|
||||
// processes, we can't link up aParent yet! (Bug 1532661)
|
||||
RefPtr<BrowsingContext> browsingContext =
|
||||
CreateBrowsingContext(nullptr, nullptr, frameName, true);
|
||||
|
||||
mRemoteFrameChild = RemoteFrameChild::Create(
|
||||
this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE), browsingContext);
|
||||
this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
|
||||
return !!mRemoteFrameChild;
|
||||
}
|
||||
|
||||
|
@ -3077,13 +3065,8 @@ already_AddRefed<nsITabParent> nsFrameLoader::GetTabParent() {
|
|||
|
||||
already_AddRefed<nsILoadContext> nsFrameLoader::LoadContext() {
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (IsRemoteFrame() &&
|
||||
(mRemoteBrowser || mRemoteFrameChild || TryRemoteBrowser())) {
|
||||
if (mRemoteBrowser) {
|
||||
loadContext = mRemoteBrowser->GetLoadContext();
|
||||
} else {
|
||||
loadContext = mRemoteFrameChild->GetLoadContext();
|
||||
}
|
||||
if (IsRemoteFrame() && (mRemoteBrowser || TryRemoteBrowser())) {
|
||||
loadContext = mRemoteBrowser->GetLoadContext();
|
||||
} else {
|
||||
loadContext = do_GetInterface(ToSupports(GetDocShell(IgnoreErrors())));
|
||||
}
|
||||
|
@ -3092,13 +3075,8 @@ already_AddRefed<nsILoadContext> nsFrameLoader::LoadContext() {
|
|||
|
||||
already_AddRefed<BrowsingContext> nsFrameLoader::GetBrowsingContext() {
|
||||
RefPtr<BrowsingContext> browsingContext;
|
||||
if (IsRemoteFrame() &&
|
||||
(mRemoteBrowser || mRemoteFrameChild || TryRemoteBrowser())) {
|
||||
if (mRemoteBrowser) {
|
||||
browsingContext = mRemoteBrowser->GetBrowsingContext();
|
||||
} else {
|
||||
browsingContext = mRemoteFrameChild->GetBrowsingContext();
|
||||
}
|
||||
if (IsRemoteFrame() && (mRemoteBrowser || TryRemoteBrowser())) {
|
||||
browsingContext = mRemoteBrowser->GetBrowsingContext();
|
||||
} else if (GetDocShell(IgnoreErrors())) {
|
||||
browsingContext = nsDocShell::Cast(mDocShell)->GetBrowsingContext();
|
||||
}
|
||||
|
|
|
@ -912,15 +912,9 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
tabGroup = new TabGroup();
|
||||
}
|
||||
|
||||
RefPtr<BrowsingContext> openerBC =
|
||||
aParent ? nsPIDOMWindowOuter::From(aParent)->GetBrowsingContext()
|
||||
: nullptr;
|
||||
RefPtr<BrowsingContext> browsingContext = BrowsingContext::Create(
|
||||
nullptr, openerBC, aName, BrowsingContext::Type::Content);
|
||||
|
||||
TabContext newTabContext = aTabOpener ? *aTabOpener : TabContext();
|
||||
RefPtr<TabChild> newChild = new TabChild(this, tabId, tabGroup, newTabContext,
|
||||
browsingContext, aChromeFlags);
|
||||
RefPtr<TabChild> newChild =
|
||||
new TabChild(this, tabId, tabGroup, newTabContext, aChromeFlags);
|
||||
|
||||
if (aTabOpener) {
|
||||
MOZ_ASSERT(ipcContext->type() == IPCTabContext::TPopupIPCTabContext);
|
||||
|
@ -934,7 +928,7 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
Unused << SendPBrowserConstructor(
|
||||
// We release this ref in DeallocPBrowserChild
|
||||
RefPtr<TabChild>(newChild).forget().take(), tabId, TabId(0), *ipcContext,
|
||||
aChromeFlags, GetID(), browsingContext, IsForBrowser());
|
||||
aChromeFlags, GetID(), IsForBrowser());
|
||||
|
||||
// Now that |newChild| has had its IPC link established, call |Init| to set it
|
||||
// up.
|
||||
|
@ -1703,11 +1697,12 @@ bool ContentChild::DeallocPJavaScriptChild(PJavaScriptChild* aChild) {
|
|||
return true;
|
||||
}
|
||||
|
||||
PBrowserChild* ContentChild::AllocPBrowserChild(
|
||||
const TabId& aTabId, const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext, const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID, BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser) {
|
||||
PBrowserChild* ContentChild::AllocPBrowserChild(const TabId& aTabId,
|
||||
const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForBrowser) {
|
||||
// We'll happily accept any kind of IPCTabContext here; we don't need to
|
||||
// check that it's of a certain type for security purposes, because we
|
||||
// believe whatever the parent process tells us.
|
||||
|
@ -1721,9 +1716,9 @@ PBrowserChild* ContentChild::AllocPBrowserChild(
|
|||
MOZ_CRASH("Invalid TabContext received from the parent process.");
|
||||
}
|
||||
|
||||
RefPtr<TabChild> child = TabChild::Create(
|
||||
static_cast<ContentChild*>(this), aTabId, aSameTabGroupAs,
|
||||
tc.GetTabContext(), aBrowsingContext, aChromeFlags);
|
||||
RefPtr<TabChild> child =
|
||||
TabChild::Create(static_cast<ContentChild*>(this), aTabId,
|
||||
aSameTabGroupAs, tc.GetTabContext(), aChromeFlags);
|
||||
|
||||
// The ref here is released in DeallocPBrowserChild.
|
||||
return child.forget().take();
|
||||
|
@ -1732,22 +1727,20 @@ PBrowserChild* ContentChild::AllocPBrowserChild(
|
|||
bool ContentChild::SendPBrowserConstructor(
|
||||
PBrowserChild* aActor, const TabId& aTabId, const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext, const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID, BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser) {
|
||||
const ContentParentId& aCpID, const bool& aIsForBrowser) {
|
||||
if (IsShuttingDown()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PContentChild::SendPBrowserConstructor(aActor, aTabId, aSameTabGroupAs,
|
||||
aContext, aChromeFlags, aCpID,
|
||||
aBrowsingContext, aIsForBrowser);
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvPBrowserConstructor(
|
||||
PBrowserChild* aActor, const TabId& aTabId, const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext, const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID, BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser) {
|
||||
const ContentParentId& aCpID, const bool& aIsForBrowser) {
|
||||
MOZ_ASSERT(!IsShuttingDown());
|
||||
|
||||
static bool hasRunOnce = false;
|
||||
|
@ -3686,35 +3679,6 @@ PContentChild::Result ContentChild::OnMessageReceived(const Message& aMsg,
|
|||
return result;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvAttachBrowsingContext(
|
||||
BrowsingContext* aParent, BrowsingContext* aOpener,
|
||||
BrowsingContextId aChildId, const nsString& aName) {
|
||||
RefPtr<BrowsingContext> child = BrowsingContext::Get(aChildId);
|
||||
MOZ_RELEASE_ASSERT(!child || child->IsCached());
|
||||
|
||||
if (!child) {
|
||||
child = BrowsingContext::CreateFromIPC(aParent, aOpener, aName,
|
||||
(uint64_t)aChildId, nullptr);
|
||||
}
|
||||
|
||||
child->Attach(/* aFromIPC */ true);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvDetachBrowsingContext(
|
||||
BrowsingContext* aContext, bool aMoveToBFCache) {
|
||||
MOZ_RELEASE_ASSERT(aContext);
|
||||
|
||||
if (aMoveToBFCache) {
|
||||
aContext->CacheChildren(/* aFromIPC */ true);
|
||||
} else {
|
||||
aContext->Detach(/* aFromIPC */ true);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvWindowClose(BrowsingContext* aContext,
|
||||
bool aTrustedCaller) {
|
||||
if (!aContext) {
|
||||
|
|
|
@ -200,7 +200,6 @@ class ContentChild final : public PContentChild,
|
|||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser);
|
||||
|
||||
bool DeallocPBrowserChild(PBrowserChild*);
|
||||
|
@ -518,14 +517,12 @@ class ContentChild final : public PContentChild,
|
|||
const IPCTabContext& context,
|
||||
const uint32_t& chromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser);
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPBrowserConstructor(
|
||||
PBrowserChild* aCctor, const TabId& aTabId, const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext, const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID, BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser) override;
|
||||
const ContentParentId& aCpID, const bool& aIsForBrowser) override;
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
|
||||
|
||||
|
@ -715,13 +712,6 @@ class ContentChild final : public PContentChild,
|
|||
|
||||
virtual void OnChannelReceivedMessage(const Message& aMsg) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvAttachBrowsingContext(
|
||||
BrowsingContext* aParentContext, BrowsingContext* aOpener,
|
||||
BrowsingContextId aContextId, const nsString& aName);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(BrowsingContext* aContext,
|
||||
bool aMoveToBFCache);
|
||||
|
||||
mozilla::ipc::IPCResult RecvWindowClose(BrowsingContext* aContext,
|
||||
bool aTrustedCaller);
|
||||
mozilla::ipc::IPCResult RecvWindowFocus(BrowsingContext* aContext);
|
||||
|
|
|
@ -1125,8 +1125,7 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
|
|||
}
|
||||
|
||||
RefPtr<ContentParent> constructorSender;
|
||||
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(),
|
||||
"Cannot allocate TabParent in content process");
|
||||
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Cannot allocate TabParent in content process");
|
||||
if (aOpenerContentParent) {
|
||||
constructorSender = aOpenerContentParent;
|
||||
} else {
|
||||
|
@ -1134,30 +1133,18 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
|
|||
constructorSender =
|
||||
GetNewOrUsedJSPluginProcess(aContext.JSPluginId(), initialPriority);
|
||||
} else {
|
||||
constructorSender =
|
||||
GetNewOrUsedBrowserProcess(aFrameElement, remoteType, initialPriority,
|
||||
nullptr, isPreloadBrowser);
|
||||
constructorSender = GetNewOrUsedBrowserProcess(
|
||||
aFrameElement, remoteType, initialPriority, nullptr,
|
||||
isPreloadBrowser);
|
||||
}
|
||||
if (!constructorSender) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: This BrowsingContext should be provided by the nsFrameLoader.
|
||||
// (bug 1523636)
|
||||
RefPtr<CanonicalBrowsingContext> browsingContext =
|
||||
BrowsingContext::Create(nullptr, nullptr, EmptyString(),
|
||||
BrowsingContext::Type::Content)
|
||||
.downcast<CanonicalBrowsingContext>();
|
||||
|
||||
// Ensure that our content process is subscribed to our newly created
|
||||
// BrowsingContextGroup.
|
||||
browsingContext->Group()->EnsureSubscribed(constructorSender);
|
||||
|
||||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
cpm->RegisterRemoteFrame(tabId, ContentParentId(0), openerTabId,
|
||||
aContext.AsIPCTabContext(),
|
||||
constructorSender->ChildID());
|
||||
aContext.AsIPCTabContext(),
|
||||
constructorSender->ChildID());
|
||||
|
||||
if (constructorSender) {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
|
@ -1184,17 +1171,15 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
|
|||
if (tabId == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<TabParent> tp = new TabParent(constructorSender, tabId, aContext,
|
||||
browsingContext, chromeFlags);
|
||||
|
||||
browsingContext->SetOwnerProcessId(constructorSender->ChildID());
|
||||
RefPtr<TabParent> tp(
|
||||
new TabParent(constructorSender, tabId, aContext, chromeFlags));
|
||||
|
||||
PBrowserParent* browser = constructorSender->SendPBrowserConstructor(
|
||||
// DeallocPBrowserParent() releases this ref.
|
||||
tp.forget().take(), tabId,
|
||||
aSameTabGroupAs ? aSameTabGroupAs->GetTabId() : TabId(0),
|
||||
aContext.AsIPCTabContext(), chromeFlags, constructorSender->ChildID(),
|
||||
browsingContext, constructorSender->IsForBrowser());
|
||||
constructorSender->IsForBrowser());
|
||||
|
||||
if (remoteType.EqualsLiteral(LARGE_ALLOCATION_REMOTE_TYPE)) {
|
||||
// Tell the TabChild object that it was created due to a Large-Allocation
|
||||
|
@ -3237,8 +3222,7 @@ bool ContentParent::CanOpenBrowser(const IPCTabContext& aContext) {
|
|||
PBrowserParent* ContentParent::AllocPBrowserParent(
|
||||
const TabId& aTabId, const TabId& aSameTabGroupAs,
|
||||
const IPCTabContext& aContext, const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpId, BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser) {
|
||||
const ContentParentId& aCpId, const bool& aIsForBrowser) {
|
||||
MOZ_ASSERT(!aSameTabGroupAs);
|
||||
|
||||
Unused << aCpId;
|
||||
|
@ -3296,17 +3280,10 @@ PBrowserParent* ContentParent::AllocPBrowserParent(
|
|||
// window is remote.
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_REMOTE_WINDOW;
|
||||
|
||||
CanonicalBrowsingContext* browsingContext =
|
||||
CanonicalBrowsingContext::Cast(aBrowsingContext);
|
||||
if (NS_WARN_IF(!browsingContext->IsOwnedByProcess(ChildID()))) {
|
||||
MOZ_ASSERT(false, "BrowsingContext not owned by the correct process!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MaybeInvalidTabContext tc(aContext);
|
||||
MOZ_ASSERT(tc.IsValid());
|
||||
TabParent* parent = new TabParent(this, aTabId, tc.GetTabContext(),
|
||||
browsingContext, chromeFlags);
|
||||
TabParent* parent = new TabParent(static_cast<ContentParent*>(this), aTabId,
|
||||
tc.GetTabContext(), chromeFlags);
|
||||
|
||||
// We release this ref in DeallocPBrowserParent()
|
||||
NS_ADDREF(parent);
|
||||
|
@ -3322,8 +3299,7 @@ bool ContentParent::DeallocPBrowserParent(PBrowserParent* frame) {
|
|||
mozilla::ipc::IPCResult ContentParent::RecvPBrowserConstructor(
|
||||
PBrowserParent* actor, const TabId& tabId, const TabId& sameTabGroupAs,
|
||||
const IPCTabContext& context, const uint32_t& chromeFlags,
|
||||
const ContentParentId& cpId, BrowsingContext* aBrowsingContext,
|
||||
const bool& isForBrowser) {
|
||||
const ContentParentId& cpId, const bool& isForBrowser) {
|
||||
TabParent* parent = TabParent::GetFrom(actor);
|
||||
// When enabling input event prioritization, input events may preempt other
|
||||
// normal priority IPC messages. To prevent the input events preempt
|
||||
|
@ -3631,8 +3607,7 @@ bool ContentParent::DeallocPChildToParentStreamParent(
|
|||
}
|
||||
|
||||
PParentToChildStreamParent* ContentParent::AllocPParentToChildStreamParent() {
|
||||
MOZ_CRASH(
|
||||
"PParentToChildStreamParent actors should be manually constructed!");
|
||||
MOZ_CRASH("PParentToChildStreamParent actors should be manually constructed!");
|
||||
}
|
||||
|
||||
bool ContentParent::DeallocPParentToChildStreamParent(
|
||||
|
@ -5733,8 +5708,6 @@ mozilla::ipc::IPCResult ContentParent::RecvAttachBrowsingContext(
|
|||
(uint64_t)aChildId, this);
|
||||
}
|
||||
|
||||
child->Attach(/* aFromIPC */ true);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -5761,14 +5734,54 @@ mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
|
|||
}
|
||||
|
||||
if (aMoveToBFCache) {
|
||||
aContext->CacheChildren(/* aFromIPC */ true);
|
||||
aContext->CacheChildren();
|
||||
} else {
|
||||
aContext->Detach(/* aFromIPC */ true);
|
||||
aContext->Detach();
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvSetOpenerBrowsingContext(
|
||||
BrowsingContext* aContext, BrowsingContext* aOpener) {
|
||||
if (!aContext) {
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
("ParentIPC: Trying to set opener already detached"));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (!aContext->Canonical()->IsOwnedByProcess(ChildID())) {
|
||||
// Where trying to set opener on a child BrowsingContext in
|
||||
// another child process. This is illegal since the owner of the
|
||||
// BrowsingContext is the proccess with the in-process docshell,
|
||||
// which is tracked by OwnerProcessId.
|
||||
|
||||
// TODO(farre): To crash or not to crash. Same reasoning as in
|
||||
// above TODO. [Bug 1471598]
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Warning,
|
||||
("ParentIPC: Trying to set opener on out of process context "
|
||||
"0x%08" PRIx64,
|
||||
aContext->Id()));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
aContext->SetOpener(aOpener);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvSetUserGestureActivation(
|
||||
BrowsingContext* aContext, bool aNewValue) {
|
||||
if (!aContext) {
|
||||
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
("ParentIPC: Trying to activate wrong context"));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
aContext->Canonical()->NotifySetUserGestureActivationFromIPC(aNewValue);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void ContentParent::RegisterRemoteWorkerActor() { ++mRemoteWorkerActors; }
|
||||
|
||||
void ContentParent::UnregisterRemoveWorkerActor() {
|
||||
|
|
|
@ -618,6 +618,9 @@ class ContentParent final : public PContentParent,
|
|||
mozilla::ipc::IPCResult RecvDetachBrowsingContext(BrowsingContext* aContext,
|
||||
bool aMoveToBFCache);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetOpenerBrowsingContext(
|
||||
BrowsingContext* aContext, BrowsingContext* aOpener);
|
||||
|
||||
mozilla::ipc::IPCResult RecvWindowClose(BrowsingContext* aContext,
|
||||
bool aTrustedCaller);
|
||||
mozilla::ipc::IPCResult RecvWindowFocus(BrowsingContext* aContext);
|
||||
|
@ -626,6 +629,9 @@ class ContentParent final : public PContentParent,
|
|||
BrowsingContext* aContext, const ClonedMessageData& aMessage,
|
||||
const PostMessageData& aData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetUserGestureActivation(
|
||||
BrowsingContext* aContext, bool aNewValue);
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
||||
|
||||
protected:
|
||||
|
@ -818,7 +824,6 @@ class ContentParent final : public PContentParent,
|
|||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpId,
|
||||
BrowsingContext* aBrowsingContext,
|
||||
const bool& aIsForBrowser);
|
||||
|
||||
bool DeallocPBrowserParent(PBrowserParent* frame);
|
||||
|
@ -826,8 +831,7 @@ class ContentParent final : public PContentParent,
|
|||
virtual mozilla::ipc::IPCResult RecvPBrowserConstructor(
|
||||
PBrowserParent* actor, const TabId& tabId, const TabId& sameTabGroupAs,
|
||||
const IPCTabContext& context, const uint32_t& chromeFlags,
|
||||
const ContentParentId& cpId, BrowsingContext* aBrowsingContext,
|
||||
const bool& isForBrowser) override;
|
||||
const ContentParentId& cpId, const bool& isForBrowser) override;
|
||||
|
||||
PIPCBlobInputStreamParent* AllocPIPCBlobInputStreamParent(
|
||||
const nsID& aID, const uint64_t& aSize);
|
||||
|
|
|
@ -178,8 +178,7 @@ parent:
|
|||
/**
|
||||
* Construct a new Remote iframe actor.
|
||||
*/
|
||||
async PRemoteFrame(nsString aPresentationURL, nsString aRemoteType,
|
||||
BrowsingContext aBrowsingContext);
|
||||
async PRemoteFrame(nsString aPresentationURL, nsString aRemoteType);
|
||||
|
||||
/**
|
||||
* Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
|
||||
|
@ -621,6 +620,8 @@ parent:
|
|||
sync SetPrefersReducedMotionOverrideForTest(bool aValue);
|
||||
sync ResetPrefersReducedMotionOverrideForTest();
|
||||
|
||||
async RootBrowsingContext(BrowsingContext aContext);
|
||||
|
||||
child:
|
||||
/**
|
||||
* Notify the remote browser that it has been Show()n on this
|
||||
|
|
|
@ -393,8 +393,7 @@ both:
|
|||
// Keep the last 3 attributes in sync with GetProcessAttributes!
|
||||
async PBrowser(TabId tabId, TabId sameTabGroupAs,
|
||||
IPCTabContext context, uint32_t chromeFlags,
|
||||
ContentParentId cpId, BrowsingContext browsingContext,
|
||||
bool isForBrowser);
|
||||
ContentParentId cpId, bool isForBrowser);
|
||||
|
||||
async PFileDescriptorSet(FileDescriptor fd);
|
||||
|
||||
|
@ -1228,26 +1227,6 @@ parent:
|
|||
|
||||
async StoreUserInteractionAsPermission(Principal aPrincipal);
|
||||
|
||||
both:
|
||||
async CommitBrowsingContextTransaction(BrowsingContext aContext,
|
||||
BrowsingContextTransaction aTransaction);
|
||||
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
Principal aPrincipal, ClonedMessageData aData);
|
||||
|
||||
/**
|
||||
* Notify `push-subscription-modified` observers in the parent and child.
|
||||
*/
|
||||
async NotifyPushSubscriptionModifiedObservers(nsCString scope,
|
||||
Principal principal);
|
||||
|
||||
/**
|
||||
* Send a Push error message to all service worker clients in the parent or
|
||||
* child.
|
||||
*/
|
||||
async PushError(nsCString scope, Principal principal, nsString message,
|
||||
uint32_t flags);
|
||||
|
||||
/**
|
||||
* Sync the BrowsingContext with id 'aContextId' and name 'aName' to the
|
||||
* parent, and attach it to the BrowsingContext 'aParentContext'. If
|
||||
|
@ -1276,6 +1255,39 @@ both:
|
|||
async DetachBrowsingContext(BrowsingContext aContext,
|
||||
bool aMoveToBFCache);
|
||||
|
||||
/**
|
||||
* Set the opener of browsing context 'aContext' to the browsing context
|
||||
* with id 'aOpenerId'.
|
||||
*/
|
||||
async SetOpenerBrowsingContext(BrowsingContext aContext,
|
||||
BrowsingContext aOpenerContext);
|
||||
|
||||
/**
|
||||
* Notify parent to update user gesture activation flag.
|
||||
*/
|
||||
async SetUserGestureActivation(BrowsingContext aContext,
|
||||
bool aNewValue);
|
||||
|
||||
both:
|
||||
async CommitBrowsingContextTransaction(BrowsingContext aContext,
|
||||
BrowsingContextTransaction aTransaction);
|
||||
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
Principal aPrincipal, ClonedMessageData aData);
|
||||
|
||||
/**
|
||||
* Notify `push-subscription-modified` observers in the parent and child.
|
||||
*/
|
||||
async NotifyPushSubscriptionModifiedObservers(nsCString scope,
|
||||
Principal principal);
|
||||
|
||||
/**
|
||||
* Send a Push error message to all service worker clients in the parent or
|
||||
* child.
|
||||
*/
|
||||
async PushError(nsCString scope, Principal principal, nsString message,
|
||||
uint32_t flags);
|
||||
|
||||
async WindowClose(BrowsingContext aContext, bool aTrustedCaller);
|
||||
async WindowFocus(BrowsingContext aContext);
|
||||
async WindowBlur(BrowsingContext aContext);
|
||||
|
|
|
@ -5,25 +5,20 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/RemoteFrameChild.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
RemoteFrameChild::RemoteFrameChild(nsFrameLoader* aFrameLoader,
|
||||
BrowsingContext* aBrowsingContext)
|
||||
: mLayersId{0},
|
||||
mIPCOpen(true),
|
||||
mFrameLoader(aFrameLoader),
|
||||
mBrowsingContext(aBrowsingContext) {}
|
||||
RemoteFrameChild::RemoteFrameChild(nsFrameLoader* aFrameLoader)
|
||||
: mLayersId{0}, mIPCOpen(true), mFrameLoader(aFrameLoader) {}
|
||||
|
||||
RemoteFrameChild::~RemoteFrameChild() {}
|
||||
|
||||
already_AddRefed<RemoteFrameChild> RemoteFrameChild::Create(
|
||||
nsFrameLoader* aFrameLoader, const TabContext& aContext,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext) {
|
||||
const nsString& aRemoteType) {
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
|
||||
// Determine our embedder's TabChild actor.
|
||||
|
@ -36,14 +31,11 @@ already_AddRefed<RemoteFrameChild> RemoteFrameChild::Create(
|
|||
RefPtr<TabChild> tabChild = TabChild::GetFrom(docShell);
|
||||
MOZ_DIAGNOSTIC_ASSERT(tabChild);
|
||||
|
||||
RefPtr<RemoteFrameChild> remoteFrame =
|
||||
new RemoteFrameChild(aFrameLoader, aBrowsingContext);
|
||||
|
||||
RefPtr<RemoteFrameChild> remoteFrame = new RemoteFrameChild(aFrameLoader);
|
||||
// Reference is freed in TabChild::DeallocPRemoteFrameChild.
|
||||
tabChild->SendPRemoteFrameConstructor(
|
||||
do_AddRef(remoteFrame).take(),
|
||||
PromiseFlatString(aContext.PresentationURL()), aRemoteType,
|
||||
aBrowsingContext);
|
||||
PromiseFlatString(aContext.PresentationURL()), aRemoteType);
|
||||
remoteFrame->mIPCOpen = true;
|
||||
|
||||
return remoteFrame.forget();
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class BrowsingContext;
|
||||
|
||||
/**
|
||||
* Child side for a remote frame.
|
||||
|
@ -28,14 +27,9 @@ class RemoteFrameChild : public PRemoteFrameChild {
|
|||
|
||||
mozilla::layers::LayersId GetLayersId() { return mLayersId; }
|
||||
|
||||
BrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
|
||||
|
||||
// XXX(nika): We should have a load context here. (bug 1532664)
|
||||
nsILoadContext* GetLoadContext() { return nullptr; }
|
||||
|
||||
static already_AddRefed<RemoteFrameChild> Create(
|
||||
nsFrameLoader* aFrameLoader, const TabContext& aContext,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext);
|
||||
static already_AddRefed<RemoteFrameChild> Create(nsFrameLoader* aFrameLoader,
|
||||
const TabContext& aContext,
|
||||
const nsString& aRemoteType);
|
||||
|
||||
void UpdateDimensions(const nsIntRect& aRect,
|
||||
const mozilla::ScreenIntSize& aSize);
|
||||
|
@ -49,14 +43,12 @@ class RemoteFrameChild : public PRemoteFrameChild {
|
|||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
private:
|
||||
explicit RemoteFrameChild(nsFrameLoader* aFrameLoader,
|
||||
BrowsingContext* aBrowsingContext);
|
||||
explicit RemoteFrameChild(nsFrameLoader* aFrameLoader);
|
||||
~RemoteFrameChild();
|
||||
|
||||
mozilla::layers::LayersId mLayersId;
|
||||
bool mIPCOpen;
|
||||
RefPtr<nsFrameLoader> mFrameLoader;
|
||||
RefPtr<BrowsingContext> mBrowsingContext;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "mozilla/dom/RemoteFrameParent.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/ContentProcessManager.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/dom/BrowsingContextGroup.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::layout;
|
||||
|
@ -21,8 +19,7 @@ RemoteFrameParent::RemoteFrameParent() : mIPCOpen(false) {}
|
|||
RemoteFrameParent::~RemoteFrameParent() {}
|
||||
|
||||
nsresult RemoteFrameParent::Init(const nsString& aPresentationURL,
|
||||
const nsString& aRemoteType,
|
||||
CanonicalBrowsingContext* aBrowsingContext) {
|
||||
const nsString& aRemoteType) {
|
||||
mIPCOpen = true;
|
||||
|
||||
// FIXME: This should actually use a non-bogus TabContext, probably inherited
|
||||
|
@ -46,11 +43,6 @@ nsresult RemoteFrameParent::Init(const nsString& aPresentationURL,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Ensure that our content process is subscribed to our newly created
|
||||
// BrowsingContextGroup.
|
||||
aBrowsingContext->Group()->EnsureSubscribed(constructorSender);
|
||||
aBrowsingContext->SetOwnerProcessId(constructorSender->ChildID());
|
||||
|
||||
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
|
||||
TabId tabId(nsContentUtils::GenerateTabId());
|
||||
cpm->RegisterRemoteFrame(tabId, ContentParentId(0), TabId(0),
|
||||
|
@ -59,13 +51,13 @@ nsresult RemoteFrameParent::Init(const nsString& aPresentationURL,
|
|||
|
||||
// Construct the TabParent object for our subframe.
|
||||
uint32_t chromeFlags = 0;
|
||||
RefPtr<TabParent> tabParent = new TabParent(
|
||||
constructorSender, tabId, tabContext, aBrowsingContext, chromeFlags);
|
||||
RefPtr<TabParent> tabParent(
|
||||
new TabParent(constructorSender, tabId, tabContext, chromeFlags));
|
||||
|
||||
PBrowserParent* browser = constructorSender->SendPBrowserConstructor(
|
||||
// DeallocPBrowserParent() releases this ref.
|
||||
tabParent.forget().take(), tabId, TabId(0), tabContext.AsIPCTabContext(),
|
||||
chromeFlags, constructorSender->ChildID(), aBrowsingContext,
|
||||
chromeFlags, constructorSender->ChildID(),
|
||||
constructorSender->IsForBrowser());
|
||||
if (NS_WARN_IF(!browser)) {
|
||||
MOZ_ASSERT(false, "Browser Constructor Failed");
|
||||
|
|
|
@ -20,15 +20,10 @@ class RemoteFrameParent : public PRemoteFrameParent {
|
|||
RemoteFrameParent();
|
||||
|
||||
// Initialize this actor after performing startup.
|
||||
nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType,
|
||||
CanonicalBrowsingContext* aBrowsingContext);
|
||||
nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType);
|
||||
|
||||
TabParent* GetTabParent() { return mTabParent; }
|
||||
|
||||
CanonicalBrowsingContext* GetBrowsingContext() {
|
||||
return mTabParent->GetBrowsingContext();
|
||||
}
|
||||
|
||||
// Get our manager actor.
|
||||
TabParent* Manager() {
|
||||
MOZ_ASSERT(mIPCOpen);
|
||||
|
|
|
@ -354,22 +354,20 @@ already_AddRefed<TabChild> TabChild::Create(ContentChild* aManager,
|
|||
const TabId& aTabId,
|
||||
const TabId& aSameTabGroupAs,
|
||||
const TabContext& aContext,
|
||||
BrowsingContext* aBrowsingContext,
|
||||
uint32_t aChromeFlags) {
|
||||
RefPtr<TabChild> groupChild = FindTabChild(aSameTabGroupAs);
|
||||
dom::TabGroup* group = groupChild ? groupChild->TabGroup() : nullptr;
|
||||
RefPtr<TabChild> iframe = new TabChild(aManager, aTabId, group, aContext,
|
||||
aBrowsingContext, aChromeFlags);
|
||||
RefPtr<TabChild> iframe =
|
||||
new TabChild(aManager, aTabId, group, aContext, aChromeFlags);
|
||||
return iframe.forget();
|
||||
}
|
||||
|
||||
TabChild::TabChild(ContentChild* aManager, const TabId& aTabId,
|
||||
dom::TabGroup* aTabGroup, const TabContext& aContext,
|
||||
BrowsingContext* aBrowsingContext, uint32_t aChromeFlags)
|
||||
uint32_t aChromeFlags)
|
||||
: TabContext(aContext),
|
||||
mTabGroup(aTabGroup),
|
||||
mManager(aManager),
|
||||
mBrowsingContext(aBrowsingContext),
|
||||
mChromeFlags(aChromeFlags),
|
||||
mMaxTouchPoints(0),
|
||||
mLayersId{0},
|
||||
|
@ -523,8 +521,9 @@ nsresult TabChild::Init(mozIDOMWindowProxy* aParent) {
|
|||
nullptr // HandleWidgetEvent
|
||||
);
|
||||
|
||||
mWebBrowser = nsWebBrowser::Create(this, mPuppetWidget, OriginAttributesRef(),
|
||||
mBrowsingContext);
|
||||
mWebBrowser =
|
||||
nsWebBrowser::Create(this, mPuppetWidget, OriginAttributesRef(), aParent,
|
||||
nsIDocShellTreeItem::typeContentWrapper);
|
||||
nsIWebBrowser* webBrowser = mWebBrowser;
|
||||
|
||||
mWebNav = do_QueryInterface(webBrowser);
|
||||
|
@ -554,6 +553,11 @@ nsresult TabChild::Init(mozIDOMWindowProxy* aParent) {
|
|||
loadContext->SetRemoteTabs(mChromeFlags &
|
||||
nsIWebBrowserChrome::CHROME_REMOTE_WINDOW);
|
||||
|
||||
// Send our browsing context to the parent process.
|
||||
RefPtr<BrowsingContext> browsingContext =
|
||||
nsDocShell::Cast(docShell)->GetBrowsingContext();
|
||||
SendRootBrowsingContext(browsingContext);
|
||||
|
||||
// Few lines before, baseWindow->Create() will end up creating a new
|
||||
// window root in nsGlobalWindow::SetDocShell.
|
||||
// Then this chrome event handler, will be inherited to inner windows.
|
||||
|
@ -3180,8 +3184,7 @@ bool TabChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) {
|
|||
}
|
||||
|
||||
PRemoteFrameChild* TabChild::AllocPRemoteFrameChild(const nsString&,
|
||||
const nsString&,
|
||||
BrowsingContext*) {
|
||||
const nsString&) {
|
||||
MOZ_CRASH("We should never be manually allocating PRemoteFrameChild actors");
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -232,8 +232,7 @@ class TabChild final : public TabChildBase,
|
|||
* Create a new TabChild object.
|
||||
*/
|
||||
TabChild(ContentChild* aManager, const TabId& aTabId, TabGroup* aTabGroup,
|
||||
const TabContext& aContext, BrowsingContext* aBrowsingContext,
|
||||
uint32_t aChromeFlags);
|
||||
const TabContext& aContext, uint32_t aChromeFlags);
|
||||
|
||||
nsresult Init(mozIDOMWindowProxy* aParent);
|
||||
|
||||
|
@ -242,7 +241,6 @@ class TabChild final : public TabChildBase,
|
|||
const TabId& aTabId,
|
||||
const TabId& aSameTabGroupAs,
|
||||
const TabContext& aContext,
|
||||
BrowsingContext* aBrowsingContext,
|
||||
uint32_t aChromeFlags);
|
||||
|
||||
// Let managees query if it is safe to send messages.
|
||||
|
@ -673,8 +671,7 @@ class TabChild final : public TabChildBase,
|
|||
virtual bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) override;
|
||||
|
||||
virtual PRemoteFrameChild* AllocPRemoteFrameChild(
|
||||
const nsString& aName, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext) override;
|
||||
const nsString& aName, const nsString& aRemoteType) override;
|
||||
|
||||
virtual bool DeallocPRemoteFrameChild(PRemoteFrameChild* aActor) override;
|
||||
|
||||
|
@ -807,7 +804,6 @@ class TabChild final : public TabChildBase,
|
|||
RefPtr<PuppetWidget> mPuppetWidget;
|
||||
nsCOMPtr<nsIURI> mLastURI;
|
||||
RefPtr<ContentChild> mManager;
|
||||
RefPtr<BrowsingContext> mBrowsingContext;
|
||||
uint32_t mChromeFlags;
|
||||
uint32_t mMaxTouchPoints;
|
||||
layers::LayersId mLayersId;
|
||||
|
|
|
@ -144,9 +144,7 @@ NS_IMPL_ISUPPORTS(TabParent, nsITabParent, nsIAuthPromptProvider,
|
|||
nsISupportsWeakReference)
|
||||
|
||||
TabParent::TabParent(ContentParent* aManager, const TabId& aTabId,
|
||||
const TabContext& aContext,
|
||||
CanonicalBrowsingContext* aBrowsingContext,
|
||||
uint32_t aChromeFlags)
|
||||
const TabContext& aContext, uint32_t aChromeFlags)
|
||||
: TabContext(aContext),
|
||||
mFrameElement(nullptr),
|
||||
mContentCache(*this),
|
||||
|
@ -164,7 +162,6 @@ TabParent::TabParent(ContentParent* aManager, const TabId& aTabId,
|
|||
mIsDestroyed(false),
|
||||
mChromeFlags(aChromeFlags),
|
||||
mDragValid(false),
|
||||
mBrowsingContext(aBrowsingContext),
|
||||
mTabId(aTabId),
|
||||
mCreatingWindow(false),
|
||||
mCursor(eCursorInvalid),
|
||||
|
@ -1001,17 +998,15 @@ bool TabParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) {
|
|||
return true;
|
||||
}
|
||||
|
||||
IPCResult TabParent::RecvPRemoteFrameConstructor(
|
||||
PRemoteFrameParent* aActor, const nsString& aName,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext) {
|
||||
static_cast<RemoteFrameParent*>(aActor)->Init(
|
||||
aName, aRemoteType, CanonicalBrowsingContext::Cast(aBrowsingContext));
|
||||
IPCResult TabParent::RecvPRemoteFrameConstructor(PRemoteFrameParent* aActor,
|
||||
const nsString& aName,
|
||||
const nsString& aRemoteType) {
|
||||
static_cast<RemoteFrameParent*>(aActor)->Init(aName, aRemoteType);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PRemoteFrameParent* TabParent::AllocPRemoteFrameParent(
|
||||
const nsString& aName, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext) {
|
||||
const nsString& aName, const nsString& aRemoteType) {
|
||||
// Reference freed in DeallocPRemoteFrameParent.
|
||||
return do_AddRef(new RemoteFrameParent()).take();
|
||||
}
|
||||
|
@ -3477,6 +3472,14 @@ mozilla::ipc::IPCResult TabParent::RecvGetSystemFont(nsCString* aFontName) {
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TabParent::RecvRootBrowsingContext(
|
||||
BrowsingContext* aBrowsingContext) {
|
||||
MOZ_ASSERT(!mBrowsingContext, "May only set browsing context once!");
|
||||
mBrowsingContext = CanonicalBrowsingContext::Cast(aBrowsingContext);
|
||||
MOZ_ASSERT(mBrowsingContext, "Invalid ID!");
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FakeChannel::OnAuthAvailable(nsISupports* aContext,
|
||||
nsIAuthInformation* aAuthInfo) {
|
||||
|
|
|
@ -101,8 +101,7 @@ class TabParent final : public PBrowserParent,
|
|||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
TabParent(ContentParent* aManager, const TabId& aTabId,
|
||||
const TabContext& aContext,
|
||||
CanonicalBrowsingContext* aBrowsingContext, uint32_t aChromeFlags);
|
||||
const TabContext& aContext, uint32_t aChromeFlags);
|
||||
|
||||
Element* GetOwnerElement() const { return mFrameElement; }
|
||||
already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter();
|
||||
|
@ -316,15 +315,14 @@ class TabParent final : public PBrowserParent,
|
|||
virtual mozilla::ipc::IPCResult RecvPWindowGlobalConstructor(
|
||||
PWindowGlobalParent* aActor, const WindowGlobalInit& aInit) override;
|
||||
|
||||
PRemoteFrameParent* AllocPRemoteFrameParent(
|
||||
const nsString& aPresentationURL, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext);
|
||||
PRemoteFrameParent* AllocPRemoteFrameParent(const nsString& aPresentationURL,
|
||||
const nsString& aRemoteType);
|
||||
|
||||
bool DeallocPRemoteFrameParent(PRemoteFrameParent* aActor);
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPRemoteFrameConstructor(
|
||||
PRemoteFrameParent* aActor, const nsString& aPresentationURL,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext) override;
|
||||
const nsString& aRemoteType) override;
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
|
||||
|
@ -622,6 +620,8 @@ class TabParent final : public PBrowserParent,
|
|||
mozilla::ipc::IPCResult RecvShowCanvasPermissionPrompt(
|
||||
const nsCString& aFirstPartyURI, const bool& aHideDoorHanger);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRootBrowsingContext(BrowsingContext* aContext);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetSystemFont(const nsCString& aFontName);
|
||||
mozilla::ipc::IPCResult RecvGetSystemFont(nsCString* aFontName);
|
||||
|
||||
|
|
|
@ -102,10 +102,9 @@ nsIWidget* nsWebBrowser::EnsureWidget() {
|
|||
/* static */
|
||||
already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
|
||||
nsIWebBrowserChrome* aContainerWindow, nsIWidget* aParentWidget,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
dom::BrowsingContext* aBrowsingContext) {
|
||||
RefPtr<nsWebBrowser> browser = new nsWebBrowser(
|
||||
aBrowsingContext->IsContent() ? typeContentWrapper : typeChromeWrapper);
|
||||
const OriginAttributes& aOriginAttributes, mozIDOMWindowProxy* aOpener,
|
||||
int aItemType) {
|
||||
RefPtr<nsWebBrowser> browser = new nsWebBrowser(aItemType);
|
||||
|
||||
// nsWebBrowser::SetContainer also calls nsWebBrowser::EnsureDocShellTreeOwner
|
||||
NS_ENSURE_SUCCESS(browser->SetContainerWindow(aContainerWindow), nullptr);
|
||||
|
@ -116,7 +115,19 @@ already_AddRefed<nsWebBrowser> nsWebBrowser::Create(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<nsDocShell> docShell = nsDocShell::Create(aBrowsingContext);
|
||||
// XXX(nika): Consider supporting creating nsWebBrowser for an existing
|
||||
// BrowsingContext (e.g. during a X-process load).
|
||||
using BrowsingContext = mozilla::dom::BrowsingContext;
|
||||
RefPtr<BrowsingContext> openerContext =
|
||||
aOpener ? nsPIDOMWindowOuter::From(aOpener)->GetBrowsingContext()
|
||||
: nullptr;
|
||||
|
||||
RefPtr<BrowsingContext> browsingContext = BrowsingContext::Create(
|
||||
/* aParent */ nullptr, openerContext, EmptyString(),
|
||||
aItemType != typeChromeWrapper ? BrowsingContext::Type::Content
|
||||
: BrowsingContext::Type::Chrome);
|
||||
|
||||
RefPtr<nsDocShell> docShell = nsDocShell::Create(browsingContext);
|
||||
if (NS_WARN_IF(!docShell)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class nsWebBrowser final : public nsIWebBrowser,
|
|||
static already_AddRefed<nsWebBrowser> Create(
|
||||
nsIWebBrowserChrome* aContainerWindow, nsIWidget* aParentWidget,
|
||||
const mozilla::OriginAttributes& aOriginAttributes,
|
||||
mozilla::dom::BrowsingContext* aBrowsingContext);
|
||||
mozIDOMWindowProxy* aOpener, int aItemType);
|
||||
|
||||
protected:
|
||||
virtual ~nsWebBrowser();
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::BrowsingContext;
|
||||
using mozilla::intl::LocaleService;
|
||||
|
||||
// Default URL for the hidden window, can be overridden by a pref on Mac
|
||||
|
@ -461,17 +460,13 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome,
|
|||
widget->Create(nullptr, 0, LayoutDeviceIntRect(0, 0, 0, 0), nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Create a BrowsingContext for our windowless browser.
|
||||
RefPtr<BrowsingContext> browsingContext =
|
||||
BrowsingContext::Create(nullptr, nullptr, EmptyString(),
|
||||
aIsChrome ? BrowsingContext::Type::Chrome
|
||||
: BrowsingContext::Type::Content);
|
||||
|
||||
/* Next, we create an instance of nsWebBrowser. Instances of this class have
|
||||
* an associated doc shell, which is what we're interested in.
|
||||
*/
|
||||
nsCOMPtr<nsIWebBrowser> browser =
|
||||
nsWebBrowser::Create(stub, widget, OriginAttributes(), browsingContext);
|
||||
nsWebBrowser::Create(stub, widget, OriginAttributes(), nullptr,
|
||||
aIsChrome ? nsIDocShellTreeItem::typeChromeWrapper
|
||||
: nsIDocShellTreeItem::typeContentWrapper);
|
||||
|
||||
if (NS_WARN_IF(!browser)) {
|
||||
NS_ERROR("Couldn't create instance of nsWebBrowser!");
|
||||
|
|
Загрузка…
Ссылка в новой задаче