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
--- 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
*/