Bug 1282485 - Plugin fallback rule - don't use fallback when the descendant has an embed element
MozReview-Commit-ID: 4bSVVgFbKMX
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -3592,18 +3592,31 @@ nsObjectLoadingContent::HasGoodFallback(
nsTArray<nsCString> rulesList;
nsCString prefString;
if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackRules, &prefString))) {
ParseString(prefString, ',', rulesList);
}
for (uint32_t i = 0; i < rulesList.Length(); ++i) {
- // Add more rules here
-
+ // RULE "embed":
+ // Don't use fallback content if the object contains an <embed> inside its
+ // fallback content.
+ if (rulesList[i].EqualsLiteral("embed")) {
+ nsTArray<nsINodeList*> childNodes;
+ for (nsIContent* child = thisContent->GetFirstChild();
+ child;
+ child = child->GetNextNode(thisContent)) {
+ if (child->IsHTMLElement(nsGkAtoms::embed)) {
+ return false;
+ }
+ }
+ }
+
+ // RULE "true":
// By having a rule that returns true, we can put it at the end of the rules list
// to change the default-to-false behavior to be default-to-true.
if (rulesList[i].EqualsLiteral("true")) {
return true;
}
}
return false;