Bug 771435 - Fix nsEditor::DoTransaction to use transaction interfaces sanely; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-07-09 11:41:47 +03:00
Родитель aee28e1eec
Коммит 6ef3102fab
1 изменённых файлов: 2 добавлений и 15 удалений

Просмотреть файл

@ -617,19 +617,7 @@ NS_IMETHODIMP
nsEditor::DoTransaction(nsITransaction* aTxn)
{
if (mPlaceHolderBatch && !mPlaceHolderTxn) {
// it's pretty darn amazing how many different types of pointers this
// transaction goes through here. I bet this is a record.
// We start off with an EditTxn since that's what the factory returns.
nsRefPtr<EditTxn> editTxn = new PlaceholderTxn();
// Then we QI to an nsIAbsorbingTransaction to get at placeholder
// functionality
nsCOMPtr<nsIAbsorbingTransaction> plcTxn;
editTxn->QueryInterface(NS_GET_IID(nsIAbsorbingTransaction),
getter_AddRefs(plcTxn));
// have to use line above instead of "plcTxn = do_QueryInterface(editTxn);"
// due to our broken interface model for transactions.
nsCOMPtr<nsIAbsorbingTransaction> plcTxn = new PlaceholderTxn();
// save off weak reference to placeholder txn
mPlaceHolderTxn = do_GetWeakReference(plcTxn);
@ -637,8 +625,7 @@ nsEditor::DoTransaction(nsITransaction* aTxn)
// placeholder txn took ownership of this pointer
mSelState = nsnull;
// finally we QI to an nsITransaction since that's what DoTransaction()
// expects
// QI to an nsITransaction since that's what DoTransaction() expects
nsCOMPtr<nsITransaction> theTxn = do_QueryInterface(plcTxn);
// we will recurse, but will not hit this case in the nested call
DoTransaction(theTxn);