Bug 1549270 - part 2: Mark EditorBase::RemoveAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato

Differential Revision: https://phabricator.services.mozilla.com/D30044

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-05-08 05:09:56 +00:00
Родитель e4c46a73ce
Коммит 6d224d7259
7 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -2378,8 +2378,8 @@ void EditorBase::CloneAttributesWithTransaction(Element& aDestElement,
RefPtr<nsDOMAttributeMap> destAttributes = destElement->Attributes();
while (RefPtr<Attr> attr = destAttributes->Item(0)) {
if (isDestElementInBody) {
RemoveAttributeWithTransaction(destElement,
*attr->NodeInfo()->NameAtom());
RemoveAttributeWithTransaction(
destElement, MOZ_KnownLive(*attr->NodeInfo()->NameAtom()));
} else {
destElement->UnsetAttr(kNameSpaceID_None, attr->NodeInfo()->NameAtom(),
true);

Просмотреть файл

@ -1189,6 +1189,7 @@ class EditorBase : public nsIEditor,
* @param aElement Element node which will lose aAttribute.
* @param aAttribute Attribute name to be removed from aElement.
*/
MOZ_CAN_RUN_SCRIPT
nsresult RemoveAttributeWithTransaction(Element& aElement,
nsAtom& aAttribute);

Просмотреть файл

@ -4177,8 +4177,8 @@ nsresult HTMLEditRules::MakeList(nsAtom& aListType, bool aEntireList,
return rv;
}
} else {
rv = HTMLEditorRef().RemoveAttributeWithTransaction(*curElement,
*nsGkAtoms::type);
rv = MOZ_KnownLive(HTMLEditorRef())
.RemoveAttributeWithTransaction(*curElement, *nsGkAtoms::type);
if (NS_WARN_IF(!CanHandleEditAction())) {
return NS_ERROR_EDITOR_DESTROYED;
}
@ -8089,8 +8089,8 @@ nsresult HTMLEditRules::SplitParagraph(
}
// Remove ID attribute on the paragraph from the existing right node.
rv = HTMLEditorRef().RemoveAttributeWithTransaction(aParentDivOrP,
*nsGkAtoms::id);
rv = MOZ_KnownLive(HTMLEditorRef())
.RemoveAttributeWithTransaction(aParentDivOrP, *nsGkAtoms::id);
if (NS_WARN_IF(!CanHandleEditAction())) {
return NS_ERROR_EDITOR_DESTROYED;
}
@ -10271,8 +10271,10 @@ nsresult HTMLEditRules::RemoveAlignment(nsINode& aNode,
// the current node is a block element
if (HTMLEditUtils::SupportsAlignAttr(*child)) {
// remove the ALIGN attribute if this element can have it
nsresult rv = HTMLEditorRef().RemoveAttributeWithTransaction(
*child->AsElement(), *nsGkAtoms::align);
nsresult rv =
MOZ_KnownLive(HTMLEditorRef())
.RemoveAttributeWithTransaction(
MOZ_KnownLive(*child->AsElement()), *nsGkAtoms::align);
if (NS_WARN_IF(!CanHandleEditAction())) {
return NS_ERROR_EDITOR_DESTROYED;
}

Просмотреть файл

@ -1546,6 +1546,7 @@ class HTMLEditor final : public TextEditor,
* or calls into nsTextEditor to set the page background.
*/
nsresult SetCSSBackgroundColorWithTransaction(const nsAString& aColor);
MOZ_CAN_RUN_SCRIPT
nsresult SetHTMLBackgroundColorWithTransaction(const nsAString& aColor);
virtual void InitializeSelectionAncestorLimit(

Просмотреть файл

@ -829,8 +829,8 @@ nsresult HTMLEditor::RemoveStyleInside(nsIContent& aNode, nsAtom* aProperty,
return rv;
}
} else {
nsresult rv =
RemoveAttributeWithTransaction(*aNode.AsElement(), *aAttribute);
nsresult rv = RemoveAttributeWithTransaction(
MOZ_KnownLive(*aNode.AsElement()), *aAttribute);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

Просмотреть файл

@ -364,6 +364,7 @@ interface nsIEditor : nsISupports
* @param aElement the content element to operate on
* @param aAttribute the string representation of the attribute to get
*/
[can_run_script]
void removeAttribute(in Element aElement,
in AString aAttribute);

Просмотреть файл

@ -386,6 +386,7 @@ interface nsIHTMLEditor : nsISupports
*
* @param aColor The HTML color string, such as "#ffccff" or "yellow"
*/
[can_run_script]
void setBackgroundColor(in AString aColor);
/**