Bug 1332956 part 3. Implement the same behavior for <object>-inside-<object> and <object>-inside-mediaelement as we do for <embed> already. r=qdot

This commit is contained in:
Boris Zbarsky
2017-02-08 18:19:01 -05:00
parent 6de9ae9d5d
commit e5460d8ba1
10 changed files with 181 additions and 77 deletions

View File

@@ -79,7 +79,7 @@ HTMLObjectElement::DoneAddingChildren(bool aHaveNotified)
// If we're already in a document, we need to trigger the load
// Otherwise, BindToTree takes care of that.
if (IsInComposedDoc()) {
StartObjectLoad(aHaveNotified);
StartObjectLoad(aHaveNotified, false);
}
}
@@ -310,7 +310,8 @@ HTMLObjectElement::SetAttr(int32_t aNameSpaceID, nsIAtom *aName,
// a document, just in case that the caller wants to set additional
// attributes before inserting the node into the document.
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::data) {
aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::data &&
!BlockEmbedOrObjectContentLoading()) {
return LoadObject(aNotify, true);
}
@@ -327,7 +328,8 @@ HTMLObjectElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
// See comment in SetAttr
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::data) {
aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::data &&
!BlockEmbedOrObjectContentLoading()) {
return LoadObject(aNotify, true);
}
@@ -535,15 +537,16 @@ HTMLObjectElement::GetAttributeMappingFunction() const
}
void
HTMLObjectElement::StartObjectLoad(bool aNotify)
HTMLObjectElement::StartObjectLoad(bool aNotify, bool aForce)
{
// BindToTree can call us asynchronously, and we may be removed from the tree
// in the interim
if (!IsInComposedDoc() || !OwnerDoc()->IsActive()) {
if (!IsInComposedDoc() || !OwnerDoc()->IsActive() ||
BlockEmbedOrObjectContentLoading()) {
return;
}
LoadObject(aNotify);
LoadObject(aNotify, aForce);
SetIsNetworkCreated(false);
}