Backed out 2 changesets (bug 1623918) for crashtest failure on 1623918.html CLOSED TREE

Backed out changeset 519ca1b069e5 (bug 1623918)
Backed out changeset d8a09a5fea47 (bug 1623918)
This commit is contained in:
Narcis Beleuzu
2020-10-08 12:06:58 +03:00
parent 37119bf060
commit 563e13d079
29 changed files with 148 additions and 229 deletions

View File

@@ -111,8 +111,8 @@ TextControlElement::GetTextControlElementFromEditingHost(nsIContent* aHost) {
using ValueChangeKind = TextControlElement::ValueChangeKind;
MOZ_CAN_RUN_SCRIPT inline nsresult SetEditorFlagsIfNecessary(
EditorBase& aEditorBase, uint32_t aFlags) {
inline nsresult SetEditorFlagsIfNecessary(EditorBase& aEditorBase,
uint32_t aFlags) {
if (aEditorBase.Flags() == aFlags) {
return NS_OK;
}
@@ -200,7 +200,7 @@ class RestoreSelectionState : public Runnable {
class MOZ_RAII AutoRestoreEditorState final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoRestoreEditorState(TextEditor* aTextEditor)
explicit AutoRestoreEditorState(TextEditor* aTextEditor)
: mTextEditor(aTextEditor),
mSavedFlags(mTextEditor->Flags()),
mSavedMaxLength(mTextEditor->MaxTextLength()) {
@@ -214,18 +214,14 @@ class MOZ_RAII AutoRestoreEditorState final {
flags &= ~(nsIEditor::eEditorReadonlyMask);
flags |= nsIEditor::eEditorDontEchoPassword;
if (mSavedFlags != flags) {
// It's aTextEditor and whose lifetime must be guaranteed by the caller.
MOZ_KnownLive(mTextEditor)->SetFlags(flags);
mTextEditor->SetFlags(flags);
}
mTextEditor->SetMaxTextLength(-1);
}
MOZ_CAN_RUN_SCRIPT ~AutoRestoreEditorState() {
~AutoRestoreEditorState() {
mTextEditor->SetMaxTextLength(mSavedMaxLength);
// mTextEditor's lifetime must be guaranteed by owner of the instance
// since the constructor is marked as `MOZ_CAN_RUN_SCRIPT` and this is
// a stack only class.
SetEditorFlagsIfNecessary(MOZ_KnownLive(*mTextEditor), mSavedFlags);
SetEditorFlagsIfNecessary(*mTextEditor, mSavedFlags);
}
private: