Bug 1035394 - Fix dangerous public destructors in editor - r=ehsan

This commit is contained in:
Benoit Jacob 2014-07-08 17:23:18 -04:00
parent 79c308b707
commit ae77343c7f
19 changed files with 50 additions and 10 deletions

View File

@ -16,6 +16,10 @@ ChangeAttributeTxn::ChangeAttributeTxn()
{
}
ChangeAttributeTxn::~ChangeAttributeTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(ChangeAttributeTxn, EditTxn,
mElement)

View File

@ -46,6 +46,7 @@ public:
NS_IMETHOD RedoTransaction();
protected:
virtual ~ChangeAttributeTxn();
/** the editor that created this transaction */
nsIEditor* mEditor;

View File

@ -32,6 +32,10 @@ CreateElementTxn::CreateElementTxn()
{
}
CreateElementTxn::~CreateElementTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(CreateElementTxn, EditTxn,
mParent,
mNewNode,

View File

@ -48,7 +48,8 @@ public:
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:
virtual ~CreateElementTxn();
/** the document into which the new node will be inserted */
nsEditor* mEditor;

View File

@ -17,6 +17,10 @@ DeleteNodeTxn::DeleteNodeTxn()
{
}
DeleteNodeTxn::~DeleteNodeTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteNodeTxn, EditTxn,
mNode,
mParent,

View File

@ -39,6 +39,7 @@ public:
NS_IMETHOD RedoTransaction();
protected:
virtual ~DeleteNodeTxn();
/** the element to delete */
nsCOMPtr<nsINode> mNode;

View File

@ -16,6 +16,10 @@ EditAggregateTxn::EditAggregateTxn()
{
}
EditAggregateTxn::~EditAggregateTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(EditAggregateTxn, EditTxn,
mChildren)

View File

@ -41,6 +41,7 @@ public:
NS_IMETHOD GetName(nsIAtom **aName);
protected:
virtual ~EditAggregateTxn();
nsTArray< nsRefPtr<EditTxn> > mChildren;
nsCOMPtr<nsIAtom> mName;

View File

@ -24,6 +24,10 @@ InsertElementTxn::InsertElementTxn()
{
}
InsertElementTxn::~InsertElementTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertElementTxn, EditTxn,
mNode,
mParent)

View File

@ -39,7 +39,8 @@ public:
NS_DECL_EDITTXN
protected:
virtual ~InsertElementTxn();
/** the element to insert */
nsCOMPtr<nsIDOMNode> mNode;

View File

@ -20,6 +20,10 @@ InsertTextTxn::InsertTextTxn()
{
}
InsertTextTxn::~InsertTextTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertTextTxn, EditTxn,
mElement)

View File

@ -57,6 +57,7 @@ public:
NS_IMETHOD GetData(nsString& aResult);
protected:
virtual ~InsertTextTxn();
/** return true if aOtherTxn immediately follows this txn */
virtual bool IsSequentialInsert(InsertTextTxn *aOtherTxn);

View File

@ -23,6 +23,10 @@ PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
{
}
PlaceholderTxn::~PlaceholderTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_CLASS(PlaceholderTxn)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PlaceholderTxn,

View File

@ -60,6 +60,7 @@ public:
NS_IMETHOD RememberEndingSelection();
protected:
virtual ~PlaceholderTxn();
/** the presentation shell, which we'll need to get the selection */
bool mAbsorb; // do we auto absorb any and all transaction?

View File

@ -24,6 +24,10 @@ SplitElementTxn::SplitElementTxn()
{
}
SplitElementTxn::~SplitElementTxn()
{
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(SplitElementTxn, EditTxn,
mParent,
mNewLeftNode)

View File

@ -45,7 +45,8 @@ public:
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:
virtual ~SplitElementTxn();
/** the element to operate upon */
nsCOMPtr<nsIDOMNode> mExistingRightNode;

View File

@ -67,10 +67,8 @@ class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLEditRules();
virtual ~nsHTMLEditRules();
nsHTMLEditRules();
// nsIEditRules methods
NS_IMETHOD Init(nsPlaintextEditor *aEditor);
@ -111,6 +109,7 @@ public:
NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
protected:
virtual ~nsHTMLEditRules();
enum RulesEndpoint
{

View File

@ -94,8 +94,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
nsHTMLEditor();
virtual ~nsHTMLEditor();
nsHTMLEditor();
bool GetReturnInParagraphCreatesNewParagraph();
@ -260,6 +259,8 @@ public:
static bool NodeIsBlockStatic(const mozilla::dom::Element* aElement);
static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
protected:
virtual ~nsHTMLEditor();
using nsEditor::IsBlockNode;
virtual bool IsBlockNode(nsINode *aNode);

View File

@ -54,8 +54,7 @@ public:
eTypedBreak /* user typed enter */
};
nsPlaintextEditor();
virtual ~nsPlaintextEditor();
nsPlaintextEditor();
/* ------------ nsIPlaintextEditor methods -------------- */
NS_DECL_NSIPLAINTEXTEDITOR
@ -162,6 +161,7 @@ public:
int32_t &aCaretStyle);
protected:
virtual ~nsPlaintextEditor();
NS_IMETHOD InitRules();
void BeginEditorInit();