mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2736 - Part 7: Re-work <frame> and <iframe> src attribute.
Use subject principal as triggering principal in <iframe>/<frame> "src" attribute.
This commit is contained in:
@@ -338,14 +338,14 @@ PrincipalAllowsBrowserFrame(nsIPrincipal* aPrincipal)
|
||||
nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aValue) {
|
||||
nsAttrValueOrString value(aValue);
|
||||
AfterMaybeChangeAttr(aNameSpaceID, aName, &value, aNotify);
|
||||
AfterMaybeChangeAttr(aNameSpaceID, aName, &value, aMaybeScriptedPrincipal, aNotify);
|
||||
} else {
|
||||
AfterMaybeChangeAttr(aNameSpaceID, aName, nullptr, aNotify);
|
||||
AfterMaybeChangeAttr(aNameSpaceID, aName, nullptr, aMaybeScriptedPrincipal, aNotify);
|
||||
}
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
@@ -378,7 +378,7 @@ nsGenericHTMLFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
|
||||
aOldValue, aSubjectPrincipal,
|
||||
aOldValue, aMaybeScriptedPrincipal,
|
||||
aNotify);
|
||||
}
|
||||
|
||||
@@ -388,20 +388,23 @@ nsGenericHTMLFrameElement::OnAttrSetButNotChanged(int32_t aNamespaceID,
|
||||
const nsAttrValueOrString& aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
AfterMaybeChangeAttr(aNamespaceID, aName, &aValue, aNotify);
|
||||
AfterMaybeChangeAttr(aNamespaceID, aName, &aValue, nullptr, aNotify);
|
||||
|
||||
return nsGenericHTMLElement::OnAttrSetButNotChanged(aNamespaceID, aName,
|
||||
aValue, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLFrameElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
|
||||
nsGenericHTMLFrameElement::AfterMaybeChangeAttr(int32_t aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::src) {
|
||||
mSrcTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
||||
this, aValue ? aValue->String() : EmptyString(), aMaybeScriptedPrincipal);
|
||||
if (aValue && (!IsHTMLElement(nsGkAtoms::iframe) ||
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc))) {
|
||||
// Don't propagate error here. The attribute was successfully set,
|
||||
|
||||
Reference in New Issue
Block a user