Bug 1505601 - Turn nsIDocShell XPIDL const lists into cenums; r=bzbarsky
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 28 Nov 2018 03:30:56 +0000
changeset 507683 b99cfc042c4f45b6adb6f6d57ca4efcfa6d6d1a6
parent 507682 62089e4c3cc06b7a867e40b1ab75992cb04820ff
child 507684 75d25888cc9186e1f5c0f1dfa613c4c5ad846b43
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1505601
milestone65.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 1505601 - Turn nsIDocShell XPIDL const lists into cenums; r=bzbarsky Turn all const lists and related attributes into cenums, to provide a vague sense of type safety. Depends on D11715 Differential Revision: https://phabricator.services.mozilla.com/D11716
accessible/base/Logging.cpp
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsIDocShell.idl
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/events/EventStateManager.cpp
dom/events/TouchEvent.cpp
dom/presentation/PresentationCallbacks.cpp
dom/security/nsContentSecurityManager.cpp
editor/libeditor/TextEditorDataTransfer.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsLayoutUtils.cpp
layout/printing/nsPrintJob.cpp
toolkit/components/find/nsWebBrowserFind.cpp
--- a/accessible/base/Logging.cpp
+++ b/accessible/base/Logging.cpp
@@ -97,17 +97,17 @@ LogDocURI(nsIDocument* aDocumentNode)
 
 static void
 LogDocShellState(nsIDocument* aDocumentNode)
 {
   printf("docshell busy: ");
 
   nsAutoCString docShellBusy;
   nsCOMPtr<nsIDocShell> docShell = aDocumentNode->GetDocShell();
-  uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
+  nsIDocShell::BusyFlags busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
   docShell->GetBusyFlags(&busyFlags);
   if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) {
     printf("'none'");
   }
   if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY) {
     printf("'busy'");
   }
   if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD) {
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -786,19 +786,19 @@ nsDocShell::LoadURI(nsDocShellLoadState*
                       nullptr, // no nsIDocShell
                       nullptr); // no nsIRequest
 }
 
 void
 nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
 {
   // First, verify if this is a subframe.
-    nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
-    GetSameTypeParent(getter_AddRefs(parentAsItem));
-    nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
+  nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
+  GetSameTypeParent(getter_AddRefs(parentAsItem));
+  nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
 
   if (!parentDS || parentDS == static_cast<nsIDocShell*>(this)) {
     // This is the root docshell. If we got here while
     // executing an onLoad Handler,this load will not go
     // into session history.
     bool inOnLoadHandler = false;
     GetIsExecutingOnLoadHandler(&inOnLoadHandler);
     if (inOnLoadHandler) {
@@ -808,68 +808,67 @@ nsDocShell::MaybeHandleSubframeHistory(n
   }
 
   /* OK. It is a subframe. Checkout the parent's loadtype. If the parent was
    * loaded through a history mechanism, then get the SH entry for the child from
    * the parent. This is done to restore frameset navigation while going
    * back/forward. If the parent was loaded through any other loadType, set the
    * child's loadType too accordingly, so that session history does not get
    * confused.
-       */
-
-      // Get the parent's load type
+   */
+
+  // Get the parent's load type
   uint32_t parentLoadType;
-      parentDS->GetLoadType(&parentLoadType);
-
-      // Get the ShEntry for the child from the parent
-      nsCOMPtr<nsISHEntry> currentSH;
-      bool oshe = false;
-      parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
-      bool dynamicallyAddedChild = mDynamicallyCreated;
-
-      if (!dynamicallyAddedChild && !oshe && currentSH) {
-        currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
-      }
-
-      if (!dynamicallyAddedChild) {
-        // Only use the old SHEntry, if we're sure enough that
-        // it wasn't originally for some other frame.
+  parentDS->GetLoadType(&parentLoadType);
+
+  // Get the ShEntry for the child from the parent
+  nsCOMPtr<nsISHEntry> currentSH;
+  bool oshe = false;
+  parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
+  bool dynamicallyAddedChild = mDynamicallyCreated;
+
+  if (!dynamicallyAddedChild && !oshe && currentSH) {
+    currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
+  }
+
+  if (!dynamicallyAddedChild) {
+    // Only use the old SHEntry, if we're sure enough that
+    // it wasn't originally for some other frame.
     nsCOMPtr<nsISHEntry> shEntry;
-        parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
+    parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
     aLoadState->SetSHEntry(shEntry);
-      }
-
-      // Make some decisions on the child frame's loadType based on the
-      // parent's loadType, if the subframe hasn't loaded anything into it.
-      //
-      // In some cases privileged scripts may try to get the DOMWindow
-      // reference of this docshell before the loading starts, causing the
-      // initial about:blank content viewer being created and mCurrentURI being
-      // set. To handle this case we check if mCurrentURI is about:blank and
-      // currentSHEntry is null.
-      nsCOMPtr<nsISHEntry> currentChildEntry;
-      GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
+  }
+
+  // Make some decisions on the child frame's loadType based on the
+  // parent's loadType, if the subframe hasn't loaded anything into it.
+  //
+  // In some cases privileged scripts may try to get the DOMWindow
+  // reference of this docshell before the loading starts, causing the
+  // initial about:blank content viewer being created and mCurrentURI being
+  // set. To handle this case we check if mCurrentURI is about:blank and
+  // currentSHEntry is null.
+  nsCOMPtr<nsISHEntry> currentChildEntry;
+  GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
 
   if (mCurrentURI && (!NS_IsAboutBlank(mCurrentURI) || currentChildEntry)) {
-        // This is a pre-existing subframe. If
-        // 1. The load of this frame was not originally initiated by session
-        //    history directly (i.e. (!shEntry) condition succeeded, but it can
-        //    still be a history load on parent which causes this frame being
+    // This is a pre-existing subframe. If
+    // 1. The load of this frame was not originally initiated by session
+    //    history directly (i.e. (!shEntry) condition succeeded, but it can
+    //    still be a history load on parent which causes this frame being
     //    loaded), which we checked with the above assert, and
-        // 2. mCurrentURI is not null, nor the initial about:blank,
-        // it is possible that a parent's onLoadHandler or even self's
-        // onLoadHandler is loading a new page in this child. Check parent's and
-        // self's busy flag and if it is set, we don't want this onLoadHandler
-        // load to get in to session history.
-        uint32_t parentBusy = BUSY_FLAGS_NONE;
-        uint32_t selfBusy = BUSY_FLAGS_NONE;
-        parentDS->GetBusyFlags(&parentBusy);
-        GetBusyFlags(&selfBusy);
-        if (parentBusy & BUSY_FLAGS_BUSY ||
-            selfBusy & BUSY_FLAGS_BUSY) {
+    // 2. mCurrentURI is not null, nor the initial about:blank,
+    // it is possible that a parent's onLoadHandler or even self's
+    // onLoadHandler is loading a new page in this child. Check parent's and
+    // self's busy flag and if it is set, we don't want this onLoadHandler
+    // load to get in to session history.
+    BusyFlags parentBusy = parentDS->GetBusyFlags();
+    BusyFlags selfBusy = GetBusyFlags();
+
+    if (parentBusy & BUSY_FLAGS_BUSY ||
+        selfBusy & BUSY_FLAGS_BUSY) {
       aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
       aLoadState->SetSHEntry(nullptr);
     }
     return;
   }
 
   // This is a newly created frame. Check for exception cases first.
   // By default the subframe will inherit the parent's loadType.
@@ -877,19 +876,19 @@ nsDocShell::MaybeHandleSubframeHistory(n
                                 parentLoadType == LOAD_LINK   ||
                                 parentLoadType == LOAD_NORMAL_EXTERNAL)) {
     // The parent was loaded normally. In this case, this *brand new*
     // child really shouldn't have a SHEntry. If it does, it could be
     // because the parent is replacing an existing frame with a new frame,
     // in the onLoadHandler. We don't want this url to get into session
     // history. Clear off shEntry, and set load type to
     // LOAD_BYPASS_HISTORY.
-      bool inOnLoadHandler = false;
+    bool inOnLoadHandler = false;
     parentDS->GetIsExecutingOnLoadHandler(&inOnLoadHandler);
-      if (inOnLoadHandler) {
+    if (inOnLoadHandler) {
       aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
       aLoadState->SetSHEntry(nullptr);
     }
   } else if (parentLoadType == LOAD_REFRESH) {
     // Clear shEntry. For refresh loads, we have to load
     // what comes through the pipe, not what's in history.
     aLoadState->SetSHEntry(nullptr);
   } else if ((parentLoadType == LOAD_BYPASS_HISTORY) ||
@@ -2005,17 +2004,17 @@ nsDocShell::GetMayEnableCharacterEncodin
     return NS_OK;
   }
 
   *aMayEnableCharacterEncodingMenu = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetDocShellEnumerator(int32_t aItemType, int32_t aDirection,
+nsDocShell::GetDocShellEnumerator(int32_t aItemType, DocShellEnumeratorDirection aDirection,
                                   nsISimpleEnumerator** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = nullptr;
 
   RefPtr<nsDocShellEnumerator> docShellEnum;
   if (aDirection == ENUMERATE_FORWARDS) {
     docShellEnum = new nsDocShellForwardsEnumerator;
@@ -2040,24 +2039,24 @@ nsDocShell::GetDocShellEnumerator(int32_
 
   rv = docShellEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator),
                                     (void**)aResult);
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetAppType(uint32_t* aAppType)
+nsDocShell::GetAppType(AppType* aAppType)
 {
   *aAppType = mAppType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::SetAppType(uint32_t aAppType)
+nsDocShell::SetAppType(AppType aAppType)
 {
   mAppType = aAppType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetAllowAuth(bool* aAllowAuth)
 {
@@ -2114,17 +2113,17 @@ nsDocShell::GetMarginHeight(int32_t* aHe
 NS_IMETHODIMP
 nsDocShell::SetMarginHeight(int32_t aHeight)
 {
   mMarginHeight = aHeight;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetBusyFlags(uint32_t* aBusyFlags)
+nsDocShell::GetBusyFlags(BusyFlags* aBusyFlags)
 {
   NS_ENSURE_ARG_POINTER(aBusyFlags);
 
   *aBusyFlags = mBusyFlags;
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -2516,58 +2515,62 @@ nsDocShell::SetCustomUserAgent(const nsA
     if (childShell) {
       childShell->SetCustomUserAgent(aCustomUserAgent);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetTouchEventsOverride(uint32_t* aTouchEventsOverride)
+nsDocShell::GetTouchEventsOverride(TouchEventsOverride* aTouchEventsOverride)
 {
   *aTouchEventsOverride = mTouchEventsOverride;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::SetTouchEventsOverride(uint32_t aTouchEventsOverride)
-{
-  if (!(aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE ||
-        aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_ENABLED ||
-        aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_DISABLED)) {
+nsDocShell::SetTouchEventsOverride(TouchEventsOverride aTouchEventsOverride)
+{
+  // We don't have a way to verify this coming from Javascript, so this check is
+  // still needed.
+  if (!(aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_NONE ||
+        aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_ENABLED ||
+        aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_DISABLED)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   mTouchEventsOverride = aTouchEventsOverride;
 
   uint32_t childCount = mChildList.Length();
   for (uint32_t i = 0; i < childCount; ++i) {
     nsCOMPtr<nsIDocShell> childShell = do_QueryInterface(ChildAt(i));
     if (childShell) {
       childShell->SetTouchEventsOverride(aTouchEventsOverride);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetMetaViewportOverride(uint32_t* aMetaViewportOverride)
+nsDocShell::GetMetaViewportOverride(MetaViewportOverride* aMetaViewportOverride)
 {
   NS_ENSURE_ARG_POINTER(aMetaViewportOverride);
 
   *aMetaViewportOverride = mMetaViewportOverride;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::SetMetaViewportOverride(uint32_t aMetaViewportOverride)
-{
-  if (!(aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_NONE ||
-        aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_ENABLED ||
-        aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_DISABLED)) {
+nsDocShell::SetMetaViewportOverride(MetaViewportOverride aMetaViewportOverride)
+{
+  // We don't have a way to verify this coming from Javascript, so this check is
+  // still needed.
+  if (!(aMetaViewportOverride == META_VIEWPORT_OVERRIDE_NONE ||
+        aMetaViewportOverride == META_VIEWPORT_OVERRIDE_ENABLED ||
+        aMetaViewportOverride == META_VIEWPORT_OVERRIDE_DISABLED)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   mMetaViewportOverride = aMetaViewportOverride;
 
   // Inform our presShell that it needs to re-check its need for a viewport
   // override.
   nsCOMPtr<nsIPresShell> presShell = GetPresShell();
@@ -2822,20 +2825,19 @@ nsDocShell::SetDocLoaderParent(nsDocLoad
     if (mInheritPrivateBrowsingId) {
       value = parentAsDocShell->GetAffectPrivateSessionLifetime();
       SetAffectPrivateSessionLifetime(value);
     }
     uint32_t flags;
     if (NS_SUCCEEDED(parentAsDocShell->GetDefaultLoadFlags(&flags))) {
       SetDefaultLoadFlags(flags);
     }
-    uint32_t touchEventsOverride;
-    if (NS_SUCCEEDED(parentAsDocShell->GetTouchEventsOverride(&touchEventsOverride))) {
-      SetTouchEventsOverride(touchEventsOverride);
-    }
+
+    SetTouchEventsOverride(parentAsDocShell->GetTouchEventsOverride());
+
     // We don't need to inherit metaViewportOverride, because the viewport
     // is only relevant for the outermost nsDocShell, not for any iframes
     // like this that might be embedded within it.
   }
 
   nsCOMPtr<nsILoadContext> parentAsLoadContext(do_QueryInterface(parent));
   if (parentAsLoadContext && mInheritPrivateBrowsingId &&
       NS_SUCCEEDED(parentAsLoadContext->GetUsePrivateBrowsing(&value))) {
@@ -6109,18 +6111,17 @@ nsDocShell::RefreshURI(nsIURI* aURI, nsI
   }
   if (!RefreshAttempted(this, aURI, aDelay, sameURI)) {
     return NS_OK;
   }
 
   nsCOMPtr<nsITimerCallback> refreshTimer =
     new nsRefreshTimer(this, aURI, aPrincipal, aDelay, aRepeat, aMetaRefresh);
 
-  uint32_t busyFlags = 0;
-  GetBusyFlags(&busyFlags);
+  BusyFlags busyFlags = GetBusyFlags();
 
   if (!mRefreshURIList) {
     mRefreshURIList = nsArray::Create();
   }
 
   if (busyFlags & BUSY_FLAGS_BUSY || (!mIsActive && mDisableMetaRefreshWhenInactive)) {
     // We don't  want to create the timer right now. Instead queue up the request
     // and trigger the timer in EndPageLoad() or whenever we become active.
@@ -6793,31 +6794,31 @@ nsDocShell::OnStateChange(nsIWebProgress
         // Save history state of the previous page
         PersistLayoutHistoryState();
         // We'll never get an Embed() for this load, so just go ahead
         // and SetHistoryEntry now.
         SetHistoryEntry(&mOSHE, mLSHE);
       }
     }
     // Page has begun to load
-    mBusyFlags = BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD;
+    mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD);
 
     if ((aStateFlags & STATE_RESTORING) == 0) {
       // Show the progress cursor if the pref is set
       if (nsContentUtils::UseActivityCursor()) {
         nsCOMPtr<nsIWidget> mainWidget;
         GetMainWidget(getter_AddRefs(mainWidget));
         if (mainWidget) {
           mainWidget->SetCursor(eCursor_spinning);
         }
       }
     }
   } else if ((~aStateFlags & (STATE_TRANSFERRING | STATE_IS_DOCUMENT)) == 0) {
     // Page is loading
-    mBusyFlags = BUSY_FLAGS_BUSY | BUSY_FLAGS_PAGE_LOADING;
+    mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_PAGE_LOADING);
   } else if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_NETWORK)) {
     // Page has finished loading
     mBusyFlags = BUSY_FLAGS_NONE;
 
     // Hide the progress cursor if the pref is set
     if (nsContentUtils::UseActivityCursor()) {
       nsCOMPtr<nsIWidget> mainWidget;
       GetMainWidget(getter_AddRefs(mainWidget));
@@ -13569,24 +13570,24 @@ unsigned long nsDocShell::gNumberOfDocSh
 NS_IMETHODIMP
 nsDocShell::GetCanExecuteScripts(bool* aResult)
 {
   *aResult = mCanExecuteScripts;
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
-nsDocShell::SetFrameType(uint32_t aFrameType)
+nsDocShell::SetFrameType(FrameType aFrameType)
 {
   mFrameType = aFrameType;
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
-nsDocShell::GetFrameType(uint32_t* aFrameType)
+nsDocShell::GetFrameType(FrameType* aFrameType)
 {
   *aFrameType = mFrameType;
   return NS_OK;
 }
 
 /* [infallible] */ NS_IMETHODIMP
 nsDocShell::GetIsMozBrowser(bool* aIsMozBrowser)
 {
@@ -14059,25 +14060,27 @@ nsIDocShell::GetHTMLEditor()
 nsresult
 nsIDocShell::SetHTMLEditor(HTMLEditor* aHTMLEditor)
 {
   nsDocShell* docShell = static_cast<nsDocShell*>(this);
   return docShell->SetHTMLEditorInternal(aHTMLEditor);
 }
 
 NS_IMETHODIMP
-nsDocShell::GetDisplayMode(uint32_t* aDisplayMode)
+nsDocShell::GetDisplayMode(DisplayMode* aDisplayMode)
 {
   *aDisplayMode = mDisplayMode;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::SetDisplayMode(uint32_t aDisplayMode)
-{
+nsDocShell::SetDisplayMode(DisplayMode aDisplayMode)
+{
+  // We don't have a way to verify this coming from Javascript, so this check is
+  // still needed.
   if (!(aDisplayMode == nsIDocShell::DISPLAY_MODE_BROWSER ||
         aDisplayMode == nsIDocShell::DISPLAY_MODE_STANDALONE ||
         aDisplayMode == nsIDocShell::DISPLAY_MODE_FULLSCREEN ||
         aDisplayMode == nsIDocShell::DISPLAY_MODE_MINIMAL_UI)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (aDisplayMode != mDisplayMode) {
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -128,48 +128,48 @@ class nsDocShell final
   , public nsILinkHandler
   , public nsIDOMStorageManager
   , public nsINetworkInterceptController
   , public nsIDeprecationWarner
   , public mozilla::SupportsWeakPtr<nsDocShell>
 {
 public:
   enum InternalLoad : uint32_t {
-  INTERNAL_LOAD_FLAGS_NONE                    = 0x0,
-  INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL       = 0x1,
-  INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER      = 0x2,
-  INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4,
+    INTERNAL_LOAD_FLAGS_NONE                    = 0x0,
+    INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL       = 0x1,
+    INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER      = 0x2,
+    INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4,
 
-  // This flag marks the first load in this object
-  // @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
-  INTERNAL_LOAD_FLAGS_FIRST_LOAD              = 0x8,
+    // This flag marks the first load in this object
+    // @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
+    INTERNAL_LOAD_FLAGS_FIRST_LOAD              = 0x8,
 
 
-  // The set of flags that should not be set before calling into
-  // nsDocShell::LoadURI and other nsDocShell loading functions.
-  INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS     = 0xf,
+    // The set of flags that should not be set before calling into
+    // nsDocShell::LoadURI and other nsDocShell loading functions.
+    INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS     = 0xf,
 
 
-  INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER       = 0x10,
-  INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES     = 0x20,
+    INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER       = 0x10,
+    INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES     = 0x20,
 
-  // Whether the load should be treated as srcdoc load, rather than a URI one.
-  INTERNAL_LOAD_FLAGS_IS_SRCDOC               = 0x40,
+    // Whether the load should be treated as srcdoc load, rather than a URI one.
+    INTERNAL_LOAD_FLAGS_IS_SRCDOC               = 0x40,
 
-  // Whether this is the load of a frame's original src attribute
-  INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC      = 0x80,
+    // Whether this is the load of a frame's original src attribute
+    INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC      = 0x80,
 
-  INTERNAL_LOAD_FLAGS_NO_OPENER               = 0x100,
+    INTERNAL_LOAD_FLAGS_NO_OPENER               = 0x100,
 
-  // Whether a top-level data URI navigation is allowed for that load
-  INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI    = 0x200,
+    // Whether a top-level data URI navigation is allowed for that load
+    INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI    = 0x200,
 
-  // Whether the load was triggered by user interaction.
-  INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED       = 0x1000,
-    };
+    // Whether the load was triggered by user interaction.
+    INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED       = 0x1000,
+  };
 
   // Event type dispatched by RestorePresentation
   class RestorePresentationEvent : public mozilla::Runnable
   {
   public:
     NS_DECL_NSIRUNNABLE
     explicit RestorePresentationEvent(nsDocShell* aDs)
       : mozilla::Runnable("nsDocShell::RestorePresentationEvent")
@@ -1084,56 +1084,48 @@ private: // data members
   int32_t mPreviousEntryIndex;
   int32_t mLoadedEntryIndex;
 
   // Offset in the parent's child list.
   // -1 if the docshell is added dynamically to the parent shell.
   int32_t mChildOffset;
 
   uint32_t mSandboxFlags;
-  uint32_t mBusyFlags;
-  uint32_t mAppType;
+  BusyFlags mBusyFlags;
+  AppType mAppType;
   uint32_t mLoadType;
   uint32_t mDefaultLoadFlags;
   uint32_t mReferrerPolicy;
   uint32_t mFailedLoadType;
 
   // Are we a regular frame, a browser frame, or an app frame?
-  uint32_t mFrameType;
+  FrameType mFrameType;
 
   // This represents the state of private browsing in the docshell.
   // Currently treated as a binary value: 1 - in private mode, 0 - not private mode
   // On content docshells mPrivateBrowsingId == mOriginAttributes.mPrivateBrowsingId
   // On chrome docshells this value will be set, but not have the corresponding
   // origin attribute set.
   uint32_t mPrivateBrowsingId;
 
-  // This represents the CSS display-mode we are currently using.
-  // It can be any of the following values from nsIDocShell.idl:
-  //
-  // DISPLAY_MODE_BROWSER = 0
-  // DISPLAY_MODE_MINIMAL_UI = 1
-  // DISPLAY_MODE_STANDALONE = 2
-  // DISPLAY_MODE_FULLSCREEN = 3
-  //
-  // This is mostly used for media queries. The integer values above
-  // match those used in nsStyleConsts.h
-  uint32_t mDisplayMode;
+  // This represents the CSS display-mode we are currently using. This is mostly
+  // used for media queries.
+  DisplayMode mDisplayMode;
 
   // A depth count of how many times NotifyRunToCompletionStart
   // has been called without a matching NotifyRunToCompletionStop.
   uint32_t mJSRunToCompletionDepth;
 
   // Whether or not touch events are overridden. Possible values are defined
   // as constants in the nsIDocShell.idl file.
-  uint32_t mTouchEventsOverride;
+  TouchEventsOverride mTouchEventsOverride;
 
   // Whether or not handling of the <meta name="viewport"> tag is overridden.
   // Possible values are defined as constants in nsIDocShell.idl.
-  uint32_t mMetaViewportOverride;
+  MetaViewportOverride mMetaViewportOverride;
 
   // mFullscreenAllowed stores how we determine whether fullscreen is allowed
   // when GetFullscreenAllowed() is called. Fullscreen is allowed in a
   // docshell when all containing iframes have the allowfullscreen
   // attribute set to true. When mFullscreenAllowed is CHECK_ATTRIBUTES
   // we check this docshell's containing frame for the allowfullscreen
   // attribute, and recurse onto the parent docshell to ensure all containing
   // frames also have the allowfullscreen attribute. If we find an ancestor
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -318,30 +318,39 @@ interface nsIDocShell : nsIDocShellTreeI
    * Get an enumerator over this docShell and its children.
    *
    * @param aItemType  - Only include docShells of this type, or if typeAll,
    *                     include all child shells.
    *                     Uses types from nsIDocShellTreeItem.
    * @param aDirection - Whether to enumerate forwards or backwards.
    */
 
-  const long ENUMERATE_FORWARDS  = 0;
-  const long ENUMERATE_BACKWARDS = 1;
+  cenum DocShellEnumeratorDirection : 8 {
+    ENUMERATE_FORWARDS  = 0,
+    ENUMERATE_BACKWARDS = 1
+  };
 
   nsISimpleEnumerator getDocShellEnumerator(in long aItemType,
-                                            in long aDirection);
+                                            in nsIDocShell_DocShellEnumeratorDirection aDirection);
 
   /**
-   * The type of application that created this window
+   * The type of application that created this window.
+   *
+   * DO NOT DELETE, see bug 176166. For firefox, this value will always be
+   * UNKNOWN. However, it is used heavily in Thunderbird/comm-central and we
+   * don't really have a great replacement at the moment, so we'll just leave it
+   * here.
    */
-  const unsigned long APP_TYPE_UNKNOWN  = 0;
-  const unsigned long APP_TYPE_MAIL     = 1;
-  const unsigned long APP_TYPE_EDITOR   = 2;
+  cenum AppType : 8 {
+    APP_TYPE_UNKNOWN = 0,
+    APP_TYPE_MAIL    = 1,
+    APP_TYPE_EDITOR  = 2
+  };
 
-  attribute unsigned long appType;
+  [infallible] attribute nsIDocShell_AppType appType;
 
   /**
    * certain dochshells (like the message pane)
    * should not throw up auth dialogs
    * because it can act as a password trojan
    */
   attribute boolean allowAuth;
 
@@ -379,35 +388,40 @@ interface nsIDocShell : nsIDocShellTreeI
    * next element in the parent should be returned. Returns true if focus was
    * successfully taken by the tree owner.
    */
   bool tabToTreeOwner(in boolean forward, in boolean forDocumentNavigation);
 
   /**
    * Current busy state for DocShell
    */
-  const unsigned long BUSY_FLAGS_NONE             = 0;
-  const unsigned long BUSY_FLAGS_BUSY             = 1;
-  const unsigned long BUSY_FLAGS_BEFORE_PAGE_LOAD = 2;
-  const unsigned long BUSY_FLAGS_PAGE_LOADING     = 4;
+  cenum BusyFlags : 8 {
+    BUSY_FLAGS_NONE             = 0,
+    BUSY_FLAGS_BUSY             = 1,
+    BUSY_FLAGS_BEFORE_PAGE_LOAD = 2,
+    BUSY_FLAGS_PAGE_LOADING     = 4,
+  };
+
+  [infallible] readonly attribute nsIDocShell_BusyFlags busyFlags;
 
   /**
    * Load commands for the document
    */
-  const unsigned long LOAD_CMD_NORMAL  = 0x1;   // Normal load
-  const unsigned long LOAD_CMD_RELOAD  = 0x2;   // Reload
-  const unsigned long LOAD_CMD_HISTORY = 0x4;   // Load from history
-  const unsigned long LOAD_CMD_PUSHSTATE = 0x8; // History.pushState()
-
-  readonly attribute unsigned long busyFlags;
+  cenum LoadCommand : 8 {
+    LOAD_CMD_NORMAL  = 0x1,   // Normal load
+    LOAD_CMD_RELOAD  = 0x2,   // Reload
+    LOAD_CMD_HISTORY = 0x4,   // Load from history
+    LOAD_CMD_PUSHSTATE = 0x8, // History.pushState()
+  };
 
   /*
-   * attribute to access the loadtype  for the document
+   * Attribute to access the loadtype for the document. LoadType Enum is
+   * defined in nsDocShellLoadTypes.h
    */
-  attribute unsigned long  loadType;
+  [infallible] attribute unsigned long loadType;
 
   /*
    * Default load flags (as defined in nsIRequest) that will be set on all
    * requests made by this docShell and propagated to all child docShells and
    * to nsILoadGroup::defaultLoadFlags for the docShell's loadGroup.
    * Default is no flags.  Once set, only future requests initiated by the
    * docShell are affected, so in general, these flags should be set before
    * the docShell loads any content.
@@ -782,20 +796,21 @@ interface nsIDocShell : nsIDocShellTreeI
    * Notify all attached observers that the scroll position of some element
    * has changed.
    */
   [noscript] void notifyScrollObservers();
 
   /**
    * The type of iframe that this docshell lives.
    */
-  const unsigned long FRAME_TYPE_REGULAR = 0;
-  const unsigned long FRAME_TYPE_BROWSER = 1;
-
-  [infallible] attribute unsigned long frameType;
+  cenum FrameType : 8 {
+    FRAME_TYPE_REGULAR = 0,
+    FRAME_TYPE_BROWSER = 1,
+  };
+  [infallible] attribute nsIDocShell_FrameType frameType;
 
   /**
    * Returns true if this docshell corresponds to an <iframe mozbrowser>.
    * <xul:browser> returns false here.
    */
   [infallible] readonly attribute boolean isMozBrowser;
 
   /**
@@ -1094,55 +1109,61 @@ interface nsIDocShell : nsIDocShellTreeI
   /**
    * The tab child for this docshell.
    */
   [binaryname(ScriptableTabChild)] readonly attribute nsITabChild tabChild;
   [noscript,notxpcom,nostdcall] TabChildRef GetTabChild();
 
   [noscript,nostdcall,notxpcom] nsICommandManager GetCommandManager();
 
+  cenum TouchEventsOverride: 8 {
+    /**
+     * Override platform/pref default behaviour and force-disable touch events.
+     */
+    TOUCHEVENTS_OVERRIDE_DISABLED = 0,
+    /**
+     * Override platform/pref default behaviour and force-enable touch events.
+     */
+    TOUCHEVENTS_OVERRIDE_ENABLED = 1,
+    /**
+     * Don't override the platform/pref default behaviour for touch events.
+     */
+    TOUCHEVENTS_OVERRIDE_NONE = 2,
+  };
+
   /**
    * This allows chrome to override the default choice of whether touch events
    * are available on a specific docshell. Possible values are listed below.
    */
-  [infallible] attribute unsigned long touchEventsOverride;
-  /**
-   * Override platform/pref default behaviour and force-disable touch events.
-   */
-  const unsigned long TOUCHEVENTS_OVERRIDE_DISABLED = 0;
-  /**
-   * Override platform/pref default behaviour and force-enable touch events.
-   */
-  const unsigned long TOUCHEVENTS_OVERRIDE_ENABLED = 1;
-  /**
-   * Don't override the platform/pref default behaviour for touch events.
-   */
-  const unsigned long TOUCHEVENTS_OVERRIDE_NONE = 2;
+  [infallible] attribute nsIDocShell_TouchEventsOverride touchEventsOverride;
 
-  /**
-   * Override platform/pref default behaviour and force-disable support for
-   * <meta name="viewport">.
-   */
-  const unsigned long META_VIEWPORT_OVERRIDE_DISABLED = 0;
-  /**
-   * Override platform/pref default behaviour and force-enable support for
-   * <meta name="viewport">.
-   */
-  const unsigned long META_VIEWPORT_OVERRIDE_ENABLED = 1;
-  /**
-   * Don't override the platform/pref default behaviour for support for
-   * <meta name="viewport">.
-   */
-  const unsigned long META_VIEWPORT_OVERRIDE_NONE = 2;
+  cenum MetaViewportOverride: 8 {
+    /**
+     * Override platform/pref default behaviour and force-disable support for
+     * <meta name="viewport">.
+     */
+    META_VIEWPORT_OVERRIDE_DISABLED = 0,
+    /**
+     * Override platform/pref default behaviour and force-enable support for
+     * <meta name="viewport">.
+     */
+    META_VIEWPORT_OVERRIDE_ENABLED = 1,
+    /**
+     * Don't override the platform/pref default behaviour for support for
+     * <meta name="viewport">.
+     */
+    META_VIEWPORT_OVERRIDE_NONE = 2,
+  };
+
   /**
    * This allows chrome to override the default choice of whether the
    * <meta name="viewport"> tag is respected in a specific docshell.
    * Possible values are listed above.
    */
-  attribute unsigned long metaViewportOverride;
+  [infallible] attribute nsIDocShell_MetaViewportOverride metaViewportOverride;
 
   /**
    * This value is `true` if its corresponding unit of related browsing contexts
    * (TabGroup) contains only 1 toplevel window, and that window is the outer
    * window corresponding to this docshell.
    *
    * The value is `false` otherwise. This is the case if the docshell is an
    * iframe, has window.opener set, or another window with window.opener
@@ -1203,28 +1224,30 @@ interface nsIDocShell : nsIDocShellTreeI
 
   /**
    * BrowsingContext associated with the DocShell.
    */
   readonly attribute BrowsingContext browsingContext;
 
   /**
    * Allowed CSS display modes. This needs to be kept in
-   * sync with similar values in nsStyleConsts.h
+   * sync with similar values in ServoStyleConsts.h
    */
-  const unsigned long DISPLAY_MODE_BROWSER = 0;
-  const unsigned long DISPLAY_MODE_MINIMAL_UI = 1;
-  const unsigned long DISPLAY_MODE_STANDALONE = 2;
-  const unsigned long DISPLAY_MODE_FULLSCREEN = 3;
+  cenum DisplayMode: 8 {
+    DISPLAY_MODE_BROWSER = 0,
+    DISPLAY_MODE_MINIMAL_UI = 1,
+    DISPLAY_MODE_STANDALONE = 2,
+    DISPLAY_MODE_FULLSCREEN = 3,
+  };
 
   /**
    * Display mode for this docshell. Defaults to DISPLAY_MODE_BROWSER.
    * Media queries only look at the value in the top-most docshell.
    */
-  [infallible] attribute unsigned long displayMode;
+  [infallible] attribute nsIDocShell_DisplayMode displayMode;
 
   /**
    * The message manager for this docshell.  This does not throw, but
    * can return null if the docshell has no message manager.
    */
   [infallible] readonly attribute ContentFrameMessageManager messageManager;
 
   /**
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3438,28 +3438,28 @@ nsContentUtils::CanLoadImage(nsIURI* aUR
                              nsIPrincipal* aLoadingPrincipal)
 {
   MOZ_ASSERT(aURI, "Must have a URI");
   MOZ_ASSERT(aLoadingDocument, "Must have a document");
   MOZ_ASSERT(aLoadingPrincipal, "Must have a loading principal");
 
   nsresult rv;
 
-  uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
+  auto appType = nsIDocShell::APP_TYPE_UNKNOWN;
 
   {
     nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aLoadingDocument->GetDocShell();
     if (docShellTreeItem) {
       nsCOMPtr<nsIDocShellTreeItem> root;
       docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
 
       nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
 
-      if (!docShell || NS_FAILED(docShell->GetAppType(&appType))) {
-        appType = nsIDocShell::APP_TYPE_UNKNOWN;
+      if (docShell) {
+        appType = docShell->GetAppType();
       }
     }
   }
 
   if (appType != nsIDocShell::APP_TYPE_EDITOR) {
     // Editor apps get special treatment here, editors can load images
     // from anywhere.  This allows editor to insert images from file://
     // into documents that are being edited.
@@ -7664,19 +7664,18 @@ nsContentUtils::PrefetchPreloadEnabled(n
   if (!aDocShell) {
     return false;
   }
 
   nsCOMPtr<nsIDocShell> docshell = aDocShell;
   nsCOMPtr<nsIDocShellTreeItem> parentItem;
 
   do {
-    uint32_t appType = 0;
-    nsresult rv = docshell->GetAppType(&appType);
-    if (NS_FAILED(rv) || appType == nsIDocShell::APP_TYPE_MAIL) {
+    auto appType = docshell->GetAppType();
+    if (appType == nsIDocShell::APP_TYPE_MAIL) {
       return false; // do not prefetch, preload, preconnect from mailnews
     }
 
     docshell->GetParent(getter_AddRefs(parentItem));
     if (parentItem) {
       docshell = do_QueryInterface(parentItem);
       if (!docshell) {
         NS_ERROR("cannot get a docshell from a treeItem!");
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -3031,19 +3031,18 @@ nsGlobalWindowOuter::GetSanitizedOpener(
   // So, we look in the opener's root docshell to see if it's a mail window.
   nsCOMPtr<nsIDocShell> openerDocShell = aOpener->GetDocShell();
 
   if (openerDocShell) {
     nsCOMPtr<nsIDocShellTreeItem> openerRootItem;
     openerDocShell->GetRootTreeItem(getter_AddRefs(openerRootItem));
     nsCOMPtr<nsIDocShell> openerRootDocShell(do_QueryInterface(openerRootItem));
     if (openerRootDocShell) {
-      uint32_t appType;
-      nsresult rv = openerRootDocShell->GetAppType(&appType);
-      if (NS_SUCCEEDED(rv) && appType != nsIDocShell::APP_TYPE_MAIL) {
+      nsIDocShell::AppType appType = openerRootDocShell->GetAppType();
+      if (appType != nsIDocShell::APP_TYPE_MAIL) {
         return aOpener;
       }
     }
   }
 
   return nullptr;
 }
 
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3880,23 +3880,22 @@ EventStateManager::UpdateCursor(nsPresCo
     hotspotX = framecursor.mHotspotX;
     hotspotY = framecursor.mHotspotY;
   }
 
   if (nsContentUtils::UseActivityCursor()) {
     // Check whether or not to show the busy cursor
     nsCOMPtr<nsIDocShell> docShell(aPresContext->GetDocShell());
     if (!docShell) return;
-    uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
-    docShell->GetBusyFlags(&busyFlags);
+    auto busyFlags = docShell->GetBusyFlags();
 
     // Show busy cursor everywhere before page loads
     // and just replace the arrow cursor after page starts loading
     if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY &&
-          (cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT))
+        (cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT))
     {
       cursor = NS_STYLE_CURSOR_SPINNING;
       container = nullptr;
     }
   }
 
   if (aTargetFrame) {
     SetCursor(cursor, container, haveHotspot, hotspotX, hotspotY,
--- a/dom/events/TouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -248,19 +248,19 @@ TouchEvent::PlatformSupportsTouch()
 
 // static
 bool
 TouchEvent::PrefEnabled(nsIDocShell* aDocShell)
 {
   static bool sPrefCached = false;
   static int32_t sPrefCacheValue = 0;
 
-  uint32_t touchEventsOverride = nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE;
+  auto touchEventsOverride = nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE;
   if (aDocShell) {
-    aDocShell->GetTouchEventsOverride(&touchEventsOverride);
+    touchEventsOverride = aDocShell->GetTouchEventsOverride();
   }
 
   if (!sPrefCached) {
     sPrefCached = true;
     Preferences::AddIntVarCache(&sPrefCacheValue, "dom.w3c_touch_events.enabled");
   }
 
   bool enabled = false;
--- a/dom/presentation/PresentationCallbacks.cpp
+++ b/dom/presentation/PresentationCallbacks.cpp
@@ -174,21 +174,17 @@ PresentationResponderLoadingCallback::~P
 nsresult
 PresentationResponderLoadingCallback::Init(nsIDocShell* aDocShell)
 {
   mProgress = do_GetInterface(aDocShell);
   if (NS_WARN_IF(!mProgress)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
-  nsresult rv = aDocShell->GetBusyFlags(&busyFlags);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
+  auto busyFlags = aDocShell->GetBusyFlags();
 
   if ((busyFlags == nsIDocShell::BUSY_FLAGS_NONE) ||
       (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)) {
     // The docshell has finished loading or is receiving data (|STATE_TRANSFERRING|
     // has already been fired), so the page is ready for presentation use.
     return NotifyReceiverReady(/* isLoading = */ true);
   }
 
--- a/dom/security/nsContentSecurityManager.cpp
+++ b/dom/security/nsContentSecurityManager.cpp
@@ -265,17 +265,17 @@ static bool IsImageLoadInEditorAppType(n
   nsContentPolicyType type = aLoadInfo->InternalContentPolicyType();
   if (type != nsIContentPolicy::TYPE_INTERNAL_IMAGE  &&
       type != nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD &&
       type != nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON &&
       type != nsIContentPolicy::TYPE_IMAGESET) {
     return false;
   }
 
-  uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
+  auto appType = nsIDocShell::APP_TYPE_UNKNOWN;
   nsINode* node = aLoadInfo->LoadingNode();
   if (!node) {
     return false;
   }
   nsIDocument* doc = node->OwnerDoc();
   if (!doc) {
     return false;
   }
@@ -283,18 +283,18 @@ static bool IsImageLoadInEditorAppType(n
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
   if (!docShellTreeItem) {
     return false;
   }
 
   nsCOMPtr<nsIDocShellTreeItem> root;
   docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
   nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
-  if (!docShell || NS_FAILED(docShell->GetAppType(&appType))) {
-    appType = nsIDocShell::APP_TYPE_UNKNOWN;
+  if (docShell) {
+    appType = docShell->GetAppType();
   }
 
   return appType == nsIDocShell::APP_TYPE_EDITOR;
 }
 
 static nsresult
 DoCheckLoadURIChecks(nsIURI* aURI, nsILoadInfo* aLoadInfo)
 {
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -483,20 +483,19 @@ TextEditor::IsSafeToInsertData(nsIDocume
   nsCOMPtr<nsIDocument> destdoc = GetDocument();
   NS_ASSERTION(destdoc, "Where is our destination doc?");
   nsCOMPtr<nsIDocShellTreeItem> dsti = destdoc->GetDocShell();
   nsCOMPtr<nsIDocShellTreeItem> root;
   if (dsti) {
     dsti->GetRootTreeItem(getter_AddRefs(root));
   }
   nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(root);
-  uint32_t appType;
-  if (docShell && NS_SUCCEEDED(docShell->GetAppType(&appType))) {
-    isSafe = appType == nsIDocShell::APP_TYPE_EDITOR;
-  }
+
+  isSafe = docShell && docShell->GetAppType() == nsIDocShell::APP_TYPE_EDITOR;
+
   if (!isSafe && aSourceDoc) {
     nsIPrincipal* srcPrincipal = aSourceDoc->NodePrincipal();
     nsIPrincipal* destPrincipal = destdoc->NodePrincipal();
     NS_ASSERTION(srcPrincipal && destPrincipal, "How come we don't have a principal?");
     srcPrincipal->Subsumes(destPrincipal, &isSafe);
   }
 
   return isSafe;
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3825,19 +3825,18 @@ nsDocumentViewer::Print(nsIPrintSettings
   }
 
   nsCOMPtr<nsIDocShell> docShell(mContainer);
   NS_ENSURE_STATE(docShell);
 
   // Check to see if this document is still busy
   // If it is busy and we aren't already "queued" up to print then
   // Indicate there is a print pending and cache the args for later
-  uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
-  if ((NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
-       (busyFlags != nsIDocShell::BUSY_FLAGS_NONE && busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)) &&
+  auto busyFlags = docShell->GetBusyFlags();
+  if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE && busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING &&
       !mPrintDocIsFullyLoaded) {
     if (!mPrintIsPending) {
       mCachedPrintSettings           = aPrintSettings;
       mCachedPrintWebProgressListner = aWebProgressListener;
       mPrintIsPending                = true;
     }
     PR_PL(("Printing Stopped - document is still busy!"));
     return NS_ERROR_GFX_PRINTER_DOC_IS_BUSY;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -10342,20 +10342,20 @@ nsLayoutUtils::ComputeSystemFont(nsFont*
     }
 #endif
   }
 }
 
 /* static */ bool
 nsLayoutUtils::ShouldHandleMetaViewport(nsIDocument* aDocument)
 {
-  uint32_t metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
+  auto metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
   if (aDocument) {
     if (nsIDocShell* docShell = aDocument->GetDocShell()) {
-      docShell->GetMetaViewportOverride(&metaViewportOverride);
+      metaViewportOverride = docShell->GetMetaViewportOverride();
     }
   }
   switch (metaViewportOverride) {
     case nsIDocShell::META_VIEWPORT_OVERRIDE_ENABLED:
       return true;
     case nsIDocShell::META_VIEWPORT_OVERRIDE_DISABLED:
       return false;
     default:
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -1044,19 +1044,18 @@ nsPrintJob::PrintPreview(nsIPrintSetting
                          mozIDOMWindowProxy* aChildDOMWin,
                          nsIWebProgressListener* aWebProgressListener)
 {
   // Get the DocShell and see if it is busy
   // (We can't Print Preview this document if it is still busy)
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
   NS_ENSURE_STATE(docShell);
 
-  uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
-  if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
-      busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
+  auto busyFlags = docShell->GetBusyFlags();
+  if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
     CloseProgressDialog(aWebProgressListener);
     FirePrintingErrorEvent(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY);
     return NS_ERROR_FAILURE;
   }
 
   auto* window = nsPIDOMWindowOuter::From(aChildDOMWin);
   NS_ENSURE_STATE(window);
   nsCOMPtr<nsIDocument> doc = window->GetDoc();
--- a/toolkit/components/find/nsWebBrowserFind.cpp
+++ b/toolkit/components/find/nsWebBrowserFind.cpp
@@ -122,18 +122,19 @@ nsWebBrowserFind::FindNext(bool* aResult
     return NS_OK;
   }
 
   nsIDocShell* rootDocShell = rootFrame->GetDocShell();
   if (!rootDocShell) {
     return NS_ERROR_FAILURE;
   }
 
-  int32_t enumDirection = mFindBackwards ? nsIDocShell::ENUMERATE_BACKWARDS :
-                                           nsIDocShell::ENUMERATE_FORWARDS;
+  auto enumDirection =
+    mFindBackwards ? nsIDocShell::ENUMERATE_BACKWARDS :
+    nsIDocShell::ENUMERATE_FORWARDS;
 
   nsCOMPtr<nsISimpleEnumerator> docShellEnumerator;
   rv = rootDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeAll,
                                            enumDirection,
                                            getter_AddRefs(docShellEnumerator));
   if (NS_FAILED(rv)) {
     return rv;
   }