Bug 1349178 Make nsIEditor.transactionManager readonly r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 21 Mar 2017 20:57:15 +0900
changeset 348748 59fa92404734930fbb2432c4b055404773c97278
parent 348747 e0be781966d4e9169b8c3ae289e923621115f88f
child 348749 f0a0e2e9412ca5617a429f70509a895a55da9f7b
push id31535
push usercbook@mozilla.com
push dateWed, 22 Mar 2017 13:25:07 +0000
treeherdermozilla-central@ee30286771eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1349178
milestone55.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 1349178 Make nsIEditor.transactionManager readonly r=m_kato There are no app which replaces transaction manager of editor. Additionally, replacing transaction manager of an editor with different editor or same editor but after initialized again due to some reasons may cause unexpected problems. Therefore, this patch makes it readonly. MozReview-Commit-ID: K7zepOjrzvC
editor/libeditor/EditorBase.cpp
editor/nsIEditor.idl
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -783,26 +783,16 @@ EditorBase::GetTransactionManager(nsITra
   *aTxnManager = nullptr;
   NS_ENSURE_TRUE(mTxnMgr, NS_ERROR_FAILURE);
 
   NS_ADDREF(*aTxnManager = mTxnMgr);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-EditorBase::SetTransactionManager(nsITransactionManager* aTxnManager)
-{
-  NS_ENSURE_TRUE(aTxnManager, NS_ERROR_FAILURE);
-
-  // nsITransactionManager is builtinclass, so this is safe
-  mTxnMgr = static_cast<nsTransactionManager*>(aTxnManager);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 EditorBase::Undo(uint32_t aCount)
 {
   ForceCompositionEnd();
 
   bool hasTxnMgr, hasTransaction = false;
   CanUndo(&hasTxnMgr, &hasTransaction);
   NS_ENSURE_TRUE(hasTransaction, NS_OK);
 
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -167,17 +167,17 @@ interface nsIEditor  : nsISupports
     *                    to increase or decrease the count
     */
   void incrementModificationCount(in long aModCount);
 
   /* ------------ Transaction methods -------------- */
 
   /** transactionManager Get the transaction manager the editor is using.
     */
-  attribute nsITransactionManager transactionManager;
+  readonly attribute nsITransactionManager transactionManager;
 
   /** doTransaction() fires a transaction.
     * It is provided here so clients can create their own transactions.
     * If a transaction manager is present, it is used.
     * Otherwise, the transaction is just executed directly.
     *
     * @param aTxn the transaction to execute
     */