Bug 1349178 Make nsIEditor.transactionManager readonly r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 21 Mar 2017 20:57:15 +0900
changeset 502582 50d0082c6c5884b9689ede5a9b3d8a0510340808
parent 502581 f4652a1e66cd53e866befc8ef5301609360366a3
child 550195 deffd15cc731dfca9cbbb71efdb15bfe393f72f2
push id50323
push usermasayuki@d-toybox.com
push dateWed, 22 Mar 2017 01:15:39 +0000
reviewersm_kato
bugs1349178
milestone55.0a1
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
@@ -790,26 +790,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
     */