Bug 1263696 - Block content loading for embed nodes that are ancestors of objects with data; r=bz

This commit is contained in:
Kyle Machulis
2016-04-11 11:53:26 -07:00
parent aa1bc3b42a
commit 494d00e510
8 changed files with 111 additions and 15 deletions

View File

@@ -20,8 +20,8 @@
#ifdef XP_MACOSX
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/HTMLObjectElement.h"
#endif
#include "mozilla/dom/HTMLObjectElement.h"
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
@@ -85,7 +85,7 @@ HTMLSharedObjectElement::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);
}
}
}
@@ -322,7 +322,7 @@ HTMLSharedObjectElement::GetAttributeMappingFunction() const
}
void
HTMLSharedObjectElement::StartObjectLoad(bool aNotify)
HTMLSharedObjectElement::StartObjectLoad(bool aNotify, bool aForceLoad)
{
// BindToTree can call us asynchronously, and we may be removed from the tree
// in the interim
@@ -331,7 +331,7 @@ HTMLSharedObjectElement::StartObjectLoad(bool aNotify)
return;
}
LoadObject(aNotify);
LoadObject(aNotify, aForceLoad);
SetIsNetworkCreated(false);
}
@@ -416,6 +416,15 @@ HTMLSharedObjectElement::BlockEmbedContentLoading()
if (parent->IsAnyOfHTMLElements(nsGkAtoms::video, nsGkAtoms::audio)) {
return true;
}
// If we have an ancestor that is an object with a source, it'll have an
// associated displayed type. If that type is not null, don't load content
// for the embed.
if (HTMLObjectElement* object = HTMLObjectElement::FromContent(parent)) {
uint32_t type = object->DisplayedType();
if (type != eType_Null) {
return true;
}
}
}
return false;
}