Bug 781320 - Part 3: Set <iframe mozbrowser>'s name for iframes created via window.open. r=smaug

This commit is contained in:
Justin Lebar 2012-08-13 15:19:10 -04:00
Родитель 7d969f5310
Коммит 71ee834252
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -29,7 +29,7 @@ namespace {
* aOpenerFrameElement.
*/
already_AddRefed<nsHTMLIFrameElement>
CreateIframe(Element* aOpenerFrameElement)
CreateIframe(Element* aOpenerFrameElement, const nsAString& aName)
{
nsNodeInfoManager *nodeInfoManager =
aOpenerFrameElement->OwnerDoc()->NodeInfoManager();
@ -54,6 +54,10 @@ CreateIframe(Element* aOpenerFrameElement)
mozapp, /* aNotify = */ false);
}
// Copy the window name onto the iframe.
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
aName, /* aNotify = */ false);
return popupFrameElement.forget();
}
@ -131,7 +135,7 @@ BrowserElementParent::OpenWindowOOP(mozilla::dom::TabParent* aOpenerTabParent,
do_QueryInterface(aOpenerTabParent->GetOwnerElement());
NS_ENSURE_TRUE(openerFrameElement, false);
nsRefPtr<nsHTMLIFrameElement> popupFrameElement =
CreateIframe(openerFrameElement);
CreateIframe(openerFrameElement, aName);
// Normally an <iframe> element will try to create a frameLoader when the
// page touches iframe.contentWindow or sets iframe.src.
@ -189,7 +193,7 @@ BrowserElementParent::OpenWindowInProcess(nsIDOMWindow* aOpenerWindow,
do_QueryInterface(openerFrameDOMElement);
nsRefPtr<nsHTMLIFrameElement> popupFrameElement =
CreateIframe(openerFrameElement);
CreateIframe(openerFrameElement, aName);
NS_ENSURE_TRUE(popupFrameElement, false);
nsCAutoString spec;