Bug 776129 - Part 1: When an <iframe mozbrowser> calls window.open, the resulting frame must be OOP iff the opener frame is OOP. r=smaug

This commit is contained in:
Justin Lebar committed 2012-08-17 17:07:54 -04:00
1 parent 08787e40a5
commit deecc512f1
2 files changed
+10 -3

No files matched your search

+1
View File
@@ -2373,6 +2373,7 @@ nsFrameLoader::SetRemoteBrowser(nsITabParent* aTabParent)
{
MOZ_ASSERT(!mRemoteBrowser);
MOZ_ASSERT(!mCurrentRemoteFrame);
mRemoteFrame = true;
mRemoteBrowser = static_cast<TabParent*>(aTabParent);
ShowRemoteFrame(nsIntSize(0, 0));
+9 -3
View File
@@ -29,7 +29,7 @@ namespace {
* aOpenerFrameElement.
*/
already_AddRefed<nsHTMLIFrameElement>
CreateIframe(Element* aOpenerFrameElement, const nsAString& aName)
CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
{
nsNodeInfoManager *nodeInfoManager =
aOpenerFrameElement->OwnerDoc()->NodeInfoManager();
@@ -58,6 +58,12 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName)
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
aName, /* aNotify = */ false);
// Indicate whether the iframe is should be remote.
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::Remote,
aRemote ? NS_LITERAL_STRING("true") :
NS_LITERAL_STRING("false"),
/* aNotify = */ false);
return popupFrameElement.forget();
}
@@ -135,7 +141,7 @@ BrowserElementParent::OpenWindowOOP(mozilla::dom::TabParent* aOpenerTabParent,
do_QueryInterface(aOpenerTabParent->GetOwnerElement());
NS_ENSURE_TRUE(openerFrameElement, false);
nsRefPtr<nsHTMLIFrameElement> popupFrameElement =
CreateIframe(openerFrameElement, aName);
CreateIframe(openerFrameElement, aName, /* aRemote = */ true);
// Normally an <iframe> element will try to create a frameLoader when the
// page touches iframe.contentWindow or sets iframe.src.
@@ -193,7 +199,7 @@ BrowserElementParent::OpenWindowInProcess(nsIDOMWindow* aOpenerWindow,
do_QueryInterface(openerFrameDOMElement);
nsRefPtr<nsHTMLIFrameElement> popupFrameElement =
CreateIframe(openerFrameElement, aName);
CreateIframe(openerFrameElement, aName, /* aRemote = */ false);
NS_ENSURE_TRUE(popupFrameElement, false);
nsCAutoString spec;