Bug 1251032 - Send RenderFrame info down to child in BrowserFrameOpenWindow. r=kanru

MozReview-Commit-ID: LsFr95rujEJ

--HG--
extra : rebase_source : 3589facedf84f6d46890de002a48207907e50476
This commit is contained in:
Mike Conley 2016-03-31 00:58:05 -04:00
parent 3b67a7e41b
commit b73d131e88
6 changed files with 44 additions and 10 deletions

View File

@ -23,9 +23,12 @@
#include "nsVariant.h"
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
#include "mozilla/dom/CustomEvent.h"
#include "mozilla/layout/RenderFrameParent.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::layout;
namespace {
@ -205,9 +208,12 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
BrowserElementParent::OpenWindowResult
BrowserElementParent::OpenWindowOOP(TabParent* aOpenerTabParent,
TabParent* aPopupTabParent,
PRenderFrameParent* aRenderFrame,
const nsAString& aURL,
const nsAString& aName,
const nsAString& aFeatures)
const nsAString& aFeatures,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId)
{
// Create an iframe owned by the same document which owns openerFrameElement.
nsCOMPtr<Element> openerFrameElement = aOpenerTabParent->GetOwnerElement();
@ -241,6 +247,13 @@ BrowserElementParent::OpenWindowOOP(TabParent* aOpenerTabParent,
aPopupTabParent->SetOwnerElement(popupFrameElement);
popupFrameElement->AllowCreateFrameLoader();
popupFrameElement->CreateRemoteFrameLoader(aPopupTabParent);
RenderFrameParent* rfp = static_cast<RenderFrameParent*>(aRenderFrame);
if (!aPopupTabParent->SetRenderFrame(rfp) ||
!aPopupTabParent->GetRenderFrameInfo(aTextureFactoryIdentifier, aLayersId)) {
return BrowserElementParent::OPEN_WINDOW_IGNORED;
}
return opened;
}

View File

@ -22,6 +22,14 @@ namespace dom {
class TabParent;
} // namespace dom
namespace layers {
struct TextureFactoryIdentifier;
} // namespace layers
namespace layout {
class PRenderFrameParent;
} // namespace layout
/**
* BrowserElementParent implements a portion of the parent-process side of
* <iframe mozbrowser>.
@ -87,9 +95,12 @@ public:
static OpenWindowResult
OpenWindowOOP(dom::TabParent* aOpenerTabParent,
dom::TabParent* aPopupTabParent,
layout::PRenderFrameParent* aRenderFrame,
const nsAString& aURL,
const nsAString& aName,
const nsAString& aFeatures);
const nsAString& aFeatures,
layers::TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId);
/**
* Handle a window.open call from an in-process <iframe mozbrowser>.

View File

@ -858,9 +858,10 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
if (aIframeMoz) {
MOZ_ASSERT(aTabOpener);
newChild->SendBrowserFrameOpenWindow(aTabOpener, NS_ConvertUTF8toUTF16(url),
newChild->SendBrowserFrameOpenWindow(aTabOpener, renderFrame, NS_ConvertUTF8toUTF16(url),
name, NS_ConvertUTF8toUTF16(features),
aWindowIsNew);
aWindowIsNew, &textureFactoryIdentifier,
&layersId);
} else {
nsAutoCString baseURIString;
if (aTabOpener) {

View File

@ -409,9 +409,11 @@ parent:
*
* @param opener the PBrowser whose content called window.open.
*/
sync BrowserFrameOpenWindow(PBrowser opener, nsString aURL,
nsString aName, nsString aFeatures)
returns (bool windowOpened);
sync BrowserFrameOpenWindow(PBrowser opener, PRenderFrame renderFrame,
nsString aURL, nsString aName, nsString aFeatures)
returns (bool windowOpened,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId);
/**
* Tells the containing widget whether the given input block results in a

View File

@ -2731,14 +2731,18 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
bool
TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
PRenderFrameParent* aRenderFrame,
const nsString& aURL,
const nsString& aName,
const nsString& aFeatures,
bool* aOutWindowOpened)
bool* aOutWindowOpened,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId)
{
BrowserElementParent::OpenWindowResult opened =
BrowserElementParent::OpenWindowOOP(TabParent::GetFrom(aOpener),
this, aURL, aName, aFeatures);
this, aRenderFrame, aURL, aName, aFeatures,
aTextureFactoryIdentifier, aLayersId);
*aOutWindowOpened = (opened == BrowserElementParent::OPEN_WINDOW_ADDED);
return true;
}

View File

@ -167,10 +167,13 @@ public:
RecvDispatchAfterKeyboardEvent(const WidgetKeyboardEvent& aEvent) override;
virtual bool RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
PRenderFrameParent* aRenderFrame,
const nsString& aURL,
const nsString& aName,
const nsString& aFeatures,
bool* aOutWindowOpened) override;
bool* aOutWindowOpened,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) override;
virtual bool
RecvSyncMessage(const nsString& aMessage,