Bug 1551086 - Do not finish edit action when unbinding the frame from the editing state. r=masayuki
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 20 May 2019 05:53:24 +0000
changeset 474508 f6b2612701f631484e59c793308e955b01eada99
parent 474507 678d5b0568490b694fbd6ffa93d001b42938f530
child 474509 9bbe07750de95eaf04ec2013713ee46a4a15596a
push id36041
push userccoroiu@mozilla.com
push dateMon, 20 May 2019 21:55:28 +0000
treeherdermozilla-central@29bdbbe89264 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1551086, 1053048, 1551192
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1551086 - Do not finish edit action when unbinding the frame from the editing state. r=masayuki The code here was introduced to fix bug 1053048, but the test there and the test-case there no longer need this, and it's generally unsound to do stuff that changes the state of the input from UnbindFromFrame(). I'll file a new bug for the bogus disabled styling in the test-case in a second. I don't know how to add a test for this (no less because the testcase crashes on debug builds regardless of this patch, see bug 1551192). Differential Revision: https://phabricator.services.mozilla.com/D30914
dom/html/nsTextEditorState.cpp
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -1925,24 +1925,16 @@ void nsTextEditorState::DestroyEditor() 
 
 void nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame) {
   NS_ENSURE_TRUE_VOID(mBoundFrame);
 
   // If it was, however, it should be unbounded from the same frame.
   MOZ_ASSERT(aFrame == mBoundFrame, "Unbinding from the wrong frame");
   NS_ENSURE_TRUE_VOID(!aFrame || aFrame == mBoundFrame);
 
-  // If the editor is modified but nsIEditorObserver::EditAction() hasn't been
-  // called yet, we need to notify it here because editor may be destroyed
-  // before EditAction() is called if selection listener causes flushing layout.
-  if (mTextListener && mTextEditor && mEditorInitialized &&
-      mTextEditor->IsInEditSubAction()) {
-    mTextListener->OnEditActionHandled();
-  }
-
   // We need to start storing the value outside of the editor if we're not
   // going to use it anymore, so retrieve it for now.
   nsAutoString value;
   GetValue(value, true);
 
   if (mRestoringSelection) {
     mRestoringSelection->Revoke();
     mRestoringSelection = nullptr;