Bug 1336011 part.3 Create an alias of the type of mDocStateListeners r?smaug
MozReview-Commit-ID: L0TczDcH4t8
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2617,18 +2617,17 @@ nsresult
EditorBase::NotifyDocumentListeners(
TDocumentListenerNotification aNotificationType)
{
if (!mDocStateListeners.Length()) {
// Maybe there just aren't any.
return NS_OK;
}
- nsTArray<OwningNonNull<nsIDocumentStateListener>>
- listeners(mDocStateListeners);
+ AutoDocumentStateListenerArray listeners(mDocStateListeners);
nsresult rv = NS_OK;
switch (aNotificationType) {
case eDocumentCreated:
for (auto& listener : listeners) {
rv = listener->NotifyDocumentCreated();
if (NS_FAILED(rv)) {
break;
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1006,17 +1006,19 @@ protected:
typedef AutoTArray<OwningNonNull<nsIEditActionListener>, 5>
AutoActionListenerArray;
AutoActionListenerArray mActionListeners;
// Just notify once per high level change.
typedef AutoTArray<OwningNonNull<nsIEditorObserver>, 3>
AutoEditorObserverArray;
AutoEditorObserverArray mEditorObservers;
// Listen to overall doc state (dirty or not, just created, etc.).
- nsTArray<OwningNonNull<nsIDocumentStateListener>> mDocStateListeners;
+ typedef AutoTArray<OwningNonNull<nsIDocumentStateListener>, 1>
+ AutoDocumentStateListenerArray;
+ AutoDocumentStateListenerArray mDocStateListeners;
// Cached selection for AutoSelectionRestorer.
SelectionState mSavedSel;
// Utility class object for maintaining preserved ranges.
RangeUpdater mRangeUpdater;
// Number of modifications (for undo/redo stack).
uint32_t mModCount;