Bug 578696 part 5. Stop holding strong refs when calling CharacterDataWillChange. r=sicking
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 21 Jul 2010 11:33:32 -0400
changeset 48010 94bd54ac2261f4e640f254954293c7512ba1f06b
parent 48009 f6599baced65454bd4a95aac83533e89d9b5084a
child 48011 1a234f884921c0f78910c7b7fb556124c7711ab9
push id14533
push userbzbarsky@mozilla.com
push dateWed, 21 Jul 2010 15:42:13 +0000
treeherdermozilla-central@b20c759afb7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs578696
milestone2.0b3pre
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 578696 part 5. Stop holding strong refs when calling CharacterDataWillChange. r=sicking
content/base/public/nsIMutationObserver.h
content/base/src/nsNodeUtils.cpp
--- a/content/base/public/nsIMutationObserver.h
+++ b/content/base/public/nsIMutationObserver.h
@@ -112,16 +112,22 @@ public:
    *
    * This notification is not sent when a piece of content is
    * added/removed from the document (the other notifications are used
    * for that).
    *
    * @param aDocument The owner-document of aContent. Can be null.
    * @param aContent  The piece of content that changed. Is never null.
    * @param aInfo     The structure with information details about the change.
+   *
+   * @note Callers of this method might not hold a strong reference to the
+   *       observer.  The observer is responsible for making sure it stays
+   *       alive for the duration of the call as needed.  The observer may
+   *       assume that this call will happen when there are script blockers on
+   *       the stack.
    */
   virtual void CharacterDataWillChange(nsIDocument *aDocument,
                                        nsIContent* aContent,
                                        CharacterDataChangeInfo* aInfo) = 0;
 
   /**
    * Notification that the node value of a data node (text, cdata, pi, comment)
    * has changed.
--- a/content/base/src/nsNodeUtils.cpp
+++ b/content/base/src/nsNodeUtils.cpp
@@ -109,17 +109,17 @@ using namespace mozilla::dom;
   } while (node);                                                 \
   PR_END_MACRO
 
 void
 nsNodeUtils::CharacterDataWillChange(nsIContent* aContent,
                                      CharacterDataChangeInfo* aInfo)
 {
   nsIDocument* doc = aContent->GetOwnerDoc();
-  IMPL_STRONGREF_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
+  IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
                              (doc, aContent, aInfo));
 }
 
 void
 nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
                                   CharacterDataChangeInfo* aInfo)
 {
   nsIDocument* doc = aContent->GetOwnerDoc();