summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLIFrameElement.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 05:33:06 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 05:33:06 -0400
commit17f7e1c8c6fca351174bdbd73981aa8e44d0f9da (patch)
treee8ea42c3121ecd79638172d226a94ad241a21ea9 /dom/html/HTMLIFrameElement.cpp
parent940d191ef8b61309f4ea83d0fea77828f361251b (diff)
downloadUXP-17f7e1c8c6fca351174bdbd73981aa8e44d0f9da.tar
UXP-17f7e1c8c6fca351174bdbd73981aa8e44d0f9da.tar.gz
UXP-17f7e1c8c6fca351174bdbd73981aa8e44d0f9da.tar.lz
UXP-17f7e1c8c6fca351174bdbd73981aa8e44d0f9da.tar.xz
UXP-17f7e1c8c6fca351174bdbd73981aa8e44d0f9da.zip
Bug 1365092 - Move side effects of SetAttr and ParseAttribute to BeforeSetAttr and AfterSetAttr
* Moves side effects of nsGenericHTMLElement and Element's SetAttr, UnsetAttr, and ParseAttribute functions to the corresponding BeforeSetAttr and AfterSetAttr functions * Moves side effects of HTMLAnchorElement's SetAttr, UnsetAttr, and ParseAttribute functions to the corresponding BeforeSetAttr and AfterSetAttr functions * Moves side effects of HTMLImageElement's SetAttr function to the corresponding BeforeSetAttr and AfterSetAttr functions * Moves side effects of SetAttr, UnsetAttr, and ParseAttribute functions to BeforeSetAttr and AfterSetAttr Tag #1375
Diffstat (limited to 'dom/html/HTMLIFrameElement.cpp')
-rw-r--r--dom/html/HTMLIFrameElement.cpp67
1 files changed, 31 insertions, 36 deletions
diff --git a/dom/html/HTMLIFrameElement.cpp b/dom/html/HTMLIFrameElement.cpp
index 6ae4ec9dd..2b66cbd26 100644
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -182,54 +182,49 @@ HTMLIFrameElement::GetAttributeMappingFunction() const
}
nsresult
-HTMLIFrameElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- nsIAtom* aPrefix, const nsAString& aValue,
- bool aNotify)
-{
- nsresult rv = nsGenericHTMLFrameElement::SetAttr(aNameSpaceID, aName,
- aPrefix, aValue, aNotify);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::srcdoc) {
- // Don't propagate error here. The attribute was successfully set, that's
- // what we should reflect.
- LoadSrc();
- }
-
- return NS_OK;
-}
-
-nsresult
HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue, bool aNotify)
{
- if (aName == nsGkAtoms::sandbox &&
- aNameSpaceID == kNameSpaceID_None && mFrameLoader) {
- // If we have an nsFrameLoader, apply the new sandbox flags.
- // Since this is called after the setter, the sandbox flags have
- // alreay been updated.
- mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
+ AfterMaybeChangeAttr(aNameSpaceID, aName, aNotify);
+
+ if (aNameSpaceID == kNameSpaceID_None) {
+ if (aName == nsGkAtoms::sandbox) {
+ if (mFrameLoader) {
+ // If we have an nsFrameLoader, apply the new sandbox flags.
+ // Since this is called after the setter, the sandbox flags have
+ // alreay been updated.
+ mFrameLoader->ApplySandboxFlags(GetSandboxFlags());
+ }
+ }
}
return nsGenericHTMLFrameElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aNotify);
}
nsresult
-HTMLIFrameElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
- bool aNotify)
+HTMLIFrameElement::OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
+ const nsAttrValueOrString& aValue,
+ bool aNotify)
{
- // Invoke on the superclass.
- nsresult rv = nsGenericHTMLFrameElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (aNameSpaceID == kNameSpaceID_None &&
- aAttribute == nsGkAtoms::srcdoc) {
- // Fall back to the src attribute, if any
- LoadSrc();
- }
+ AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
+
+ return nsGenericHTMLFrameElement::OnAttrSetButNotChanged(aNamespaceID, aName,
+ aValue, aNotify);
+}
- return NS_OK;
+void
+HTMLIFrameElement::AfterMaybeChangeAttr(int32_t aNamespaceID,
+ nsIAtom* aName,
+ bool aNotify)
+{
+ if (aNamespaceID == kNameSpaceID_None) {
+ if (aName == nsGkAtoms::srcdoc) {
+ // Don't propagate errors from LoadSrc. The attribute was successfully
+ // set/unset, that's what we should reflect.
+ LoadSrc();
+ }
+ }
}
uint32_t