Bug 1387406 - part4: nsFrameLoader should treat editor as HTMLEditor r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 07 Aug 2017 15:02:16 +0900
changeset 643907 93b170cee6346fa246ce0adbb7530631d1c3fa16
parent 643906 d3cbadeaf0049975e0757fd8d7688ffd6a49b11e
child 643908 bd157a78b4371d9608e5df1fce46ea0cf05e3919
push id73250
push usermasayuki@d-toybox.com
push dateThu, 10 Aug 2017 07:58:50 +0000
reviewerssmaug
bugs1387406
milestone57.0a1
Bug 1387406 - part4: nsFrameLoader should treat editor as HTMLEditor r?smaug Editor treated in nsFrameLoader is always HTMLEditor. So, it should treat the editor as is. MozReview-Commit-ID: 7bZMbLGKsED
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -42,17 +42,16 @@
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsSubDocumentFrame.h"
 #include "nsError.h"
 #include "nsISHistory.h"
 #include "nsISHistoryInternal.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIXULWindow.h"
-#include "nsIEditor.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsISHistory.h"
 #include "NullPrincipal.h"
 #include "nsIScriptError.h"
 #include "nsGlobalWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsLayoutUtils.h"
 #include "nsMappedAttributes.h"
@@ -76,16 +75,17 @@
 #include "Layers.h"
 #include "ClientLayerManager.h"
 
 #include "ContentParent.h"
 #include "TabParent.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/GuardObjects.h"
+#include "mozilla/HTMLEditor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/layout/RenderFrameParent.h"
 #include "GeckoProfiler.h"
 
 #include "jsapi.h"
@@ -1183,32 +1183,29 @@ nsFrameLoader::Show(int32_t marginWidth,
 
     if (doc) {
       nsAutoString designMode;
       doc->GetDesignMode(designMode);
 
       if (designMode.EqualsLiteral("on")) {
         // Hold on to the editor object to let the document reattach to the
         // same editor object, instead of creating a new one.
-        nsCOMPtr<nsIEditor> editor;
-        nsresult rv = mDocShell->GetEditor(getter_AddRefs(editor));
-        NS_ENSURE_SUCCESS(rv, false);
-
+        RefPtr<HTMLEditor> htmlEditor = mDocShell->GetHTMLEditor();
+        Unused << htmlEditor;
         doc->SetDesignMode(NS_LITERAL_STRING("off"));
         doc->SetDesignMode(NS_LITERAL_STRING("on"));
       } else {
         // Re-initialize the presentation for contenteditable documents
         bool editable = false,
              hasEditingSession = false;
         mDocShell->GetEditable(&editable);
         mDocShell->GetHasEditingSession(&hasEditingSession);
-        nsCOMPtr<nsIEditor> editor;
-        mDocShell->GetEditor(getter_AddRefs(editor));
-        if (editable && hasEditingSession && editor) {
-          editor->PostCreate();
+        RefPtr<HTMLEditor> htmlEditor = mDocShell->GetHTMLEditor();
+        if (editable && hasEditingSession && htmlEditor) {
+          htmlEditor->PostCreate();
         }
       }
     }
   }
 
   mInShow = false;
   if (mHideCalled) {
     mHideCalled = false;