Closed Bug 1460509 Opened 2 years ago Closed 2 years ago

Methods of TextEditRules and HTMLEditRules which changes DOM tree should return new error code which means editor is destroyed

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 2 open bugs)

Details

Attachments

(84 files)

59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
59 bytes, text/x-review-board-request
m_kato
: review+
Details
This is a part of bug 1454900.

Starting from bug 1457083's fix, TextEditRules and HTMLEditRules should stop handling edit action when editor is destroyed or something when they change the DOM tree. For making follow up of bug 1457083 faster, let's fix bug 1454900 only in TextEditRules and HTMLEditRules first.
Priority: -- → P3
Comment on attachment 8976830 [details]
Bug 1460509 - part 1: Declare NS_ERROR_EDITOR_DESTROYED error code and add a check method to TextEditRules whether it can keep handling edit action at a moment

https://reviewboard.mozilla.org/r/244916/#review251324
Attachment #8976830 - Flags: review?(m_kato) → review+
Comment on attachment 8976831 [details]
Bug 1460509 - part 2: Make TextEditRules::CreateBR() and TextEditRules::CreateMozBR() return both new <br> element node and error code since if they cause destroying the editor, each caller needs NS_ERROR_EDITOR_DESTROYED result

https://reviewboard.mozilla.org/r/244918/#review251334
Attachment #8976831 - Flags: review?(m_kato) → review+
Comment on attachment 8976832 [details]
Bug 1460509 - part 3: Make TextEditRules::HideLastPWInput() return NS_ERROR_EDITOR_DESTROYED when it causes destroying the editor

https://reviewboard.mozilla.org/r/244920/#review251346
Attachment #8976832 - Flags: review?(m_kato) → review+
Comment on attachment 8976833 [details]
Bug 1460509 - part 4: Make TextEditRules::CreateBogusNodeIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244922/#review251632
Attachment #8976833 - Flags: review?(m_kato) → review+
Comment on attachment 8976834 [details]
Bug 1460509 - part 5: Make TextEditRules::CreateTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244924/#review251634
Attachment #8976834 - Flags: review?(m_kato) → review+
Comment on attachment 8976835 [details]
Bug 1460509 - part 6: Make TextEditRules::RemoveRedundantTrailingBR() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244926/#review251636
Attachment #8976835 - Flags: review?(m_kato) → review+
Comment on attachment 8976836 [details]
Bug 1460509 - part 7: Make TextEditRules::DidDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244928/#review251638
Attachment #8976836 - Flags: review?(m_kato) → review+
Comment on attachment 8976837 [details]
Bug 1460509 - part 8: Make TextEditRules::WillDeleteSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244930/#review251640
Attachment #8976837 - Flags: review?(m_kato) → review+
Comment on attachment 8976838 [details]
Bug 1460509 - part 9: Make TextEditRules::WillSetText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244932/#review251642
Attachment #8976838 - Flags: review?(m_kato) → review+
Comment on attachment 8976839 [details]
Bug 1460509 - part 10: Make TextEditRules::WillInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244934/#review251670
Attachment #8976839 - Flags: review?(m_kato) → review+
Comment on attachment 8976840 [details]
Bug 1460509 - part 11: Make TextEditRules::CollapseSelectionToTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244936/#review251672
Attachment #8976840 - Flags: review?(m_kato) → review+
Comment on attachment 8976841 [details]
Bug 1460509 - part 12: Make TextEditRules::WillInsertBreak() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244938/#review251674
Attachment #8976841 - Flags: review?(m_kato) → review+
Comment on attachment 8976842 [details]
Bug 1460509 - part 13: Make TextEditRules::WillInsert() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244940/#review251676
Attachment #8976842 - Flags: review?(m_kato) → review+
Comment on attachment 8976843 [details]
Bug 1460509 - part 14: Make HTMLEditRules::WillRelativeChangeZIndex() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244942/#review251678
Attachment #8976843 - Flags: review?(m_kato) → review+
Comment on attachment 8976844 [details]
Bug 1460509 - part 15: Make HTMLEditRules::WillRemoveAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244944/#review251682
Attachment #8976844 - Flags: review?(m_kato) → review+
Comment on attachment 8976845 [details]
Bug 1460509 - part 16: Make HTMLEditRules::DidAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244946/#review251686
Attachment #8976845 - Flags: review?(m_kato) → review+
Comment on attachment 8976846 [details]
Bug 1460509 - part 17: Make HTMLEditRules::WillAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the HTML editor

https://reviewboard.mozilla.org/r/244948/#review251708

::: editor/libeditor/HTMLEditRules.cpp:10062
(Diff revision 1)
> -    SelectionRef().Collapse(RawRangeBoundary(positionedDiv, 0), error);
>      // Don't restore the selection
>      selectionRestorer.Abort();
> +    ErrorResult error;
> +    SelectionRef().Collapse(RawRangeBoundary(positionedDiv, 0), error);
> +    if (NS_WARN_IF(!CanHandleEditAction())) {

Need error.SuppressException() when you check destroyed at first.  If error.Failed() is true, it causes assertion.
Attachment #8976846 - Flags: review?(m_kato) → review+
Comment on attachment 8976847 [details]
Bug 1460509 - part 18: Make HTMLEditRules::ChangeIndentation() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244950/#review251710
Attachment #8976847 - Flags: review?(m_kato) → review+
Comment on attachment 8976848 [details]
Bug 1460509 - part 19: Make HTMLEditRules::AlignBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244952/#review251732
Attachment #8976848 - Flags: review?(m_kato) → review+
Comment on attachment 8976849 [details]
Bug 1460509 - part 20: Make HTMLEditRules::MakeSureElemStartsAndEndsOnCR() and HTMLEditRules::MakeSureElemStartsOrEndsOnCR() return NS_ERROR_EDITOR_DESTROYED if they cause destroying the editor

https://reviewboard.mozilla.org/r/244954/#review251734
Attachment #8976849 - Flags: review?(m_kato) → review+
Comment on attachment 8976850 [details]
Bug 1460509 - part 21: Make HTMLEditRules::RemoveAlignment() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244956/#review251736
Attachment #8976850 - Flags: review?(m_kato) → review+
Comment on attachment 8976851 [details]
Bug 1460509 - part 22: Mark HTMLEditRules::InsertBRIfNeededInternal() and its wrappers as MOZ_MUST_USE

https://reviewboard.mozilla.org/r/244958/#review251738
Attachment #8976851 - Flags: review?(m_kato) → review+
Comment on attachment 8976852 [details]
Bug 1460509 - part 23: Make HTMLEditRules::RemoveListStructure() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244960/#review251740
Attachment #8976852 - Flags: review?(m_kato) → review+
Comment on attachment 8976853 [details]
Bug 1460509 - part 24: Make HTMLEditRules::PopListItem() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244962/#review251742
Attachment #8976853 - Flags: review?(m_kato) → review+
Comment on attachment 8976854 [details]
Bug 1460509 - part 25: Make HTMLEditRules::RemoveEmptyNodes() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244964/#review251746
Attachment #8976854 - Flags: review?(m_kato) → review+
Comment on attachment 8976855 [details]
Bug 1460509 - part 26: Make HTMLEditRules::AdjustSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244966/#review251748
Attachment #8976855 - Flags: review?(m_kato) → review+
Comment on attachment 8976856 [details]
Bug 1460509 - part 27: Make HTMLEditRules::PinSelectionToNewBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244968/#review251750

::: editor/libeditor/HTMLEditRules.cpp:8727
(Diff revision 1)
>    } else {
>      atStartOfBlock.Set(tmp, 0);
>    }
>    ErrorResult error;
>    SelectionRef().Collapse(atStartOfBlock, error);
> +  if (NS_WARN_IF(!CanHandleEditAction())) {

need error.SuppressException();
Comment on attachment 8976857 [details]
Bug 1460509 - part 28: Make HTMLEditRules::AdjustWhitespace() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244970/#review251752
Attachment #8976857 - Flags: review?(m_kato) → review+
Comment on attachment 8976858 [details]
Bug 1460509 - part 29: Make HTMLEditRules::AdjustSpecialBreaks() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244972/#review251754
Attachment #8976858 - Flags: review?(m_kato) → review+
Comment on attachment 8976859 [details]
Bug 1460509 - part 30: Make HTMLEditRules::ReapplyCachedStyles() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244974/#review251756
Attachment #8976859 - Flags: review?(m_kato) → review+
Comment on attachment 8976860 [details]
Bug 1460509 - part 31: Make HTMLEditRules::GetInlineStyles() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244976/#review251758
Attachment #8976860 - Flags: review?(m_kato) → review+
Comment on attachment 8976861 [details]
Bug 1460509 - part 32: Mark HTMLEditRules::CacheInlineStyles() as MOZ_MUST_USE since it may cause destroying the editor and returns NS_ERROR_EDITOR_DESTROYED in such case

https://reviewboard.mozilla.org/r/244978/#review251764
Attachment #8976861 - Flags: review?(m_kato) → review+
Comment on attachment 8976846 [details]
Bug 1460509 - part 17: Make HTMLEditRules::WillAbsolutePosition() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the HTML editor

https://reviewboard.mozilla.org/r/244948/#review251708

> Need error.SuppressException() when you check destroyed at first.  If error.Failed() is true, it causes assertion.

Thanks!
Comment on attachment 8976862 [details]
Bug 1460509 - part 33: Make HTMLEditRules::JoinNearestEditableNodesWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244980/#review251770
Attachment #8976862 - Flags: review?(m_kato) → review+
Comment on attachment 8976863 [details]
Bug 1460509 - part 34: Make HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244982/#review251772
Attachment #8976863 - Flags: review?(m_kato) → review+
Comment on attachment 8976856 [details]
Bug 1460509 - part 27: Make HTMLEditRules::PinSelectionToNewBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244968/#review251750

> need error.SuppressException();

Thanks! I'll check all code after instantiating ErrorResult before posting new patches.
Comment on attachment 8976864 [details]
Bug 1460509 - part 35: Make HTMLEditRules::ApplyBlockStyle() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244984/#review251782
Attachment #8976864 - Flags: review?(m_kato) → review+
Comment on attachment 8976865 [details]
Bug 1460509 - part 36: Make HTMLEditRules::RemoveBlockStyle() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244986/#review251784
Attachment #8976865 - Flags: review?(m_kato) → review+
Comment on attachment 8976866 [details]
Bug 1460509 - part 37: Make HTMLEditRules::MakeBlockquote() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244988/#review251794
Attachment #8976866 - Flags: review?(m_kato) → review+
Comment on attachment 8976867 [details]
Bug 1460509 - part 38: Make HTMLEditRules::ReturnInListItem() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244990/#review251802
Attachment #8976867 - Flags: review?(m_kato) → review+
Comment on attachment 8976868 [details]
Bug 1460509 - part 39: Make HTMLEditRules::SplitParagraph() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244992/#review251804
Attachment #8976868 - Flags: review?(m_kato) → review+
Comment on attachment 8976869 [details]
Bug 1460509 - part 40: Make HTMLEditRules::ReturnInParagraph() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244994/#review251806
Attachment #8976869 - Flags: review?(m_kato) → review+
Comment on attachment 8976870 [details]
Bug 1460509 - part 41: Make HTMLEditRules::ReturnInHeader() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244996/#review251808

::: editor/libeditor/HTMLEditRules.cpp:7499
(Diff revision 1)
>          return NS_ERROR_FAILURE;
>        }
>        // Put selection after break
>        ErrorResult error;
>        SelectionRef().Collapse(afterSibling, error);
> +      if (NS_WARN_IF(!CanHandleEditAction())) {

need error.SuppressException();
Attachment #8976870 - Flags: review?(m_kato) → review+
Comment on attachment 8976871 [details]
Bug 1460509 - part 42: Make HTMLEditRules::BustUpInlinesAtBRs() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/244998/#review251810
Attachment #8976871 - Flags: review?(m_kato) → review+
Comment on attachment 8976872 [details]
Bug 1460509 - part 43: Make HTMLEditRules::BustUpInlinesAtRangeEndpoints() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245000/#review251812
Attachment #8976872 - Flags: review?(m_kato) → review+
Comment on attachment 8976873 [details]
Bug 1460509 - part 44: Make HTMLEditRules::GetNodesForOperation() and related methods return NS_ERROR_EDITOR_DESTROYED if they cause destroying the editor

https://reviewboard.mozilla.org/r/245002/#review251816
Attachment #8976873 - Flags: review?(m_kato) → review+
Comment on attachment 8976874 [details]
Bug 1460509 - part 45: Test if HTMLEditRules::PromoteRange() won't get range in Selection

https://reviewboard.mozilla.org/r/245004/#review251818
Attachment #8976874 - Flags: review?(m_kato) → review+
Comment on attachment 8976875 [details]
Bug 1460509 - part 46: Make HTMLEditRules::NormalizeSelection() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245006/#review251820
Attachment #8976875 - Flags: review?(m_kato) → review+
Comment on attachment 8976876 [details]
Bug 1460509 - part 47: Make HTMLEditRules::ExpandSelectionForDeletion() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245008/#review251822
Attachment #8976876 - Flags: review?(m_kato) → review+
Comment on attachment 8976877 [details]
Bug 1460509 - part 48: Make HTMLEditRules::CheckForEmptyBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245010/#review251840

::: editor/libeditor/HTMLEditRules.cpp:5973
(Diff revision 1)
> -            return NS_ERROR_FAILURE;
> +          return NS_ERROR_FAILURE;
> -          }
> +        }
> -          // Adjust selection to be right before it
> -          ErrorResult error;
> +        ErrorResult error;
> -          SelectionRef().Collapse(EditorRawDOMPoint(brElement), error);
> +        SelectionRef().Collapse(EditorRawDOMPoint(brElement), error);
> +        if (NS_WARN_IF(!CanHandleEditAction())) {

need error.SuppressException();
Attachment #8976877 - Flags: review?(m_kato) → review+
Comment on attachment 8976878 [details]
Bug 1460509 - part 49: Make HTMLEditRules::SplitMailCites() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245012/#review251992
Attachment #8976878 - Flags: review?(m_kato) → review+
Comment on attachment 8976879 [details]
Bug 1460509 - part 50: Make HTMLEditRules::InsertBRElement() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245014/#review251996
Comment on attachment 8976879 [details]
Bug 1460509 - part 50: Make HTMLEditRules::InsertBRElement() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245014/#review251998
Attachment #8976879 - Flags: review?(m_kato) → review+
Comment on attachment 8976880 [details]
Bug 1460509 - part 51: Make HTMLEditRules::WillInsertBreak() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245016/#review252000
Attachment #8976880 - Flags: review?(m_kato) → review+
Comment on attachment 8976881 [details]
Bug 1460509 - part 52: Make HTMLEditRules::LoadHTML() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245018/#review252002
Attachment #8976881 - Flags: review?(m_kato) → review+
Comment on attachment 8976882 [details]
Bug 1460509 - part 53: Make HTMLEditRules::WillInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245020/#review252004

::: editor/libeditor/HTMLEditRules.h:171
(Diff revision 2)
> +   * @param aMaxLength          The maximum string length which the editor
> +   *                            allows to set.
> +   */
> +  MOZ_MUST_USE nsresult
> +  WillInsertText(EditAction aAction, bool* aCancel, bool* aHandled,
> +                 const nsAString* inString, nsAString* outString,

Although I will handle by another new bug, outString and aMaxLength are unused.

::: editor/libeditor/HTMLEditRules.h:171
(Diff revision 2)
> +   * @param aMaxLength          The maximum string length which the editor
> +   *                            allows to set.
> +   */
> +  MOZ_MUST_USE nsresult
> +  WillInsertText(EditAction aAction, bool* aCancel, bool* aHandled,
> +                 const nsAString* inString, nsAString* outString,

Although I will handle by another new bug, outString and aMaxLength are unused.
Attachment #8976882 - Flags: review?(m_kato) → review+
Comment on attachment 8976883 [details]
Bug 1460509 - part 54: Make HTMLEditRules::WillInsert() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245022/#review252006
Attachment #8976883 - Flags: review?(m_kato) → review+
Comment on attachment 8976884 [details]
Bug 1460509 - part 55: Make HTMLEditRules::AfterEditInner() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245024/#review252008
Attachment #8976884 - Flags: review?(m_kato) → review+
Comment on attachment 8976885 [details]
Bug 1460509 - part 56: Make HTMLEditRules::AlignBlockContents() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245026/#review252010
Attachment #8976885 - Flags: review?(m_kato) → review+
Comment on attachment 8976886 [details]
Bug 1460509 - part 57: Mark HTMLEditRules::AlignInnerBlocks() as MOZ_MUST_USE since it may cause destroying the editor

https://reviewboard.mozilla.org/r/245028/#review252012
Attachment #8976886 - Flags: review?(m_kato) → review+
Comment on attachment 8976887 [details]
Bug 1460509 - part 58: Make HTMLEditRules::WillAlign() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245030/#review252016
Attachment #8976887 - Flags: review?(m_kato) → review+
Comment on attachment 8976888 [details]
Bug 1460509 - part 59: Make HTMLEditRules::CreateStyleForInsertText() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245032/#review252020

::: editor/libeditor/HTMLEditRules.cpp:5532
(Diff revision 2)
>      return NS_ERROR_FAILURE;
>    }
>    nsCOMPtr<nsINode> node = firstRange->GetStartContainer();
>    int32_t offset = firstRange->StartOffset();
>  
> -  nsCOMPtr<Element> rootElement = aDoc.GetRootElement();
> +  nsCOMPtr<Element> rootElement = aDocument.GetRootElement();

RefPtr is better
Attachment #8976888 - Flags: review?(m_kato) → review+
Comment on attachment 8976889 [details]
Bug 1460509 - part 60: Make HTMLEditRules::ConvertListType() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245034/#review252022
Attachment #8976889 - Flags: review?(m_kato) → review+
Comment on attachment 8976890 [details]
Bug 1460509 - part 61: Make HTMLEditRules::SplitBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245036/#review252040
Attachment #8976890 - Flags: review?(m_kato) → review+
Comment on attachment 8976891 [details]
Bug 1460509 - part 62: Make HTMLEditRules::OutdentPartOfBlock() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor

https://reviewboard.mozilla.org/r/245038/#review252046
Attachment #8976891 - Flags: review?(m_kato) → review+