зеркало из https://github.com/mozilla/gecko-dev.git
Bug 850517 - Propagate ifr.setAttribute('name', 'foo') to the docshell. r=bz
This is correct per-spec. From HTML5's "The iframe element": "Whenever the name attribute is set, the nested browsing context's name must be changed to the new value. If the attribute is removed, the browsing context name must be set to the empty string."
This commit is contained in:
Родитель
dc74a1daab
Коммит
cf30596d4f
|
@ -227,6 +227,35 @@ nsGenericHTMLFrameElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
// Don't propagate error here. The attribute was successfully set, that's
|
||||
// what we should reflect.
|
||||
LoadSrc();
|
||||
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::name) {
|
||||
// Propagate "name" to the docshell to make browsing context names live,
|
||||
// per HTML5.
|
||||
nsIDocShell *docShell = mFrameLoader ? mFrameLoader->GetExistingDocShell()
|
||||
: nullptr;
|
||||
if (docShell) {
|
||||
docShell->SetName(PromiseFlatString(aValue).get());
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLFrameElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify)
|
||||
{
|
||||
// Invoke on the superclass.
|
||||
nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::name) {
|
||||
// Propagate "name" to the docshell to make browsing context names live,
|
||||
// per HTML5.
|
||||
nsIDocShell *docShell = mFrameLoader ? mFrameLoader->GetExistingDocShell()
|
||||
: nullptr;
|
||||
if (docShell) {
|
||||
docShell->SetName(EmptyString().get());
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -53,7 +53,9 @@ public:
|
|||
}
|
||||
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
bool aNotify);
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual void DestroyContent();
|
||||
|
||||
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
||||
|
|
Загрузка…
Ссылка в новой задаче