forked from mirrors/gecko-dev
Bug 1611588 - Handle null BrowsingContext in ExternalHelperAppParent. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D61309 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f862fc3ecb
commit
d70ca2b3dc
2 changed files with 22 additions and 18 deletions
|
|
@ -80,6 +80,7 @@ void ExternalHelperAppParent::Init(
|
|||
SetPropertyAsInterface(NS_LITERAL_STRING("docshell.internalReferrer"),
|
||||
referrer);
|
||||
|
||||
if (aContext) {
|
||||
WindowGlobalParent* parent = aContext->Canonical()->GetCurrentWindowGlobal();
|
||||
if (parent) {
|
||||
RefPtr<BrowserParent> browser = parent->GetBrowserParent();
|
||||
|
|
@ -90,6 +91,7 @@ void ExternalHelperAppParent::Init(
|
|||
SetPrivate(isPrivate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helperAppService->CreateListener(aMimeContentType, this, aContext, aForceSave,
|
||||
nullptr, getter_AddRefs(mListener));
|
||||
|
|
|
|||
|
|
@ -1526,6 +1526,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
aChannel->GetContentLength(&mContentLength);
|
||||
}
|
||||
|
||||
if (mBrowsingContext) {
|
||||
mMaybeCloseWindowHelper = new MaybeCloseWindowHelper(mBrowsingContext);
|
||||
mMaybeCloseWindowHelper->SetShouldCloseWindow(mShouldCloseWindow);
|
||||
|
||||
|
|
@ -1538,6 +1539,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
mMaybeCloseWindowHelper->SetShouldCloseWindow(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now get the URI
|
||||
if (aChannel) {
|
||||
|
|
@ -1552,7 +1554,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
// download. We don't run this in the content process, since we have
|
||||
// an instance running in the parent as well, which will handle this
|
||||
// if needed.
|
||||
if (!XRE_IsContentProcess()) {
|
||||
if (!XRE_IsContentProcess() && mMaybeCloseWindowHelper) {
|
||||
mBrowsingContext = mMaybeCloseWindowHelper->MaybeCloseWindow();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue