mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1028588 - Fix dangerous public destructors in editor/ - r=ehsan
This commit is contained in:
parent
e1b7dbca34
commit
f157151cfb
@ -31,6 +31,8 @@ public:
|
||||
void Init(bool aIsForMail) { mIsForMail = aIsForMail; }
|
||||
|
||||
private:
|
||||
~nsComposeTxtSrvFilter() {}
|
||||
|
||||
bool mIsForMail;
|
||||
};
|
||||
|
||||
|
@ -27,14 +27,16 @@ class nsString;
|
||||
// instance).
|
||||
class nsBaseComposerCommand : public nsIControllerCommand
|
||||
{
|
||||
protected:
|
||||
virtual ~nsBaseComposerCommand() {}
|
||||
|
||||
public:
|
||||
|
||||
nsBaseComposerCommand();
|
||||
virtual ~nsBaseComposerCommand() {}
|
||||
|
||||
nsBaseComposerCommand();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
// nsIControllerCommand. Declared longhand so we can make them pure virtual
|
||||
NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
|
||||
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandRefCon) = 0;
|
||||
@ -54,13 +56,13 @@ class nsBaseStateUpdatingCommand : public nsBaseComposerCommand
|
||||
{
|
||||
public:
|
||||
nsBaseStateUpdatingCommand(nsIAtom* aTagName);
|
||||
virtual ~nsBaseStateUpdatingCommand();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSICONTROLLERCOMMAND
|
||||
|
||||
protected:
|
||||
virtual ~nsBaseStateUpdatingCommand();
|
||||
|
||||
// get the current state (on or off) for this style or block format
|
||||
virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams) = 0;
|
||||
@ -94,13 +96,13 @@ class nsInsertTagCommand : public nsBaseComposerCommand
|
||||
{
|
||||
public:
|
||||
explicit nsInsertTagCommand(nsIAtom* aTagName);
|
||||
virtual ~nsInsertTagCommand();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSICONTROLLERCOMMAND
|
||||
|
||||
protected:
|
||||
virtual ~nsInsertTagCommand();
|
||||
|
||||
nsIAtom* mTagName;
|
||||
};
|
||||
@ -139,13 +141,13 @@ class nsMultiStateCommand : public nsBaseComposerCommand
|
||||
{
|
||||
public:
|
||||
|
||||
nsMultiStateCommand();
|
||||
virtual ~nsMultiStateCommand();
|
||||
nsMultiStateCommand();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSICONTROLLERCOMMAND
|
||||
|
||||
protected:
|
||||
virtual ~nsMultiStateCommand();
|
||||
|
||||
virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams) =0;
|
||||
virtual nsresult SetState(nsIEditor *aEditor, nsString& newState) = 0;
|
||||
|
@ -32,7 +32,6 @@ class nsComposerCommandsUpdater : public nsISelectionListener,
|
||||
public:
|
||||
|
||||
nsComposerCommandsUpdater();
|
||||
virtual ~nsComposerCommandsUpdater();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -69,6 +68,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~nsComposerCommandsUpdater();
|
||||
|
||||
enum {
|
||||
eStateUninitialized = -1,
|
||||
eStateOff = false,
|
||||
|
@ -49,8 +49,7 @@ class nsEditingSession : public nsIEditingSession,
|
||||
{
|
||||
public:
|
||||
|
||||
nsEditingSession();
|
||||
virtual ~nsEditingSession();
|
||||
nsEditingSession();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -62,6 +61,7 @@ public:
|
||||
NS_DECL_NSIEDITINGSESSION
|
||||
|
||||
protected:
|
||||
virtual ~nsEditingSession();
|
||||
|
||||
nsIDocShell * GetDocShellFromWindow(nsIDOMWindow *aWindow);
|
||||
|
||||
|
@ -144,6 +144,8 @@ public:
|
||||
nsString mDictionary;
|
||||
|
||||
private:
|
||||
~DictionaryFetcher() {}
|
||||
|
||||
nsRefPtr<nsEditorSpellCheck> mSpellCheck;
|
||||
};
|
||||
NS_IMPL_ISUPPORTS(DictionaryFetcher, nsIContentPrefCallback2)
|
||||
|
@ -33,7 +33,6 @@ class nsEditorSpellCheck : public nsIEditorSpellCheck
|
||||
|
||||
public:
|
||||
nsEditorSpellCheck();
|
||||
virtual ~nsEditorSpellCheck();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck)
|
||||
@ -42,6 +41,8 @@ public:
|
||||
NS_DECL_NSIEDITORSPELLCHECK
|
||||
|
||||
protected:
|
||||
virtual ~nsEditorSpellCheck();
|
||||
|
||||
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
||||
|
||||
nsTArray<nsString> mSuggestedWordList;
|
||||
|
@ -22,13 +22,14 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTxn, nsITransaction)
|
||||
|
||||
virtual ~EditTxn();
|
||||
|
||||
virtual void LastRelease() {}
|
||||
|
||||
NS_IMETHOD RedoTransaction(void);
|
||||
NS_IMETHOD GetIsTransient(bool *aIsTransient);
|
||||
NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);
|
||||
|
||||
protected:
|
||||
virtual ~EditTxn();
|
||||
};
|
||||
|
||||
#define NS_DECL_EDITTXN \
|
||||
|
@ -159,11 +159,14 @@ public:
|
||||
* after the construction of the editor class.
|
||||
*/
|
||||
nsEditor();
|
||||
|
||||
protected:
|
||||
/** The default destructor. This should suffice. Should this be pure virtual
|
||||
* for someone to derive from the nsEditor later? I don't believe so.
|
||||
*/
|
||||
virtual ~nsEditor();
|
||||
|
||||
public:
|
||||
//Interfaces for addref and release and queryinterface
|
||||
//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsEditor
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
@ -19,15 +19,15 @@ class nsISupports;
|
||||
class nsBaseEditorCommand : public nsIControllerCommand
|
||||
{
|
||||
public:
|
||||
|
||||
nsBaseEditorCommand();
|
||||
virtual ~nsBaseEditorCommand() {}
|
||||
nsBaseEditorCommand();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
|
||||
NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsBaseEditorCommand() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@ class nsEditorEventListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsEditorEventListener();
|
||||
virtual ~nsEditorEventListener();
|
||||
|
||||
virtual nsresult Connect(nsEditor* aEditor);
|
||||
|
||||
@ -60,6 +59,8 @@ public:
|
||||
void SpellCheckIfNeeded();
|
||||
|
||||
protected:
|
||||
virtual ~nsEditorEventListener();
|
||||
|
||||
nsresult InstallToEditor();
|
||||
void UninstallFromEditor();
|
||||
|
||||
|
@ -38,7 +38,6 @@ public:
|
||||
|
||||
TypeInState();
|
||||
void Reset();
|
||||
virtual ~TypeInState();
|
||||
|
||||
nsresult UpdateSelState(nsISelection *aSelection);
|
||||
|
||||
@ -72,6 +71,7 @@ public:
|
||||
static bool FindPropInList(nsIAtom *aProp, const nsAString &aAttr, nsAString *outValue, nsTArray<PropItem*> &aList, int32_t &outIndex);
|
||||
|
||||
protected:
|
||||
virtual ~TypeInState();
|
||||
|
||||
void RemovePropFromSetList(nsIAtom* aProp, const nsAString& aAttr);
|
||||
void RemovePropFromClearedList(nsIAtom* aProp, const nsAString& aAttr);
|
||||
|
@ -101,6 +101,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMUTATIONOBSERVER
|
||||
protected:
|
||||
~nsElementDeletionObserver() {}
|
||||
nsINode* mNativeAnonNode;
|
||||
nsINode* mObservedNode;
|
||||
};
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
|
||||
ResizerSelectionListener(nsIHTMLEditor * aEditor);
|
||||
void Reset();
|
||||
virtual ~ResizerSelectionListener();
|
||||
|
||||
/*interfaces for addref and release and queryinterface*/
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -41,6 +40,7 @@ public:
|
||||
NS_DECL_NSISELECTIONLISTENER
|
||||
|
||||
protected:
|
||||
virtual ~ResizerSelectionListener();
|
||||
|
||||
nsWeakPtr mEditor;
|
||||
};
|
||||
@ -53,8 +53,6 @@ class ResizerMouseMotionListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
ResizerMouseMotionListener(nsIHTMLEditor * aEditor);
|
||||
virtual ~ResizerMouseMotionListener();
|
||||
|
||||
|
||||
/*interfaces for addref and release and queryinterface*/
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -62,6 +60,8 @@ public:
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
protected:
|
||||
virtual ~ResizerMouseMotionListener();
|
||||
|
||||
nsWeakPtr mEditor;
|
||||
|
||||
};
|
||||
@ -74,7 +74,6 @@ class DocumentResizeEventListener: public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
DocumentResizeEventListener(nsIHTMLEditor * aEditor);
|
||||
virtual ~DocumentResizeEventListener();
|
||||
|
||||
/*interfaces for addref and release and queryinterface*/
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -82,6 +81,7 @@ public:
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
protected:
|
||||
virtual ~DocumentResizeEventListener();
|
||||
nsWeakPtr mEditor;
|
||||
|
||||
};
|
||||
|
@ -39,6 +39,14 @@ protected:
|
||||
uint32_t mAttributeCnt;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<nsHTMLURIRefObject>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
}
|
||||
|
||||
nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode);
|
||||
|
||||
#endif /* nsHTMLURIRefObject_h__ */
|
||||
|
@ -43,9 +43,8 @@ public:
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules)
|
||||
|
||||
nsTextEditRules();
|
||||
virtual ~nsTextEditRules();
|
||||
|
||||
nsTextEditRules();
|
||||
|
||||
// nsIEditRules methods
|
||||
NS_IMETHOD Init(nsPlaintextEditor *aEditor);
|
||||
@ -61,6 +60,9 @@ public:
|
||||
NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty);
|
||||
NS_IMETHOD DocumentModified();
|
||||
|
||||
protected:
|
||||
virtual ~nsTextEditRules();
|
||||
|
||||
public:
|
||||
void ResetIMETextPWBuf();
|
||||
|
||||
|
@ -26,7 +26,6 @@ class nsTransactionItem
|
||||
public:
|
||||
|
||||
nsTransactionItem(nsITransaction *aTransaction);
|
||||
virtual ~nsTransactionItem();
|
||||
NS_METHOD_(MozExternalRefCountType) AddRef();
|
||||
NS_METHOD_(MozExternalRefCountType) Release();
|
||||
|
||||
@ -60,6 +59,8 @@ private:
|
||||
|
||||
void CleanUp();
|
||||
protected:
|
||||
virtual ~nsTransactionItem();
|
||||
|
||||
nsCycleCollectingAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
};
|
||||
|
@ -27,13 +27,14 @@ private:
|
||||
nsTransactionStack *mTxnStack;
|
||||
nsRefPtr<nsTransactionItem> mTxnItem;
|
||||
|
||||
protected:
|
||||
virtual ~nsTransactionList();
|
||||
|
||||
public:
|
||||
|
||||
nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionStack *aTxnStack);
|
||||
nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionItem *aTxnItem);
|
||||
|
||||
virtual ~nsTransactionList();
|
||||
|
||||
/* Macro for AddRef(), Release(), and QueryInterface() */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
@ -34,16 +34,16 @@ private:
|
||||
nsTransactionStack mRedoStack;
|
||||
nsCOMArray<nsITransactionListener> mListeners;
|
||||
|
||||
/** The default destructor.
|
||||
*/
|
||||
virtual ~nsTransactionManager();
|
||||
|
||||
public:
|
||||
|
||||
/** The default constructor.
|
||||
*/
|
||||
nsTransactionManager(int32_t aMaxTransactionCount=-1);
|
||||
|
||||
/** The default destructor.
|
||||
*/
|
||||
virtual ~nsTransactionManager();
|
||||
|
||||
/* Macro for AddRef(), Release(), and QueryInterface() */
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager,
|
||||
|
@ -405,10 +405,12 @@ int32_t sAggregateBatchTestRedoOrderArr[] = {
|
||||
|
||||
class TestTransaction : public nsITransaction
|
||||
{
|
||||
protected:
|
||||
virtual ~TestTransaction() {}
|
||||
|
||||
public:
|
||||
|
||||
TestTransaction() {}
|
||||
virtual ~TestTransaction() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
|
@ -74,4 +74,12 @@ protected:
|
||||
eDirectionType mDirection;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<nsFilteredContentIterator>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -87,16 +87,17 @@ private:
|
||||
|
||||
nsCOMPtr<nsITextServicesFilter> mTxtSvcFilter;
|
||||
|
||||
protected:
|
||||
/** The default destructor.
|
||||
*/
|
||||
virtual ~nsTextServicesDocument();
|
||||
|
||||
public:
|
||||
|
||||
/** The default constructor.
|
||||
*/
|
||||
nsTextServicesDocument();
|
||||
|
||||
/** The default destructor.
|
||||
*/
|
||||
virtual ~nsTextServicesDocument();
|
||||
|
||||
/** To be called at module init
|
||||
*/
|
||||
static void RegisterAtoms();
|
||||
|
Loading…
Reference in New Issue
Block a user