Bug 1485369 - part 0: Clean up HTMLEditor::HideResizers() r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 24 Aug 2018 03:46:18 +0000
changeset 490931 4ca06c8731d39ef306a5765997eaab73a4e1cb52
parent 490930 d2c2abac6d01e7b78142bffecdf5bd3e3265a47c
child 490932 92baee16f1805b865eb6d0042c6d8bc95598c1b3
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1485369
milestone63.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 1485369 - part 0: Clean up HTMLEditor::HideResizers() r=m_kato Differential Revision: https://phabricator.services.mozilla.com/D4056
editor/libeditor/HTMLEditorObjectResizer.cpp
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -353,79 +353,84 @@ HTMLEditor::ShowResizersInner(Element& a
   aResizedElement.SetAttr(kNameSpaceID_None, nsGkAtoms::_moz_resizing,
                           NS_LITERAL_STRING("true"), true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLEditor::HideResizers()
 {
-  NS_ENSURE_TRUE(mResizedObject, NS_OK);
+  if (NS_WARN_IF(!mResizedObject)) {
+    return NS_OK;
+  }
 
   // get the presshell's document observer interface.
-  nsCOMPtr<nsIPresShell> ps = GetPresShell();
+  nsCOMPtr<nsIPresShell> presShell = GetPresShell();
+  NS_WARNING_ASSERTION(presShell, "There is no presShell");
   // We allow the pres shell to be null; when it is, we presume there
   // are no document observers to notify, but we still want to
   // UnbindFromTree.
 
   NS_NAMED_LITERAL_STRING(mousedown, "mousedown");
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mTopLeftHandle), ps);
+                             std::move(mTopLeftHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mTopHandle), ps);
+                             std::move(mTopHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mTopRightHandle), ps);
+                             std::move(mTopRightHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mLeftHandle), ps);
+                             std::move(mLeftHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mRightHandle), ps);
+                             std::move(mRightHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mBottomLeftHandle), ps);
+                             std::move(mBottomLeftHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mBottomHandle), ps);
+                             std::move(mBottomHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mBottomRightHandle), ps);
+                             std::move(mBottomRightHandle), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mResizingShadow), ps);
+                             std::move(mResizingShadow), presShell);
 
   RemoveListenerAndDeleteRef(mousedown, mEventListener, true,
-                             std::move(mResizingInfo), ps);
+                             std::move(mResizingInfo), presShell);
 
   if (mActivatedHandle) {
     mActivatedHandle->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_moz_activated,
                                 true);
     mActivatedHandle = nullptr;
   }
 
   // don't forget to remove the listeners !
 
   // nsCOMPtr so we can do_QueryInterface into it.
   nsCOMPtr<EventTarget> target = GetDOMEventTarget();
+  NS_WARNING_ASSERTION(target, "GetDOMEventTarget() returned nullptr");
 
   if (target && mMouseMotionListenerP) {
     target->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
                                 mMouseMotionListenerP, true);
   }
   mMouseMotionListenerP = nullptr;
 
   nsCOMPtr<nsIDocument> doc = GetDocument();
-  if (!doc) {
+  if (NS_WARN_IF(!doc)) {
     return NS_ERROR_NULL_POINTER;
   }
+  NS_WARNING_ASSERTION(doc->GetWindow(), "There should be a window");
   target = do_QueryInterface(doc->GetWindow());
-  if (!target) {
+  if (NS_WARN_IF(!target)) {
     return NS_ERROR_NULL_POINTER;
   }
 
   if (mResizeEventListenerP) {
     target->RemoveEventListener(NS_LITERAL_STRING("resize"),
                                 mResizeEventListenerP, false);
   }
   mResizeEventListenerP = nullptr;