Bug 1328605 - re-add support for type=content-foo in order to smooth the way for add-ons, r=bz

MozReview-Commit-ID: L4NeEAeEA

--HG--
extra : rebase_source : 29c7af2af3d6ed0a1ad3b2ccc16bb9fa04e9d1e5
This commit is contained in:
Gijs Kruitbosch 2017-01-04 17:33:19 +00:00
parent 91e141995c
commit 5854463126

View File

@ -988,8 +988,15 @@ nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
NS_PRECONDITION(mOwnerContent, "Must have owning content");
nsAutoString value;
bool isContent = mOwnerContent->AttrValueIs(
kNameSpaceID_None, TypeAttrName(), nsGkAtoms::content, eIgnoreCase);
bool isContent = false;
mOwnerContent->GetAttr(kNameSpaceID_None, TypeAttrName(), value);
// we accept "content" and "content-xxx" values.
// We ignore anything that comes after 'content-'.
isContent = value.LowerCaseEqualsLiteral("content") ||
StringBeginsWith(value, NS_LITERAL_STRING("content-"),
nsCaseInsensitiveStringComparator());
// Force mozbrowser frames to always be typeContent, even if the
// mozbrowser interfaces are disabled.
@ -2893,8 +2900,12 @@ nsFrameLoader::TryRemoteBrowser()
return false;
}
if (!mOwnerContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::content, eIgnoreCase)) {
nsAutoString value;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
if (!value.LowerCaseEqualsLiteral("content") &&
!StringBeginsWith(value, NS_LITERAL_STRING("content-"),
nsCaseInsensitiveStringComparator())) {
return false;
}
@ -3354,7 +3365,13 @@ nsFrameLoader::AttributeChanged(nsIDocument* aDocument,
#endif
parentTreeOwner->ContentShellRemoved(mDocShell);
if (aElement->AttrValueIs(kNameSpaceID_None, TypeAttrName(), nsGkAtoms::content, eIgnoreCase)) {
nsAutoString value;
aElement->GetAttr(kNameSpaceID_None, TypeAttrName(), value);
if (value.LowerCaseEqualsLiteral("content") ||
StringBeginsWith(value, NS_LITERAL_STRING("content-"),
nsCaseInsensitiveStringComparator())) {
parentTreeOwner->ContentShellAdded(mDocShell, is_primary);
}
}