Bug 1549270 - part 1: Mark EditorBase::CloneAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 08 May 2019 04:46:56 +0000
changeset 531822 e9e1b9c2cab6cfa713c6119c5b32b1a928faa4f9
parent 531821 64ac5acae26bd63323e2f62890eae27380119bb3
child 531823 7755efc24f6d991b81598fca36a126f0fb1f565d
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1549270
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1549270 - part 1: Mark EditorBase::CloneAttributeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato Differential Revision: https://phabricator.services.mozilla.com/D30043
editor/libeditor/EditorBase.h
editor/libeditor/HTMLStyleEditor.cpp
editor/nsIEditor.idl
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1173,16 +1173,17 @@ class EditorBase : public nsIEditor,
    * aAttribute from aDestElement.
    *
    * @param aAttribute          Attribute name to be cloned.
    * @param aDestElement        Element node which will be set aAttribute or
    *                            whose aAttribute will be removed.
    * @param aSourceElement      Element node which provides the value of
    *                            aAttribute in aDestElement.
    */
+  MOZ_CAN_RUN_SCRIPT
   nsresult CloneAttributeWithTransaction(nsAtom& aAttribute,
                                          Element& aDestElement,
                                          Element& aSourceElement);
 
   /**
    * RemoveAttributeWithTransaction() removes aAttribute from aElement.
    *
    * @param aElement        Element node which will lose aAttribute.
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -799,22 +799,22 @@ nsresult HTMLEditor::RemoveStyleInside(n
         // a span that will carry those styles or class, then we can delete
         // the node.
         RefPtr<Element> spanNode =
             InsertContainerWithTransaction(aNode, *nsGkAtoms::span);
         if (NS_WARN_IF(!spanNode)) {
           return NS_ERROR_FAILURE;
         }
         nsresult rv = CloneAttributeWithTransaction(
-            *nsGkAtoms::style, *spanNode, *aNode.AsElement());
+            *nsGkAtoms::style, *spanNode, MOZ_KnownLive(*aNode.AsElement()));
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
         rv = CloneAttributeWithTransaction(*nsGkAtoms::_class, *spanNode,
-                                           *aNode.AsElement());
+                                           MOZ_KnownLive(*aNode.AsElement()));
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
       }
       nsresult rv =
           RemoveContainerWithTransaction(MOZ_KnownLive(*aNode.AsElement()));
       NS_ENSURE_SUCCESS(rv, rv);
     } else if (aNode.IsElement()) {
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -372,16 +372,17 @@ interface nsIEditor  : nsISupports
    * the destination node and delete those not in the source.
    *
    * The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
    * @param aAttribute     the name of the attribute to copy
    * @param aDestElement   the destination element to operate on
    * @param aSourceElement the source element to copy attributes from
    * @exception NS_ERROR_NULL_POINTER at least one of the elements is null
    */
+  [can_run_script]
   void cloneAttribute(in AString aAttribute,
                       in Element aDestElement, in Element aSourceElement);
 
   /**
    * cloneAttributes() is similar to Node::cloneNode(),
    *   it assures the attribute nodes of the destination are identical
    *   with the source node by copying all existing attributes from the
    *   source and deleting those not in the source.