merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 09 Jan 2017 10:33:05 +0100
changeset 328517 701868bfddcba5bdec516be33a86dcd525dc74cf
parent 328490 97896f92f196462e0072f8304b97c29217da1327 (current diff)
parent 328516 52e2571353b8ba1f023f1684662ece5f4f3ed785 (diff)
child 328518 126cbe2eaabd1f9d72019d638d0e13ec8eac907a
child 328533 a4014426d32456f82c7d60c2827ee5bddf198917
child 328549 b63a7e217db7558be2f863d3e70e2649c11dd060
push id31175
push usercbook@mozilla.com
push dateMon, 09 Jan 2017 09:33:22 +0000
treeherdermozilla-central@701868bfddcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone53.0a1
first release with
nightly linux32
701868bfddcb / 53.0a1 / 20170109030209 / files
nightly linux64
701868bfddcb / 53.0a1 / 20170109030209 / files
nightly mac
701868bfddcb / 53.0a1 / 20170109030209 / files
nightly win32
701868bfddcb / 53.0a1 / 20170109030209 / files
nightly win64
701868bfddcb / 53.0a1 / 20170109030209 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central a=merge
--- a/accessible/ipc/DocAccessibleParent.cpp
+++ b/accessible/ipc/DocAccessibleParent.cpp
@@ -434,39 +434,59 @@ DocAccessibleParent::Destroy()
   DocManager::NotifyOfRemoteDocShutdown(this);
   ProxyDestroyed(this);
   if (mParentDoc)
     mParentDoc->RemoveChildDoc(this);
   else if (IsTopLevel())
     GetAccService()->RemoteDocShutdown(this);
 }
 
+xpcAccessibleGeneric*
+DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
+{
+  xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
+  MOZ_ASSERT(doc);
+
+  return doc->GetXPCAccessible(aProxy);
+}
+
 bool
-DocAccessibleParent::CheckDocTree() const
+DocAccessibleParent::CheckDocTreeInternal() const
 {
   size_t childDocs = mChildDocs.Length();
   for (size_t i = 0; i < childDocs; i++) {
     if (!mChildDocs[i] || mChildDocs[i]->mParentDoc != this)
       return false;
 
-    if (!mChildDocs[i]->CheckDocTree()) {
+    if (!mChildDocs[i]->CheckDocTreeInternal()) {
       return false;
     }
   }
 
   return true;
 }
 
-xpcAccessibleGeneric*
-DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
+const DocAccessibleParent*
+DocAccessibleParent::CheckTopDoc() const
 {
-  xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
-  MOZ_ASSERT(doc);
+  const DocAccessibleParent* doc = this;
+  while (doc->ParentDoc()) {
+    doc = doc->ParentDoc();
+  }
+
+  MOZ_DIAGNOSTIC_ASSERT(doc->mTopLevel);
+  MOZ_DIAGNOSTIC_ASSERT(DocManager::TopLevelRemoteDocs()->Contains(doc));
 
-  return doc->GetXPCAccessible(aProxy);
+  return doc;
+}
+
+bool
+DocAccessibleParent::CheckDocTree() const
+{
+  return CheckTopDoc()->CheckDocTreeInternal();
 }
 
 #if defined(XP_WIN)
 /**
  * @param aCOMProxy COM Proxy to the document in the content process.
  */
 void
 DocAccessibleParent::SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy)
--- a/accessible/ipc/DocAccessibleParent.h
+++ b/accessible/ipc/DocAccessibleParent.h
@@ -82,19 +82,22 @@ public:
 
     mParent = nullptr;
   }
 
   virtual mozilla::ipc::IPCResult RecvShutdown() override;
   void Destroy();
   virtual void ActorDestroy(ActorDestroyReason aWhy) override
   {
+    if (mShutdown) {
+      return;
+    }
+
     MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());
-    if (!mShutdown)
-      Destroy();
+    Destroy();
   }
 
   /*
    * Return the main processes representation of the parent document (if any)
    * of the document this object represents.
    */
   DocAccessibleParent* ParentDoc() const { return mParentDoc; }
 
@@ -172,18 +175,20 @@ private:
     enum { ALLOW_MEMMOVE = true };
 
     ProxyAccessible* mProxy;
   };
 
   uint32_t AddSubtree(ProxyAccessible* aParent,
                       const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
                       uint32_t aIdxInParent);
+  xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
   MOZ_MUST_USE bool CheckDocTree() const;
-  xpcAccessibleGeneric* GetXPCAccessible(ProxyAccessible* aProxy);
+  MOZ_MUST_USE bool CheckDocTreeInternal() const;
+  const DocAccessibleParent* CheckTopDoc() const;
 
   nsTArray<DocAccessibleParent*> mChildDocs;
   DocAccessibleParent* mParentDoc;
 
   /*
    * Conceptually this is a map from IDs to proxies, but we store the ID in the
    * proxy object so we can't use a real map.
    */
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -128,18 +128,17 @@ using namespace mozilla::dom;
     eDOMClassInfo_##_class##_id,
 #else
 #define NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)                                \
   // nothing
 #endif
 
 #define NS_DEFINE_CLASSINFO_DATA_HELPER(_class, _helper, _flags,              \
                                         _chromeOnly, _allowXBL)               \
-  { #_class,                                                                  \
-    nullptr,                                                                  \
+  { nullptr,                                                                  \
     XPC_MAKE_CLASS_OPS(_flags),                                               \
     XPC_MAKE_CLASS(#_class, _flags,                                           \
                    &sClassInfoData[eDOMClassInfo_##_class##_id].mClassOps),   \
     _helper::doCreate,                                                        \
     nullptr,                                                                  \
     nullptr,                                                                  \
     nullptr,                                                                  \
     _flags,                                                                   \
@@ -672,17 +671,17 @@ nsDOMClassInfo::Init()
   int32_t i;
 
   for (i = 0; i < eDOMClassInfoIDCount; ++i) {
     if (i == eDOMClassInfo_DOMPrototype_id) {
       continue;
     }
 
     nsDOMClassInfoData& data = sClassInfoData[i];
-    nameSpaceManager->RegisterClassName(data.mName, i, data.mChromeOnly,
+    nameSpaceManager->RegisterClassName(data.mClass.name, i, data.mChromeOnly,
                                         data.mAllowXBL, &data.mNameUTF16);
   }
 
   for (i = 0; i < eDOMClassInfoIDCount; ++i) {
     RegisterClassProtos(i);
   }
 
   sIsInitialized = true;
@@ -770,17 +769,17 @@ nsDOMClassInfo::GetFlags(uint32_t *aFlag
   return NS_OK;
 }
 
 // nsIXPCScriptable
 
 NS_IMETHODIMP
 nsDOMClassInfo::GetClassName(char **aClassName)
 {
-  *aClassName = NS_strdup(mData->mName);
+  *aClassName = NS_strdup(mData->mClass.name);
 
   return NS_OK;
 }
 
 // virtual
 uint32_t
 nsDOMClassInfo::GetScriptableFlags()
 {
@@ -849,17 +848,17 @@ nsDOMClassInfo::Resolve(nsIXPConnectWrap
   if (id != sConstructor_id) {
     *resolvedp = false;
     return NS_OK;
   }
 
   JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, obj));
 
   JS::Rooted<JS::PropertyDescriptor> desc(cx);
-  if (!JS_GetPropertyDescriptor(cx, global, mData->mName, &desc)) {
+  if (!JS_GetPropertyDescriptor(cx, global, mData->mClass.name, &desc)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   if (desc.object() && !desc.hasGetterOrSetter() && desc.value().isObject()) {
     // If val is not an (non-null) object there either is no
     // constructor for this class, or someone messed with
     // window.classname, just fall through and let the JS engine
     // return the Object constructor.
@@ -952,17 +951,17 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
     if (iim) {
       nsCOMPtr<nsIInterfaceInfo> if_info;
       iim->GetInfoForIID(mData->mProtoChainInterface,
                          getter_AddRefs(if_info));
 
       if (if_info) {
         nsXPIDLCString name;
         if_info->GetName(getter_Copies(name));
-        NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mName) == 0,
+        NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mClass.name) == 0,
                      "Class name and proto chain interface name mismatch!");
       }
     }
   }
 #endif
 
   // Make prototype delegation work correctly. Consider if a site sets
   // HTMLElement.prototype.foopy = function () { ... } Now, calling
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -26,19 +26,17 @@ struct nsDOMClassInfoData;
 
 typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)
   (nsDOMClassInfoData* aData);
 
 typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
 
 struct nsDOMClassInfoData
 {
-  // XXX: mName is the same as the name gettable from the callback. This
-  // redundancy should be removed eventually.
-  const char *mName;
+  // The ASCII name is available as mClass.name.
   const char16_t *mNameUTF16;
   const js::ClassOps mClassOps;
   const js::Class mClass;
   nsDOMClassInfoConstructorFnc mConstructorFptr;
 
   nsIClassInfo *mCachedClassInfo;
   const nsIID *mProtoChainInterface;
   const nsIID **mInterfaces;
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3295,17 +3295,28 @@ nsRange::ExcludeNonSelectableNodes(nsTAr
           // Store it in the result (strong ref) - do this before creating
           // a new range in |newRange| below so we don't drop the last ref
           // to the range created in the previous iteration.
           if (!added && !err.Failed()) {
             aOutRanges->AppendElement(range);
           }
 
           // Create a new range for the remainder.
-          rv = CreateRange(node, 0, endParent, endOffset,
+          nsINode* startParent = node;
+          int32_t startOffset = 0;
+          // Don't start *inside* a node with independent selection though
+          // (e.g. <input>).
+          if (content && content->HasIndependentSelection()) {
+            nsINode* parent = startParent->GetParent();
+            if (parent) {
+              startOffset = parent->IndexOf(startParent);
+              startParent = parent;
+            }
+          }
+          rv = CreateRange(startParent, startOffset, endParent, endOffset,
                            getter_AddRefs(newRange));
           if (NS_FAILED(rv) || newRange->Collapsed()) {
             newRange = nullptr;
           }
           range = newRange;
           break; // create a new iterator for the new range, if any
         }
       } else {
--- a/dom/base/test/test_user_select.html
+++ b/dom/base/test/test_user_select.html
@@ -39,16 +39,19 @@ a { position:absolute; bottom: 0; right:
 <div class="non-selectable">x</div>
 <div class="non-selectable">x</div>
 bbbb</div>
 <div id="testG" style="white-space:pre">aaaa
 <div class="non-selectable">x</div>
 <div class="non-selectable">x</div>
 <div class="non-selectable">x</div>
 bbbb</div>
+<div id="testH" style="white-space:pre">aaaa
+<div class="non-selectable">x</div><input>
+bbbbbbb</div>
 
 <iframe id="testD" src="data:text/html,<body>aaaa<span style='-moz-user-select:none'>bbbb</span>cccc"></iframe>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 function test()
 {
@@ -281,16 +284,26 @@ function test()
   clear();
   e = document.getElementById('testG');
   synthesizeMouse(e, 1, 1, {});
   synthesizeMouse(e, 400, 180, { shiftKey: true });
   checkText("aaaa bbbb", e); // XXX this doesn't seem right - bug 1247799
   checkRanges([[0,0,-1,1],[2,0,-1,3],[4,0,-1,5],[6,0,6,5]], e);
   doneTest(e);
 
+  clear();
+  e = document.getElementById('testH');
+  synthesizeMouse(e, 1, 1, {});
+  synthesizeMouse(e, 30, 90, { shiftKey: true });
+  synthesizeMouse(e, 50, 90, { shiftKey: true });
+  synthesizeMouse(e, 70, 90, { shiftKey: true });
+  checkText("aaaa bbb", e);
+  checkRanges([[0,0,-1,1],[-1,2,3,4]], e);
+
+  doneTest(e);
   // ======================================================
   // ==================== Script tests ====================
   // ======================================================
 
   clear();
   e = document.getElementById('testD');
   clear(e.contentWindow);
   sel = e.contentWindow.getSelection();
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -271,25 +271,24 @@ class MediaRecorder::Session: public nsI
 
     NS_IMETHOD Run() override
     {
       MOZ_ASSERT(NS_GetCurrentThread() == mSession->mReadThread);
 
       LOG(LogLevel::Debug, ("Session.ExtractRunnable shutdown = %d", mSession->mEncoder->IsShutdown()));
       if (!mSession->mEncoder->IsShutdown()) {
         mSession->Extract(false);
-        nsCOMPtr<nsIRunnable> event = new ExtractRunnable(mSession);
-        if (NS_FAILED(NS_DispatchToCurrentThread(event))) {
+        if (NS_FAILED(NS_DispatchToCurrentThread(this))) {
           NS_WARNING("Failed to dispatch ExtractRunnable to encoder thread");
         }
       } else {
         // Flush out remaining encoded data.
         mSession->Extract(true);
         if (NS_FAILED(NS_DispatchToMainThread(
-                        new DestroyRunnable(mSession)))) {
+                        new DestroyRunnable(mSession.forget())))) {
           MOZ_ASSERT(false, "NS_DispatchToMainThread DestroyRunnable failed");
         }
       }
       return NS_OK;
     }
 
   private:
     RefPtr<Session> mSession;
@@ -362,16 +361,19 @@ class MediaRecorder::Session: public nsI
   // Main thread task.
   // To delete RecordingSession object.
   class DestroyRunnable : public Runnable
   {
   public:
     explicit DestroyRunnable(Session* aSession)
       : mSession(aSession) {}
 
+    explicit DestroyRunnable(already_AddRefed<Session> aSession)
+      : mSession(aSession) {}
+
     NS_IMETHOD Run() override
     {
       LOG(LogLevel::Debug, ("Session.DestroyRunnable session refcnt = (%d) stopIssued %d s=(%p)",
                          (int)mSession->mRefCnt, mSession->mStopIssued, mSession.get()));
       MOZ_ASSERT(NS_IsMainThread() && mSession);
       RefPtr<MediaRecorder> recorder = mSession->mRecorder;
       if (!recorder) {
         return NS_OK;
@@ -381,17 +383,17 @@ class MediaRecorder::Session: public nsI
       // We need to switch MediaRecorder to "Stop" state first to make sure
       // MediaRecorder is not associated with this Session anymore, then, it's
       // safe to delete this Session.
       // Also avoid to run if this session already call stop before
       if (!mSession->mStopIssued) {
         ErrorResult result;
         mSession->mStopIssued = true;
         recorder->Stop(result);
-        if (NS_FAILED(NS_DispatchToMainThread(new DestroyRunnable(mSession)))) {
+        if (NS_FAILED(NS_DispatchToMainThread(new DestroyRunnable(mSession.forget())))) {
           MOZ_ASSERT(false, "NS_DispatchToMainThread failed");
         }
         return NS_OK;
       }
 
       // Dispatch stop event and clear MIME type.
       mSession->mMimeType = NS_LITERAL_STRING("");
       recorder->SetMimeType(mSession->mMimeType);
@@ -510,16 +512,20 @@ public:
     MOZ_ASSERT(NS_IsMainThread());
     mStopIssued = true;
     CleanupStreams();
     if (mNeedSessionEndTask) {
       LOG(LogLevel::Debug, ("Session.Stop mNeedSessionEndTask %p", this));
       // End the Session directly if there is no ExtractRunnable.
       DoSessionEndTask(NS_OK);
     }
+    // If we don't do this, the Session will be purged only when the navigator exit
+    // by the ShutdownObserver and the memory and number of threads will quickly
+    // grows with each couple stop/start.
+    nsContentUtils::UnregisterShutdownObserver(this);
   }
 
   nsresult Pause()
   {
     LOG(LogLevel::Debug, ("Session.Pause"));
     MOZ_ASSERT(NS_IsMainThread());
 
     NS_ENSURE_TRUE(mTrackUnionStream, NS_ERROR_FAILURE);
@@ -587,16 +593,17 @@ private:
   {
     LOG(LogLevel::Debug, ("Session.~Session (%p)", this));
     CleanupStreams();
     if (mReadThread) {
       mReadThread->Shutdown();
       mReadThread = nullptr;
       // Inside the if() so that if we delete after xpcom-shutdown's Observe(), we
       // won't try to remove it after the observer service is shut down.
+      // Unregistering for safety in case Stop() was never called
       nsContentUtils::UnregisterShutdownObserver(this);
     }
   }
   // Pull encoded media data from MediaEncoder and put into EncodedBufferCache.
   // Destroy this session object in the end of this function.
   // If the bool aForceFlush is true, we will force to dispatch a
   // PushBlobRunnable to main thread.
   void Extract(bool aForceFlush)
@@ -819,16 +826,27 @@ private:
     }
     for (RefPtr<MediaInputPort>& inputPort : mInputPorts) {
       MOZ_ASSERT(inputPort);
       inputPort->Destroy();
     }
     mInputPorts.Clear();
 
     if (mTrackUnionStream) {
+      if (mEncoder) {
+        nsTArray<RefPtr<mozilla::dom::VideoStreamTrack>> videoTracks;
+        DOMMediaStream* domStream = mRecorder->Stream();
+        if (domStream) {
+          domStream->GetVideoTracks(videoTracks);
+          if (!videoTracks.IsEmpty()) {
+            videoTracks[0]->RemoveDirectListener(mEncoder->GetVideoSink());
+          }
+        }
+      }
+
       // Sometimes the MediaEncoder might be initialized fail and go to
       // |CleanupStreams|. So the mEncoder might be a nullptr in this case.
       if (mEncoder && mSelectedVideoTrackID != TRACK_NONE) {
         mTrackUnionStream->RemoveVideoOutput(mEncoder->GetVideoSink(), mSelectedVideoTrackID);
       }
       if (mEncoder) {
         mTrackUnionStream->RemoveListener(mEncoder.get());
       }
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -472,31 +472,29 @@ CompositorBridgeChild::RecvUpdatePluginC
         widget->Resize(aContentOffset.x + bounds.x,
                        aContentOffset.y + bounds.y,
                        bounds.width, bounds.height, true);
       }
 
       widget->Enable(isVisible);
 
       // visible state - updated after clipping, prior to invalidating
-      rv = widget->Show(isVisible);
-      NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
+      widget->Show(isVisible);
 
       // Handle invalidation, this can be costly, avoid if it is not needed.
       if (isVisible) {
         // invalidate region (widget origin)
 #if defined(XP_WIN)
         // Work around for flash's crummy sandbox. See bug 762948. This call
         // digs down into the window hirearchy, invalidating regions on
         // windows owned by other processes.
         mozilla::widget::WinUtils::InvalidatePluginAsWorkaround(
           widget, visibleBounds);
 #else
-        rv = widget->Invalidate(visibleBounds);
-        NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
+        widget->Invalidate(visibleBounds);
 #endif
         visiblePluginIds.AppendElement(aPlugins[pluginsIdx].windowId());
       }
     }
   }
   // Any plugins we didn't update need to be hidden, as they are
   // not associated with visible content.
   nsIWidget::UpdateRegisteredPluginWindowVisibility((uintptr_t)parent, visiblePluginIds);
--- a/gfx/tests/gtest/TestCompositor.cpp
+++ b/gfx/tests/gtest/TestCompositor.cpp
@@ -61,35 +61,35 @@ public:
   virtual nsresult        Create(nsIWidget* aParent,
                                  nsNativeWidget aNativeParent,
                                  const LayoutDeviceIntRect& aRect,
                                  nsWidgetInitData* aInitData = nullptr) override { return NS_OK; }
   virtual nsresult        Create(nsIWidget* aParent,
                                  nsNativeWidget aNativeParent,
                                  const DesktopIntRect& aRect,
                                  nsWidgetInitData* aInitData = nullptr) override { return NS_OK; }
-  NS_IMETHOD              Show(bool aState) override { return NS_OK; }
+  virtual void            Show(bool aState) override {}
   virtual bool            IsVisible() const override { return true; }
   virtual void            Move(double aX, double aY) override {}
   virtual void            Resize(double aWidth, double aHeight, bool aRepaint) override {}
   virtual void            Resize(double aX, double aY,
                                  double aWidth, double aHeight, bool aRepaint) override {}
 
   virtual void            Enable(bool aState) override {}
   virtual bool            IsEnabled() const override { return true; }
-  NS_IMETHOD              SetFocus(bool aRaise) override { return NS_OK; }
+  virtual nsresult        SetFocus(bool aRaise) override { return NS_OK; }
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override { return NS_OK; }
-  NS_IMETHOD              Invalidate(const LayoutDeviceIntRect& aRect) override { return NS_OK; }
-  NS_IMETHOD              SetTitle(const nsAString& title) override { return NS_OK; }
+  virtual void            Invalidate(const LayoutDeviceIntRect& aRect) override {}
+  virtual nsresult        SetTitle(const nsAString& title) override { return NS_OK; }
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override { return LayoutDeviceIntPoint(0, 0); }
-  NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+  virtual nsresult        DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) override { return NS_OK; }
-  NS_IMETHOD_(void)       SetInputContext(const InputContext& aContext,
+  virtual void            SetInputContext(const InputContext& aContext,
                                           const InputContextAction& aAction) override {}
-  NS_IMETHOD_(InputContext) GetInputContext() override { abort(); }
+  virtual InputContext    GetInputContext() override { abort(); }
 
 private:
   ~MockWidget() {}
 };
 
 NS_IMPL_ISUPPORTS_INHERITED0(MockWidget, nsBaseWidget)
 
 struct LayerManagerData {
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -793,16 +793,22 @@ NS_IMETHODIMP
 imgRequest::OnStopRequest(nsIRequest* aRequest,
                           nsISupports* ctxt, nsresult status)
 {
   LOG_FUNC(gImgLog, "imgRequest::OnStopRequest");
   MOZ_ASSERT(NS_IsMainThread(), "Can't send notifications off-main-thread");
 
   RefPtr<Image> image = GetImage();
 
+  RefPtr<imgRequest> strongThis = this;
+
+  if (mIsMultiPartChannel && mNewPartPending) {
+    OnDataAvailable(aRequest, ctxt, nullptr, 0, 0);
+  }
+
   // XXXldb What if this is a non-last part of a multipart request?
   // xxx before we release our reference to mRequest, lets
   // save the last status that we saw so that the
   // imgRequestProxy will have access to it.
   if (mRequest) {
     mRequest = nullptr;  // we no longer need the request
   }
 
@@ -914,23 +920,25 @@ struct NewPartResult final
 
 static NewPartResult
 PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount,
                   ImageURL* aURI, bool aIsMultipart, Image* aExistingImage,
                   ProgressTracker* aProgressTracker, uint32_t aInnerWindowId)
 {
   NewPartResult result(aExistingImage);
 
-  mimetype_closure closure;
-  closure.newType = &result.mContentType;
+  if (aInStr) {
+    mimetype_closure closure;
+    closure.newType = &result.mContentType;
 
-  // Look at the first few bytes and see if we can tell what the data is from
-  // that since servers tend to lie. :(
-  uint32_t out;
-  aInStr->ReadSegments(sniff_mimetype_callback, &closure, aCount, &out);
+    // Look at the first few bytes and see if we can tell what the data is from
+    // that since servers tend to lie. :(
+    uint32_t out;
+    aInStr->ReadSegments(sniff_mimetype_callback, &closure, aCount, &out);
+  }
 
   nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
   if (result.mContentType.IsEmpty()) {
     nsresult rv = chan ? chan->GetContentType(result.mContentType)
                        : NS_ERROR_FAILURE;
     if (NS_FAILED(rv)) {
       MOZ_LOG(gImgLog,
               LogLevel::Error, ("imgRequest::PrepareForNewPart -- "
@@ -1103,25 +1111,27 @@ imgRequest::OnDataAvailable(nsIRequest* 
     if (!succeeded) {
       // Something went wrong; probably a content type issue.
       Cancel(NS_IMAGELIB_ERROR_FAILURE);
       return NS_BINDING_ABORTED;
     }
   }
 
   // Notify the image that it has new data.
-  nsresult rv =
-    image->OnImageDataAvailable(aRequest, aContext, aInStr, aOffset, aCount);
+  if (aInStr) {
+    nsresult rv =
+      image->OnImageDataAvailable(aRequest, aContext, aInStr, aOffset, aCount);
 
-  if (NS_FAILED(rv)) {
-    MOZ_LOG(gImgLog, LogLevel::Warning,
-           ("[this=%p] imgRequest::OnDataAvailable -- "
-            "copy to RasterImage failed\n", this));
-    Cancel(NS_IMAGELIB_ERROR_FAILURE);
-    return NS_BINDING_ABORTED;
+    if (NS_FAILED(rv)) {
+      MOZ_LOG(gImgLog, LogLevel::Warning,
+             ("[this=%p] imgRequest::OnDataAvailable -- "
+              "copy to RasterImage failed\n", this));
+      Cancel(NS_IMAGELIB_ERROR_FAILURE);
+      return NS_BINDING_ABORTED;
+    }
   }
 
   return NS_OK;
 }
 
 void
 imgRequest::SetProperties(const nsACString& aContentType,
                           const nsACString& aContentDisposition)
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -511,17 +511,22 @@ typedef void
         MOZ_ASSERT(cOps && cOps->finalize); \
         cOps->finalize(fop, obj); \
     } \
     void doTrace(JSTracer* trc, JSObject* obj) const { \
         MOZ_ASSERT(cOps && cOps->trace); \
         cOps->trace(trc, obj); \
     }
 
-struct ClassOps
+// XXX: MOZ_NONHEAP_CLASS allows objects to be created statically or on the
+// stack. We actually want to ban stack objects too, but that's currently not
+// possible. So we define JS_STATIC_CLASS to make the intention clearer.
+#define JS_STATIC_CLASS MOZ_NONHEAP_CLASS
+
+struct JS_STATIC_CLASS ClassOps
 {
     /* Function pointer members (may be null). */
     JSAddPropertyOp     addProperty;
     JSDeletePropertyOp  delProperty;
     JSGetterOp          getProperty;
     JSSetterOp          setProperty;
     JSEnumerateOp       enumerate;
     JSResolveOp         resolve;
@@ -537,17 +542,17 @@ struct ClassOps
 typedef JSObject* (*ClassObjectCreationOp)(JSContext* cx, JSProtoKey key);
 
 /** Callback for custom post-processing after class initialization via ClassSpec. */
 typedef bool (*FinishClassInitOp)(JSContext* cx, JS::HandleObject ctor,
                                   JS::HandleObject proto);
 
 const size_t JSCLASS_CACHED_PROTO_WIDTH = 6;
 
-struct ClassSpec
+struct JS_STATIC_CLASS ClassSpec
 {
     ClassObjectCreationOp createConstructor;
     ClassObjectCreationOp createPrototype;
     const JSFunctionSpec* constructorFunctions;
     const JSPropertySpec* constructorProperties;
     const JSFunctionSpec* prototypeFunctions;
     const JSPropertySpec* prototypeProperties;
     FinishClassInitOp finishInit;
@@ -573,17 +578,17 @@ struct ClassSpec
     }
 
     bool shouldDefineConstructor() const {
         MOZ_ASSERT(defined());
         return !(flags & DontDefineConstructor);
     }
 };
 
-struct ClassExtension
+struct JS_STATIC_CLASS ClassExtension
 {
     /**
      * If an object is used as a key in a weakmap, it may be desirable for the
      * garbage collector to keep that object around longer than it otherwise
      * would. A common case is when the key is a wrapper around an object in
      * another compartment, and we want to avoid collecting the wrapper (and
      * removing the weakmap entry) as long as the wrapped object is alive. In
      * that case, the wrapped object is returned by the wrapper's
@@ -605,17 +610,17 @@ struct ClassExtension
      * global objects for example.
      */
     JSObjectMovedOp objectMovedOp;
 };
 
 #define JS_NULL_CLASS_SPEC  nullptr
 #define JS_NULL_CLASS_EXT   nullptr
 
-struct ObjectOps
+struct JS_STATIC_CLASS ObjectOps
 {
     LookupPropertyOp lookupProperty;
     DefinePropertyOp defineProperty;
     HasPropertyOp    hasProperty;
     GetPropertyOp    getProperty;
     SetPropertyOp    setProperty;
     GetOwnPropertyOp getOwnPropertyDescriptor;
     DeletePropertyOp deleteProperty;
@@ -629,17 +634,17 @@ struct ObjectOps
 #define JS_NULL_OBJECT_OPS nullptr
 
 } // namespace js
 
 // Classes, objects, and properties.
 
 typedef void (*JSClassInternal)();
 
-struct JSClassOps
+struct JS_STATIC_CLASS JSClassOps
 {
     /* Function pointer members (may be null). */
     JSAddPropertyOp     addProperty;
     JSDeletePropertyOp  delProperty;
     JSGetterOp          getProperty;
     JSSetterOp          setProperty;
     JSEnumerateOp       enumerate;
     JSResolveOp         resolve;
@@ -755,17 +760,17 @@ struct JSClass {
                                           & JSCLASS_CACHED_PROTO_MASK))
 
 // Initializer for unused members of statically initialized JSClass structs.
 #define JSCLASS_NO_INTERNAL_MEMBERS     {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
 #define JSCLASS_NO_OPTIONAL_MEMBERS     0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
 
 namespace js {
 
-struct Class
+struct JS_STATIC_CLASS Class
 {
     JS_CLASS_MEMBERS(js::ClassOps, FreeOp);
     const ClassSpec* spec;
     const ClassExtension* ext;
     const ObjectOps* oOps;
 
     /*
      * Objects of this class aren't native objects. They don't have Shapes that
--- a/js/xpconnect/public/xpc_make_class.h
+++ b/js/xpconnect/public/xpc_make_class.h
@@ -20,18 +20,18 @@ bool
 XPC_WN_CannotModifyPropertyStub(JSContext* cx, JS::HandleObject obj,
                                 JS::HandleId id, JS::HandleValue v);
 
 bool
 XPC_WN_MaybeResolvingDeletePropertyStub(JSContext* cx, JS::HandleObject obj,
                                         JS::HandleId id,
                                         JS::ObjectOpResult& result);
 bool
-XPC_WN_CantDeletePropertyStub(JSContext* cx, JS::HandleObject obj,
-                              JS::HandleId id, JS::ObjectOpResult& result);
+XPC_WN_CannotDeletePropertyStub(JSContext* cx, JS::HandleObject obj,
+                                JS::HandleId id, JS::ObjectOpResult& result);
 
 bool
 XPC_WN_Helper_GetProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
                           JS::MutableHandleValue vp);
 
 bool
 XPC_WN_Helper_SetProperty(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
                           JS::MutableHandleValue vp,
@@ -84,17 +84,17 @@ extern const js::ObjectOps XPC_WN_Object
       ? XPC_WN_MaybeResolvingPropertyStub \
       : XPC_WN_CannotModifyPropertyStub, \
     \
     /* delProperty */ \
     ((_flags) & nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY) \
     ? nullptr \
     : ((_flags) & nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE) \
       ? XPC_WN_MaybeResolvingDeletePropertyStub \
-      : XPC_WN_CantDeletePropertyStub, \
+      : XPC_WN_CannotDeletePropertyStub, \
     \
     /* getProperty */ \
     ((_flags) & nsIXPCScriptable::WANT_GETPROPERTY) \
     ? XPC_WN_Helper_GetProperty \
     : nullptr, \
     \
     /* setProperty */ \
     ((_flags) & nsIXPCScriptable::WANT_SETPROPERTY) \
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -10,16 +10,20 @@
 #ifndef XPC_MAP_CLASSNAME
 #error "Must #define XPC_MAP_CLASSNAME before #including xpc_map_end.h"
 #endif
 
 #ifndef XPC_MAP_QUOTED_CLASSNAME
 #error "Must #define XPC_MAP_QUOTED_CLASSNAME before #including xpc_map_end.h"
 #endif
 
+#ifndef XPC_MAP_FLAGS
+#error "Must #define XPC_MAP_FLAGS before #including xpc_map_end.h"
+#endif
+
 #include "js/Id.h"
 
 /**************************************************************/
 
 NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(char * *aClassName)
 {
     static const char sName[] = XPC_MAP_QUOTED_CLASSNAME;
     *aClassName = (char*) nsMemory::Clone(sName, sizeof(sName));
@@ -176,11 +180,9 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCre
 #ifdef XPC_MAP_WANT_CONSTRUCT
 #undef XPC_MAP_WANT_CONSTRUCT
 #endif
 
 #ifdef XPC_MAP_WANT_HASINSTANCE
 #undef XPC_MAP_WANT_HASINSTANCE
 #endif
 
-#ifdef XPC_MAP_FLAGS
 #undef XPC_MAP_FLAGS
-#endif
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -3539,16 +3539,17 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents)
     NS_IMPL_QUERY_CLASSINFO(nsXPCComponents)
 NS_INTERFACE_MAP_END_INHERITING(nsXPCComponentsBase)
 NS_IMPL_CI_INTERFACE_GETTER(nsXPCComponents, nsIXPCComponents)
 
 // The nsIXPCScriptable map declaration that will generate stubs for us
 #define XPC_MAP_CLASSNAME           ComponentsSH
 #define XPC_MAP_QUOTED_CLASSNAME   "nsXPCComponents"
 #define                             XPC_MAP_WANT_PRECREATE
+#define XPC_MAP_FLAGS               0
 #include "xpc_map_end.h" /* This will #undef the above */
 
 NS_IMETHODIMP
 ComponentsSH::PreCreate(nsISupports* nativeObj, JSContext* cx, JSObject* globalObj, JSObject** parentObj)
 {
   nsXPCComponentsBase* self = static_cast<nsXPCComponentsBase*>(nativeObj);
   // this should never happen
   if (!self->GetScope()) {
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -613,23 +613,16 @@ XPCWrappedNative::Destroy()
             mIdentity = nullptr;
         }
     }
 
     mMaybeScope = nullptr;
 }
 
 void
-XPCWrappedNative::UpdateScriptableInfo(XPCNativeScriptableInfo* si)
-{
-    MOZ_ASSERT(mScriptableInfo, "UpdateScriptableInfo expects an existing scriptable info");
-    mScriptableInfo = si;
-}
-
-void
 XPCWrappedNative::SetProto(XPCWrappedNativeProto* p)
 {
     MOZ_ASSERT(!IsWrapperExpired(), "bad ptr!");
 
     MOZ_ASSERT(HasProto());
 
     // Write barrier for incremental GC.
     JSContext* cx = GetContext()->Context();
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -474,18 +474,18 @@ XPC_WN_OnlyIWrite_AddPropertyStub(JSCont
 bool
 XPC_WN_CannotModifyPropertyStub(JSContext* cx, HandleObject obj, HandleId id,
                                 HandleValue v)
 {
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
 }
 
 bool
-XPC_WN_CantDeletePropertyStub(JSContext* cx, HandleObject obj, HandleId id,
-                              ObjectOpResult& result)
+XPC_WN_CannotDeletePropertyStub(JSContext* cx, HandleObject obj, HandleId id,
+                                ObjectOpResult& result)
 {
     return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);
 }
 
 bool
 XPC_WN_CannotModifySetPropertyStub(JSContext* cx, HandleObject obj, HandleId id,
                                    MutableHandleValue vp, ObjectOpResult& result)
 {
@@ -619,17 +619,17 @@ XPC_WN_NoHelper_Resolve(JSContext* cx, H
                                  JSPROP_ENUMERATE |
                                  JSPROP_READONLY |
                                  JSPROP_PERMANENT,
                                  resolvedp);
 }
 
 static const js::ClassOps XPC_WN_NoHelper_JSClassOps = {
     XPC_WN_OnlyIWrite_AddPropertyStub, // addProperty
-    XPC_WN_CantDeletePropertyStub,     // delProperty
+    XPC_WN_CannotDeletePropertyStub,   // delProperty
     nullptr,                           // getProperty
     nullptr,                           // setProperty
     XPC_WN_Shared_Enumerate,           // enumerate
     XPC_WN_NoHelper_Resolve,           // resolve
     nullptr,                           // mayResolve
     XPC_WN_NoHelper_Finalize,          // finalize
     nullptr,                           // call
     nullptr,                           // construct
@@ -1201,17 +1201,17 @@ XPC_WN_NoMods_Proto_Resolve(JSContext* c
                                  true, nullptr, nullptr, si,
                                  JSPROP_READONLY |
                                  JSPROP_PERMANENT |
                                  JSPROP_ENUMERATE, resolvedp);
 }
 
 static const js::ClassOps XPC_WN_NoMods_Proto_JSClassOps = {
     XPC_WN_OnlyIWrite_Proto_AddPropertyStub,   // addProperty
-    XPC_WN_CantDeletePropertyStub,             // delProperty
+    XPC_WN_CannotDeletePropertyStub,           // delProperty
     nullptr,                                   // getProperty
     nullptr,                                   // setProperty
     XPC_WN_Shared_Proto_Enumerate,             // enumerate
     XPC_WN_NoMods_Proto_Resolve,               // resolve
     nullptr,                                   // mayResolve
     XPC_WN_Shared_Proto_Finalize,              // finalize
     nullptr,                                   // call
     nullptr,                                   // construct
@@ -1297,17 +1297,17 @@ XPC_WN_TearOff_ObjectMoved(JSObject* obj
 // XPC_WN_TEAROFF_RESERVED_SLOTS value is OK.
 
 static_assert(((XPC_WRAPPER_FLAGS >> JSCLASS_RESERVED_SLOTS_SHIFT) &
                JSCLASS_RESERVED_SLOTS_MASK) == 0,
               "XPC_WRAPPER_FLAGS should not include any reserved slots");
 
 static const js::ClassOps XPC_WN_Tearoff_JSClassOps = {
     XPC_WN_OnlyIWrite_AddPropertyStub,  // addProperty
-    XPC_WN_CantDeletePropertyStub,      // delProperty
+    XPC_WN_CannotDeletePropertyStub,    // delProperty
     nullptr,                            // getProperty
     nullptr,                            // setProperty
     XPC_WN_TearOff_Enumerate,           // enumerate
     XPC_WN_TearOff_Resolve,             // resolve
     nullptr,                            // mayResolve
     XPC_WN_TearOff_Finalize,            // finalize
     nullptr,                            // call
     nullptr,                            // construct
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1484,28 +1484,19 @@ private:
 /***************************************************************************/
 // XPCNativeScriptableCreateInfo is used in creating new wrapper and protos.
 // it abstracts out the scriptable interface pointer and the flags. After
 // creation these are factored differently using XPCNativeScriptableInfo.
 
 class MOZ_STACK_CLASS XPCNativeScriptableCreateInfo final
 {
 public:
-
-    explicit XPCNativeScriptableCreateInfo(const XPCNativeScriptableInfo& si)
-        : mCallback(si.GetCallback()), mFlags(si.GetFlags()) {}
-
-    XPCNativeScriptableCreateInfo(already_AddRefed<nsIXPCScriptable>&& callback,
-                                  XPCNativeScriptableFlags flags)
-        : mCallback(callback), mFlags(flags) {}
-
     XPCNativeScriptableCreateInfo()
         : mFlags(0) {}
 
-
     nsIXPCScriptable*
     GetCallback() const {return mCallback;}
 
     const XPCNativeScriptableFlags&
     GetFlags() const      {return mFlags;}
 
     void
     SetCallback(already_AddRefed<nsIXPCScriptable>&& callback)
@@ -1888,18 +1879,16 @@ protected:
     // This ctor is used if this object will NOT have a proto.
     XPCWrappedNative(already_AddRefed<nsISupports>&& aIdentity,
                      XPCWrappedNativeScope* aScope,
                      already_AddRefed<XPCNativeSet>&& aSet);
 
     virtual ~XPCWrappedNative();
     void Destroy();
 
-    void UpdateScriptableInfo(XPCNativeScriptableInfo* si);
-
 private:
     enum {
         // Flags bits for mFlatJSObject:
         FLAT_JS_OBJECT_VALID = JS_BIT(0)
     };
 
     bool Init(const XPCNativeScriptableCreateInfo* sci);
     bool FinishInit();
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -302,34 +302,38 @@ nsLayoutStatics::Initialize()
   MediaDecoder::InitStatics();
 
   PromiseDebugging::Init();
 
   mozilla::dom::devicestorage::DeviceStorageStatics::Initialize();
 
   mozilla::dom::WebCryptoThreadPool::Initialize();
 
-  // NB: We initialize servo in nsAppRunner.cpp, because we need to do it after
-  // creating the hidden DOM window to support some current stylo hacks. We
-  // should move initialization back here once those go away.
+#ifdef MOZ_STYLO
+  Servo_Initialize();
+#endif
 
 #ifndef MOZ_WIDGET_ANDROID
   // On Android, we instantiate it when constructing AndroidBridge.
   MediaPrefs::GetSingleton();
 #endif
 
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
   // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
   // memory reporter manager.
 
+#ifdef MOZ_STYLO
+  Servo_Shutdown();
+#endif
+
   nsMessageManagerScriptExecutor::Shutdown();
   nsFocusManager::Shutdown();
 #ifdef MOZ_XUL
   nsXULPopupManager::Shutdown();
 #endif
   StorageObserver::Shutdown();
   txMozillaXSLTProcessor::Shutdown();
   Attr::Shutdown();
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1117,31 +1117,40 @@ nsListControlFrame::GetCurrentOption()
   // the selected index if this is kNothingSelected.
   int32_t focusedIndex = (mEndSelectionIndex == kNothingSelected) ?
     GetSelectedIndex() : mEndSelectionIndex;
 
   if (focusedIndex != kNothingSelected) {
     return GetOption(AssertedCast<uint32_t>(focusedIndex));
   }
 
-  // There is no selected item. Return the first non-disabled item.
+  // There is no selected option. Return the first non-disabled option, if any.
+  return GetNonDisabledOptionFrom(0);
+}
+
+HTMLOptionElement*
+nsListControlFrame::GetNonDisabledOptionFrom(int32_t aFromIndex,
+                                             int32_t* aFoundIndex)
+{
   RefPtr<dom::HTMLSelectElement> selectElement =
     dom::HTMLSelectElement::FromContent(mContent);
 
-  for (uint32_t i = 0, length = selectElement->Length(); i < length; ++i) {
-    dom::HTMLOptionElement* node = selectElement->Item(i);
+  const uint32_t length = selectElement->Length();
+  for (uint32_t i = std::max(aFromIndex, 0); i < length; ++i) {
+    HTMLOptionElement* node = selectElement->Item(i);
     if (!node) {
-      return nullptr;
+      break;
     }
-
     if (!selectElement->IsOptionDisabled(node)) {
+      if (aFoundIndex) {
+        *aFoundIndex = i;
+      }
       return node;
     }
   }
-
   return nullptr;
 }
 
 bool
 nsListControlFrame::IsInDropDownMode() const
 {
   return (mComboboxFrame != nullptr);
 }
@@ -2474,17 +2483,27 @@ nsListControlFrame::KeyPress(nsIDOMEvent
 
 void
 nsListControlFrame::PostHandleKeyEvent(int32_t aNewIndex,
                                        uint32_t aCharCode,
                                        bool aIsShift,
                                        bool aIsControlOrMeta)
 {
   if (aNewIndex == kNothingSelected) {
-    return;
+    int32_t focusedIndex = mEndSelectionIndex == kNothingSelected ?
+      GetSelectedIndex() : mEndSelectionIndex;
+    if (focusedIndex != kNothingSelected) {
+      return;
+    }
+    // No options are selected.  In this case the focus ring is on the first
+    // non-disabled option (if any), so we should behave as if that's the option
+    // the user acted on.
+    if (!GetNonDisabledOptionFrom(0, &aNewIndex)) {
+      return;
+    }
   }
 
   // If you hold control, but not shift, no key will actually do anything
   // except space.
   nsWeakFrame weakFrame(this);
   bool wasChanged = false;
   if (aIsControlOrMeta && !aIsShift && aCharCode != ' ') {
     mStartSelectionIndex = aNewIndex;
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -44,16 +44,18 @@ class HTMLOptionsCollection;
  */
 
 class nsListControlFrame final : public nsHTMLScrollFrame,
                                  public nsIFormControlFrame,
                                  public nsIListControlFrame,
                                  public nsISelectControlFrame
 {
 public:
+  typedef mozilla::dom::HTMLOptionElement HTMLOptionElement;
+
   friend nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell,
                                                   nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
     // nsIFrame
   virtual nsresult HandleEvent(nsPresContext* aPresContext,
@@ -113,17 +115,17 @@ public:
     // for accessibility purposes
 #ifdef ACCESSIBILITY
   virtual mozilla::a11y::AccType AccessibleType() override;
 #endif
 
     // nsIListControlFrame
   virtual void SetComboboxFrame(nsIFrame* aComboboxFrame) override;
   virtual int32_t GetSelectedIndex() override;
-  virtual mozilla::dom::HTMLOptionElement* GetCurrentOption() override;
+  virtual HTMLOptionElement* GetCurrentOption() override;
 
   /**
    * Gets the text of the currently selected item.
    * If the there are zero items then an empty string is returned
    * If there is nothing selected, then the 0th item's text is returned.
    */
   virtual void GetOptionText(uint32_t aIndex, nsAString& aStr) override;
 
@@ -175,17 +177,17 @@ public:
 
   /**
    * Returns the options collection for mContent, if any.
    */
   mozilla::dom::HTMLOptionsCollection* GetOptions() const;
   /**
    * Returns the HTMLOptionElement for a given index in mContent's collection.
    */
-  mozilla::dom::HTMLOptionElement* GetOption(uint32_t aIndex) const;
+  HTMLOptionElement* GetOption(uint32_t aIndex) const;
 
   static void ComboboxFocusSet();
 
   // Helper
   bool IsFocused() { return this == mFocused; }
 
   /**
    * Function to paint the focus rect when our nsSelectsAreaFrame is painting.
@@ -253,16 +255,23 @@ public:
    * fire a native focus event for accessibility
    * (Some 3rd party products need to track our focus)
    */
   void FireMenuItemActiveEvent(); // Inform assistive tech what got focused
 #endif
 
 protected:
   /**
+   * Return the first non-disabled option starting at aFromIndex (inclusive).
+   * @param aFoundIndex if non-null, set to the index of the returned option 
+   */
+  HTMLOptionElement* GetNonDisabledOptionFrom(int32_t aFromIndex,
+                                              int32_t* aFoundIndex = nullptr);
+
+  /**
    * Updates the selected text in a combobox and then calls FireOnChange().
    * @note This method might destroy the frame, pres shell and other objects.
    * Returns false if calling it destroyed |this|.
    */
   bool       UpdateSelection();
 
   /**
    * Returns whether mContent supports multiple selection.
@@ -277,17 +286,17 @@ protected:
    * @note This method might destroy the frame, pres shell and other objects.
    */
   void       DropDownToggleKey(nsIDOMEvent* aKeyEvent);
 
   nsresult   IsOptionDisabled(int32_t anIndex, bool &aIsDisabled);
   /**
    * @note This method might destroy the frame, pres shell and other objects.
    */
-  void ScrollToFrame(mozilla::dom::HTMLOptionElement& aOptElement);
+  void ScrollToFrame(HTMLOptionElement& aOptElement);
   /**
    * @note This method might destroy the frame, pres shell and other objects.
    */
   void ScrollToIndex(int32_t anIndex);
 
   /**
    * When the user clicks on the comboboxframe to show the dropdown
    * listbox, they then have to move the mouse into the list. We don't
--- a/layout/forms/test/mochitest.ini
+++ b/layout/forms/test/mochitest.ini
@@ -59,8 +59,9 @@ skip-if = buildapp == 'mulet' || buildap
 [test_bug1305282.html]
 [test_listcontrol_search.html]
 skip-if = toolkit == 'android' #select elements don't use an in-page popup on Android
 [test_select_prevent_default.html]
 [test_select_vertical.html]
 skip-if = e10s || toolkit == 'android' # Bug 1170129 - vertical <select> popup not implemented for e10s # <select> elements don't use an in-page popup on Android
 [test_textarea_resize.html]
 skip-if = toolkit == 'android'
+[test_bug1327129.html]
new file mode 100644
--- /dev/null
+++ b/layout/forms/test/test_bug1327129.html
@@ -0,0 +1,385 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=935876
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1327129</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1327129">Mozilla Bug 1327129</a>
+<p id="display"></p>
+<div>
+<select size="3" firstNonDisabledIndex="0">
+  <option>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" firstNonDisabledIndex="1">
+  <option disabled>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" firstNonDisabledIndex="0">
+  <optgroup><option>1</option></optgroup>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" firstNonDisabledIndex="1">
+  <option disabled>1</option>
+  <optgroup><option>2</option></optgroup>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" firstNonDisabledIndex="2">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" firstNonDisabledIndex="-1">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option disabled>3</option>
+  <option disabled>4</option>
+  <option disabled>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="0">
+  <option>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="0">
+  <option>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="0">
+  <optgroup><option>1</option></optgroup>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="1">
+  <option disabled>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="3">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option disabled>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="3" multiple firstNonDisabledIndex="-1">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option disabled>3</option>
+  <option disabled>4</option>
+  <option disabled>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="0">
+  <option>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="0">
+  <optgroup><option>1</option></optgroup>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="1">
+  <optgroup disabled><option>1</option></optgroup>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="1">
+  <option disabled>1</option>
+  <option>2</option>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="1">
+  <option disabled>1</option>
+  <optgroup><option>2</option></optgroup>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="2">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="3">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option disabled>3</option>
+  <option>4</option>
+  <option>5</option>
+</select>
+<select size="1" firstNonDisabledIndex="-1">
+  <option disabled>1</option>
+  <optgroup><option disabled>2</option></optgroup>
+  <option disabled>3</option>
+  <option disabled>4</option>
+  <option disabled>5</option>
+</select>
+</div>
+<pre id="test">
+</pre>
+
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+const kIsMac = navigator.platform.indexOf("Mac") == 0;
+
+function runTests()
+{
+  const all = Array.from(document.querySelectorAll('select'));
+  let i = 0;
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    ++i;
+    if (!elem.id)
+      elem.id = "element " + i;
+  });
+
+  //
+  // Test DOWN key on a <select> with no selected options.
+  //
+  const listboxes = Array.from(document.querySelectorAll('select[size="3"]'));
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey("VK_DOWN", {});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": DOWN selected first non-disabled option");
+  });
+
+  const comboboxes = Array.from(document.querySelectorAll('select[size="1"]'));
+  // Mac shows the drop-down menu for DOWN, so skip this test there.
+  if (!kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey("VK_DOWN", {});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": DOWN selected first non-disabled option");
+    });
+  }
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test SHIFT+DOWN on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey("VK_DOWN", {shiftKey:true});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": SHIFT+DOWN selected first non-disabled option");
+  });
+
+  // Mac shows the drop-down menu for SHIFT+DOWN, so skip this test there.
+  if (!kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey("VK_DOWN", {shiftKey:true});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": SHIFT+DOWN selected first non-disabled option");
+    });
+  }
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test CTRL+DOWN on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey("VK_DOWN", {ctrlKey:true});
+    if (!elem.multiple)
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": CTRL+DOWN selected first non-disabled option");
+    else
+      is(elem.selectedIndex, -1, elem.id + ": CTRL+DOWN did NOT select first any option");
+  });
+
+  // Mac shows the drop-down menu for CTRL+DOWN, so skip this test there.
+  if (!kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey("VK_DOWN", {ctrlKey:true});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": CTRL+DOWN selected first non-disabled option");
+    });
+  }
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test SPACE on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey(" ", {});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": SPACE selected first non-disabled option");
+  });
+
+  // All platforms shows the drop-down menu for SPACE so skip testing that
+  // on the comboboxes.
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test CTRL+SPACE on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey(" ", {ctrlKey:true});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": CTRL+SPACE selected first non-disabled option");
+  });
+
+  // non-Mac shows the drop-down menu for CTRL+SPACE, so skip this test there.
+  if (kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey(" ", {ctrlKey:true});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": CTRL+SPACE selected first non-disabled option");
+    });
+  }
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test SHIFT+SPACE on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey(" ", {shiftKey:true});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": SHIFT+SPACE selected first non-disabled option");
+  });
+
+  // All platforms shows the drop-down menu for SHIFT+SPACE so skip testing that
+  // on the comboboxes.
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test CTRL+SHIFT+DOWN on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey("VK_DOWN", {ctrlKey:true, shiftKey:true});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": CTRL+SHIFT+DOWN selected first non-disabled option");
+  });
+
+  // Mac shows the drop-down menu for CTRL+SHIFT+DOWN, so skip this test there.
+  if (!kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey("VK_DOWN", {ctrlKey:true, shiftKey:true});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": CTRL+SHIFT+DOWN selected first non-disabled option");
+    });
+  }
+
+  all.forEach((elem) => {
+    elem.selectedIndex = -1;
+    elem.blur();
+  });
+
+  //
+  // Test CTRL+SHIFT+SPACE on a <select> with no selected options.
+  //
+  listboxes.forEach((elem) => {
+    elem.focus();
+    synthesizeKey(" ", {ctrlKey:true, shiftKey:true});
+    is(""+elem.selectedIndex,
+       elem.getAttribute('firstNonDisabledIndex'),
+       elem.id + ": CTRL+SHIFT+SPACE selected first non-disabled option");
+  });
+
+  // non-Mac shows the drop-down menu for CTRL+SHIFT+SPACE, so skip this test there.
+  if (kIsMac) {
+    comboboxes.forEach((elem) => {
+      elem.focus();
+      synthesizeKey(" ", {ctrlKey:true, shiftKey:true});
+      is(""+elem.selectedIndex,
+         elem.getAttribute('firstNonDisabledIndex'),
+         elem.id + ": CTRL+SHIFT+SPACE selected first non-disabled option");
+    });
+  }
+
+  SimpleTest.finish();
+}
+
+
+SimpleTest.waitForFocus(runTests);
+</script>
+</body>
+</html>
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -240,20 +240,38 @@
 /**
  * MOZ_MUST_USE tells the compiler to emit a warning if a function's
  * return value is not used by the caller.
  *
  * Place this attribute at the very beginning of a function declaration. For
  * example, write
  *
  *   MOZ_MUST_USE int foo();
+ * or
+ *   MOZ_MUST_USE int foo() { return 42; }
  *
- * or
+ * MOZ_MUST_USE is most appropriate for functions where the return value is
+ * some kind of success/failure indicator -- often |nsresult|, |bool| or |int|
+ * -- because these functions are most commonly the ones that have missing
+ * checks. There are three cases of note.
+ *
+ * - Fallible functions whose return values should always be checked. For
+ *   example, a function that opens a file should always be checked because any
+ *   subsequent operations on the file will fail if opening it fails. Such
+ *   functions should be given a MOZ_MUST_USE annotation.
  *
- *   MOZ_MUST_USE int foo() { return 42; }
+ * - Fallible functions whose return value need not always be checked. For
+ *   example, a function that closes a file might not be checked because it's
+ *   common that no further operations would be performed on the file. Such
+ *   functions do not need a MOZ_MUST_USE annotation.
+ *
+ * - Infallible functions, i.e. ones that always return a value indicating
+ *   success. These do not need a MOZ_MUST_USE annotation. Ideally, they would
+ *   be converted to not return a success/failure indicator, though sometimes
+ *   interface constraints prevent this.
  */
 #if defined(__GNUC__) || defined(__clang__)
 #  define MOZ_MUST_USE __attribute__ ((warn_unused_result))
 #else
 #  define MOZ_MUST_USE
 #endif
 
 /**
--- a/old-configure.in
+++ b/old-configure.in
@@ -2035,17 +2035,17 @@ dnl = If NSS was not detected in the sys
 dnl = use the one in the source tree (mozilla/security/nss)
 dnl ========================================================
 
 MOZ_ARG_WITH_BOOL(system-nss,
 [  --with-system-nss       Use system installed NSS],
     _USE_SYSTEM_NSS=1 )
 
 if test -n "$_USE_SYSTEM_NSS"; then
-    AM_PATH_NSS(3.28, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
+    AM_PATH_NSS(3.29, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
 fi
 
 if test -n "$MOZ_SYSTEM_NSS"; then
    NSS_LIBS="$NSS_LIBS -lcrmf"
 else
    NSS_CFLAGS="-I${DIST}/include/nss"
    case "${OS_ARCH}" in
         # Only few platforms have been tested with GYP
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -53,17 +53,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 static bool
 SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
 {
   JS::Rooted<JS::Value> prop(cx);
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -28,17 +28,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 static bool
 SealObjectAndPrototype(JSContext* cx, JS::Handle<JSObject *> parent, const char* name)
 {
   JS::Rooted<JS::Value> prop(cx);
   if (!JS_GetProperty(cx, parent, name, &prop))
     return false;
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -26,17 +26,17 @@ NS_IMPL_ISUPPORTS(Module, nsIXPCScriptab
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
 #define XPC_MAP_WANT_CALL
-#define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
+#define XPC_MAP_FLAGS 0
 #include "xpc_map_end.h"
 
 NS_IMETHODIMP
 Module::Call(nsIXPConnectWrappedNative* wrapper,
              JSContext* cx,
              JSObject* obj,
              const JS::CallArgs& args,
              bool* _retval)
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/ChaosMode.h"
 #include "mozilla/IOInterposer.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryChecking.h"
 #include "mozilla/Poison.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
-#include "mozilla/ServoBindings.h"
 #include "mozilla/Telemetry.h"
 
 #include "nsAppRunner.h"
 #include "mozilla/XREAppData.h"
 #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
 #include "nsUpdateDriver.h"
 #endif
 #include "ProfileReset.h"
@@ -4376,25 +4375,16 @@ XREMain::XRE_mainRun()
   SaveToEnv("NO_EM_RESTART=");
   SaveToEnv("XUL_APP_FILE=");
   SaveToEnv("XRE_BINARY_PATH=");
 
   if (!mShuttingDown) {
     rv = appStartup->CreateHiddenWindow();
     NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
-#ifdef MOZ_STYLO
-    // We initialize Servo here so that the hidden DOM window is available,
-    // since initializing Servo calls style struct constructors, and the
-    // HackilyFindDeviceContext stuff we have right now depends on the hidden
-    // DOM window. When we fix that, this should move back to
-    // nsLayoutStatics.cpp
-    Servo_Initialize();
-#endif
-
 #if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
     nsGTKToolkit* toolkit = nsGTKToolkit::GetToolkit();
     if (toolkit && !mDesktopStartupID.IsEmpty()) {
       toolkit->SetDesktopStartupID(mDesktopStartupID);
     }
     // Clear the environment variable so it won't be inherited by
     // child processes and confuse things.
     g_unsetenv ("DESKTOP_STARTUP_ID");
@@ -4493,22 +4483,16 @@ XREMain::XRE_mainRun()
   {
     rv = appStartup->Run();
     if (NS_FAILED(rv)) {
       NS_ERROR("failed to run appstartup");
       gLogConsoleErrors = true;
     }
   }
 
-#ifdef MOZ_STYLO
-    // This, along with the call to Servo_Initialize, should eventually move back
-    // to nsLayoutStatics.cpp.
-    Servo_Shutdown();
-#endif
-
   return rv;
 }
 
 #if MOZ_WIDGET_GTK == 2
 void XRE_GlibInit()
 {
   static bool ran_once = false;
 
--- a/widget/PluginWidgetProxy.cpp
+++ b/widget/PluginWidgetProxy.cpp
@@ -176,17 +176,17 @@ PluginWidgetProxy::SetNativeData(uint32_
       mActor->SendSetNativeChildWindow(aVal);
       break;
     default:
       NS_ERROR("SetNativeData called with unsupported data type.");
   }
 }
 #endif
 
-NS_IMETHODIMP
+nsresult
 PluginWidgetProxy::SetFocus(bool aRaise)
 {
   ENSURE_CHANNEL;
   PWLOG("PluginWidgetProxy::SetFocus(%d)\n", aRaise);
   mActor->SendSetFocus(aRaise);
   return NS_OK;
 }
 
--- a/widget/PluginWidgetProxy.h
+++ b/widget/PluginWidgetProxy.h
@@ -36,17 +36,17 @@ public:
   // nsIWidget
   using PuppetWidget::Create; // for Create signature not overridden here
   virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                        nsNativeWidget aNativeParent,
                                        const LayoutDeviceIntRect& aRect,
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
   virtual void Destroy() override;
-  NS_IMETHOD SetFocus(bool aRaise = false) override;
+  virtual nsresult SetFocus(bool aRaise = false) override;
   virtual void SetParent(nsIWidget* aNewParent) override;
 
   virtual nsIWidget* GetParent(void) override;
   virtual void* GetNativeData(uint32_t aDataType) override;
 #if defined(XP_WIN)
   void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
 #endif
   virtual nsTransparencyMode GetTransparencyMode() override
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -185,17 +185,17 @@ PuppetWidget::Destroy()
   mChild = nullptr;
   if (mLayerManager) {
     mLayerManager->Destroy();
   }
   mLayerManager = nullptr;
   mTabChild = nullptr;
 }
 
-NS_IMETHODIMP
+void
 PuppetWidget::Show(bool aState)
 {
   NS_ASSERTION(mEnabled,
                "does it make sense to Show()/Hide() a disabled widget?");
 
   bool wasVisible = mVisible;
   mVisible = aState;
 
@@ -211,18 +211,16 @@ PuppetWidget::Show(bool aState)
     // PuppetWidget was hidden, those layers are dropped,
     // so the previously attached widget listener is really
     // of no use anymore (and is actually actively harmful - see
     // bug 1323586).
     mPreviouslyAttachedWidgetListener = nullptr;
     Resize(mBounds.width, mBounds.height, false);
     Invalidate(mBounds);
   }
-
-  return NS_OK;
 }
 
 void
 PuppetWidget::Resize(double aWidth,
                      double aHeight,
                      bool   aRepaint)
 {
   LayoutDeviceIntRect oldBounds = mBounds;
@@ -271,60 +269,60 @@ PuppetWidget::ConfigureChildren(const ns
     } else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
       w->Move(configuration.mBounds.x, configuration.mBounds.y);
     }
     w->SetWindowClipRegion(configuration.mClipRegion, false);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 PuppetWidget::SetFocus(bool aRaise)
 {
   if (aRaise && mTabChild) {
     mTabChild->SendRequestFocus(true);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 PuppetWidget::Invalidate(const LayoutDeviceIntRect& aRect)
 {
 #ifdef DEBUG
   debug_DumpInvalidate(stderr, this, &aRect, "PuppetWidget", 0);
 #endif
 
   if (mChild) {
-    return mChild->Invalidate(aRect);
+    mChild->Invalidate(aRect);
+    return;
   }
 
   mDirtyRegion.Or(mDirtyRegion, aRect);
 
   if (!mDirtyRegion.IsEmpty() && !mPaintTask.IsPending()) {
     mPaintTask = new PaintTask(this);
-    return NS_DispatchToCurrentThread(mPaintTask.get());
+    NS_DispatchToCurrentThread(mPaintTask.get());
+    return;
   }
-
-  return NS_OK;
 }
 
 void
 PuppetWidget::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint)
 {
   if (nullptr == aPoint) {
     event.mRefPoint = LayoutDeviceIntPoint(0, 0);
   } else {
     // use the point override if provided
     event.mRefPoint = *aPoint;
   }
   event.mTime = PR_Now() / 1000;
 }
 
-NS_IMETHODIMP
+nsresult
 PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
 {
 #ifdef DEBUG
   debug_DumpEvent(stdout, event->mWidget, event, "PuppetWidget", 0);
 #endif
 
   MOZ_ASSERT(!mChild || mChild->mWindowType == eWindowType_popup,
              "Unexpected event dispatch!");
@@ -526,17 +524,17 @@ PuppetWidget::UpdateZoomConstraints(cons
 }
 
 bool
 PuppetWidget::AsyncPanZoomEnabled() const
 {
   return mTabChild && mTabChild->AsyncPanZoomEnabled();
 }
 
-NS_IMETHODIMP_(bool)
+bool
 PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                                       const mozilla::WidgetKeyboardEvent& aEvent,
                                       DoCommandCallback aCallback,
                                       void* aCallbackData)
 {
   // B2G doesn't have native key bindings.
 #ifdef MOZ_WIDGET_GONK
   return false;
@@ -705,17 +703,17 @@ void
 PuppetWidget::DefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent)
 {
   if (!mTabChild) {
     return;
   }
   mTabChild->SendDefaultProcOfPluginEvent(aEvent);
 }
 
-NS_IMETHODIMP_(void)
+void
 PuppetWidget::SetInputContext(const InputContext& aContext,
                               const InputContextAction& aAction)
 {
   mInputContext = aContext;
   // Any widget instances cannot cache IME open state because IME open state
   // can be changed by user but native IME may not notify us of changing the
   // open state on some platforms.
   mInputContext.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
@@ -732,17 +730,17 @@ PuppetWidget::SetInputContext(const Inpu
     static_cast<int32_t>(aContext.mIMEState.mOpen),
     aContext.mHTMLInputType,
     aContext.mHTMLInputInputmode,
     aContext.mActionHint,
     static_cast<int32_t>(aAction.mCause),
     static_cast<int32_t>(aAction.mFocusChange));
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 PuppetWidget::GetInputContext()
 {
 #ifndef MOZ_CROSS_PROCESS_IME
   return InputContext();
 #endif
 
   // XXX Currently, we don't support retrieving IME open state from child
   //     process.
@@ -765,17 +763,17 @@ PuppetWidget::GetInputContext()
     int32_t enabled, open;
     mTabChild->SendGetInputContext(&enabled, &open);
     context.mIMEState.mEnabled = static_cast<IMEState::Enabled>(enabled);
     context.mIMEState.mOpen = static_cast<IMEState::Open>(open);
   }
   return context;
 }
 
-NS_IMETHODIMP_(NativeIMEContext)
+NativeIMEContext
 PuppetWidget::GetNativeIMEContext()
 {
   return mNativeIMEContext;
 }
 
 nsresult
 PuppetWidget::NotifyIMEOfFocusChange(const IMENotification& aIMENotification)
 {
@@ -972,40 +970,38 @@ PuppetWidget::NotifyIMEOfPositionChange(
   if (mIMEPreferenceOfParent.WantPositionChanged()) {
     mTabChild->SendNotifyIMEPositionChange(mContentCache, aIMENotification);
   } else {
     mTabChild->SendUpdateContentCache(mContentCache);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 PuppetWidget::SetCursor(nsCursor aCursor)
 {
   // Don't cache on windows, Windowless flash breaks this via async cursor updates.
 #if !defined(XP_WIN)
   if (mCursor == aCursor && !mCustomCursor && !mUpdateCursor) {
-    return NS_OK;
+    return;
   }
 #endif
 
   mCustomCursor = nullptr;
 
   if (mTabChild &&
       !mTabChild->SendSetCursor(aCursor, mUpdateCursor)) {
-    return NS_ERROR_FAILURE;
+    return;
   }
 
   mCursor = aCursor;
   mUpdateCursor = false;
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 PuppetWidget::SetCursor(imgIContainer* aCursor,
                         uint32_t aHotspotX, uint32_t aHotspotY)
 {
   if (!aCursor || !mTabChild) {
     return NS_OK;
   }
 
 #if !defined(XP_WIN)
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -73,17 +73,17 @@ public:
 
   virtual already_AddRefed<nsIWidget>
   CreateChild(const LayoutDeviceIntRect& aRect,
               nsWidgetInitData* aInitData = nullptr,
               bool aForceUseIWidgetParent = false) override;
 
   virtual void Destroy() override;
 
-  NS_IMETHOD Show(bool aState) override;
+  virtual void Show(bool aState) override;
 
   virtual bool IsVisible() const override
   { return mVisible; }
 
   virtual void ConstrainPosition(bool     /*ignored aAllowSlop*/,
                                  int32_t* aX,
                                  int32_t* aY) override
   { *aX = kMaxDimension; *aY = kMaxDimension; }
@@ -110,50 +110,51 @@ public:
 
   // XXX/cjones: copying gtk behavior here; unclear what disabling a
   // widget is supposed to entail
   virtual void Enable(bool aState) override
   { mEnabled = aState; }
   virtual bool IsEnabled() const override
   { return mEnabled; }
 
-  NS_IMETHOD SetFocus(bool aRaise = false) override;
+  virtual nsresult SetFocus(bool aRaise = false) override;
 
   virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
 
-  NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
+  virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
 
   // PuppetWidgets don't have native data, as they're purely nonnative.
   virtual void* GetNativeData(uint32_t aDataType) override;
 #if defined(XP_WIN)
   void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
 #endif
 
   // PuppetWidgets don't have any concept of titles.
-  NS_IMETHOD SetTitle(const nsAString& aTitle) override
+  virtual nsresult SetTitle(const nsAString& aTitle) override
   { return NS_ERROR_UNEXPECTED; }
 
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override
   { return LayoutDeviceIntPoint::FromUnknownPoint(GetWindowPosition() + GetChromeDimensions()); }
 
   int32_t RoundsWidgetCoordinatesTo() override;
 
   void InitEvent(WidgetGUIEvent& aEvent,
                  LayoutDeviceIntPoint* aPoint = nullptr);
 
-  NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
+  virtual nsresult DispatchEvent(WidgetGUIEvent* aEvent,
+                                 nsEventStatus& aStatus) override;
   nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
   void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
                               const nsTArray<ScrollableLayerGuid>& aTargets) const override;
   void UpdateZoomConstraints(const uint32_t& aPresShellId,
                              const FrameMetrics::ViewID& aViewId,
                              const mozilla::Maybe<ZoomConstraints>& aConstraints) override;
   bool AsyncPanZoomEnabled() const override;
 
-  NS_IMETHOD_(bool)
+  virtual bool
   ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                           const mozilla::WidgetKeyboardEvent& aEvent,
                           DoCommandCallback aCallback,
                           void* aCallbackData) override;
 
   friend struct AutoCacheNativeKeyCommands;
 
   //
@@ -172,25 +173,25 @@ public:
   virtual LayerManager*
   GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
                   LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
                   LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
 
   // This is used after a compositor reset.
   LayerManager* RecreateLayerManager(PLayerTransactionChild* aShadowManager);
 
-  NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                    const InputContextAction& aAction) override;
-  NS_IMETHOD_(InputContext) GetInputContext() override;
-  NS_IMETHOD_(NativeIMEContext) GetNativeIMEContext() override;
+  virtual void SetInputContext(const InputContext& aContext,
+                               const InputContextAction& aAction) override;
+  virtual InputContext GetInputContext() override;
+  virtual NativeIMEContext GetNativeIMEContext() override;
   virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
 
-  NS_IMETHOD SetCursor(nsCursor aCursor) override;
-  NS_IMETHOD SetCursor(imgIContainer* aCursor,
-                       uint32_t aHotspotX, uint32_t aHotspotY) override;
+  virtual void SetCursor(nsCursor aCursor) override;
+  virtual nsresult SetCursor(imgIContainer* aCursor,
+                             uint32_t aHotspotX, uint32_t aHotspotY) override;
 
   virtual void ClearCachedCursor() override;
 
   // Gets the DPI of the screen corresponding to this widget.
   // Contacts the parent process which gets the DPI from the
   // proper widget there. TODO: Handle DPI changes that happen
   // later on.
   virtual float GetDPI() override;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1602,17 +1602,17 @@ nsWindow::Destroy()
 
     nsBaseWidget::OnDestroy();
 
 #ifdef DEBUG_ANDROID_WIDGET
     DumpWindows();
 #endif
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
 {
     for (uint32_t i = 0; i < config.Length(); ++i) {
         nsWindow *childWin = (nsWindow*) config[i].mChild.get();
         childWin->Resize(config[i].mBounds.x,
                          config[i].mBounds.y,
                          config[i].mBounds.width,
                          config[i].mBounds.height,
@@ -1672,28 +1672,28 @@ nsWindow::GetDefaultScaleInternal()
 {
 
     nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
     MOZ_ASSERT(screen);
     RefPtr<nsScreenAndroid> screenAndroid = (nsScreenAndroid*) screen.get();
     return screenAndroid->GetDensity();
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Show(bool aState)
 {
     ALOG("nsWindow[%p]::Show %d", (void*)this, aState);
 
     if (mWindowType == eWindowType_invisible) {
         ALOG("trying to show invisible window! ignoring..");
-        return NS_ERROR_FAILURE;
+        return;
     }
 
     if (aState == mIsVisible)
-        return NS_OK;
+        return;
 
     mIsVisible = aState;
 
     if (IsTopLevel()) {
         // XXX should we bring this to the front when it's shown,
         // if it's a toplevel widget?
 
         // XXX we should synthesize a eMouseExitFromWidget (for old top
@@ -1719,18 +1719,16 @@ nsWindow::Show(bool aState)
         }
     } else if (FindTopLevel() == nsWindow::TopWindow()) {
         RedrawAll();
     }
 
 #ifdef DEBUG_ANDROID_WIDGET
     DumpWindows();
 #endif
-
-    return NS_OK;
 }
 
 bool
 nsWindow::IsVisible() const
 {
     return mIsVisible;
 }
 
@@ -1833,20 +1831,19 @@ nsWindow::Enable(bool aState)
 }
 
 bool
 nsWindow::IsEnabled() const
 {
     return true;
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
-    return NS_OK;
 }
 
 nsWindow*
 nsWindow::FindTopLevel()
 {
     nsWindow *toplevel = this;
     while (toplevel) {
         if (toplevel->IsTopLevel())
@@ -1854,17 +1851,17 @@ nsWindow::FindTopLevel()
 
         toplevel = toplevel->mParent;
     }
 
     ALOG("nsWindow::FindTopLevel(): couldn't find a toplevel or dialog window in this [%p] widget's hierarchy!", (void*)this);
     return this;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetFocus(bool aRaise)
 {
     nsWindow *top = FindTopLevel();
     top->BringToFront();
 
     return NS_OK;
 }
 
@@ -1927,17 +1924,17 @@ nsWindow::WidgetToScreenOffset()
         p.y += w->mBounds.y;
 
         w = w->mParent;
     }
 
     return p;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::DispatchEvent(WidgetGUIEvent* aEvent,
                         nsEventStatus& aStatus)
 {
     aStatus = DispatchEvent(aEvent);
     return NS_OK;
 }
 
 nsEventStatus
@@ -3347,17 +3344,17 @@ nsWindow::NotifyIMEInternal(const IMENot
     }
 
     if (mGeckoViewSupport->NotifyIME(aIMENotification)) {
         return NS_OK;
     }
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP_(void)
+void
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
     nsWindow* top = FindTopLevel();
     MOZ_ASSERT(top);
 
     if (!top->mGeckoViewSupport) {
         // Non-GeckoView windows don't support IME operations.
@@ -3366,17 +3363,17 @@ nsWindow::SetInputContext(const InputCon
 
     // We are using an IME event later to notify Java, and the IME event
     // will be processed by the top window. Therefore, to ensure the
     // IME event uses the correct mInputContext, we need to let the top
     // window process SetInputContext
     top->mGeckoViewSupport->SetInputContext(aContext, aAction);
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 nsWindow::GetInputContext()
 {
     nsWindow* top = FindTopLevel();
     MOZ_ASSERT(top);
 
     if (!top->mGeckoViewSupport) {
         // Non-GeckoView windows don't support IME operations.
         return InputContext();
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -152,22 +152,22 @@ public:
     //
 
     using nsBaseWidget::Create; // for Create signature not overridden here
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData) override;
     virtual void Destroy() override;
-    NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&) override;
+    virtual nsresult ConfigureChildren(const nsTArray<nsIWidget::Configuration>&) override;
     virtual void SetParent(nsIWidget* aNewParent) override;
     virtual nsIWidget *GetParent(void) override;
     virtual float GetDPI() override;
     virtual double GetDefaultScaleInternal() override;
-    NS_IMETHOD Show(bool aState) override;
+    virtual void Show(bool aState) override;
     virtual bool IsVisible() const override;
     virtual void ConstrainPosition(bool aAllowSlop,
                                    int32_t *aX,
                                    int32_t *aY) override;
     virtual void Move(double aX,
                       double aY) override;
     virtual void Resize(double aWidth,
                         double aHeight,
@@ -176,42 +176,39 @@ public:
                         double aY,
                         double aWidth,
                         double aHeight,
                         bool aRepaint) override;
     void SetZIndex(int32_t aZIndex) override;
     virtual void SetSizeMode(nsSizeMode aMode) override;
     virtual void Enable(bool aState) override;
     virtual bool IsEnabled() const override;
-    NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
-    NS_IMETHOD SetFocus(bool aRaise = false) override;
+    virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
+    virtual nsresult SetFocus(bool aRaise = false) override;
     virtual LayoutDeviceIntRect GetScreenBounds() override;
     virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
-    NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
-                             nsEventStatus& aStatus) override;
+    virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+                                   nsEventStatus& aStatus) override;
     nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
     virtual already_AddRefed<nsIScreen> GetWidgetScreen() override;
     virtual nsresult MakeFullScreen(bool aFullScreen,
                                     nsIScreen* aTargetScreen = nullptr)
                                     override;
 
-    NS_IMETHOD SetCursor(nsCursor aCursor) override { return NS_ERROR_NOT_IMPLEMENTED; }
-    NS_IMETHOD SetCursor(imgIContainer* aCursor,
-                         uint32_t aHotspotX,
-                         uint32_t aHotspotY) override { return NS_ERROR_NOT_IMPLEMENTED; }
-    NS_IMETHOD SetHasTransparentBackground(bool aTransparent) { return NS_OK; }
-    NS_IMETHOD GetHasTransparentBackground(bool& aTransparent) { aTransparent = false; return NS_OK; }
+    virtual void SetCursor(nsCursor aCursor) override {}
+    virtual nsresult SetCursor(imgIContainer* aCursor, uint32_t aHotspotX,
+                               uint32_t aHotspotY) override { return NS_ERROR_NOT_IMPLEMENTED; }
     void* GetNativeData(uint32_t aDataType) override;
     void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
-    NS_IMETHOD SetTitle(const nsAString& aTitle) override { return NS_OK; }
+    virtual nsresult SetTitle(const nsAString& aTitle) override { return NS_OK; }
     virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override { return NS_ERROR_NOT_IMPLEMENTED; }
 
-    NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                      const InputContextAction& aAction) override;
-    NS_IMETHOD_(InputContext) GetInputContext() override;
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction) override;
+    virtual InputContext GetInputContext() override;
     virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
 
     void SetSelectionDragState(bool aState);
     LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
                                   LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
                                   LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
 
     virtual bool NeedsPaint() override;
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2512,17 +2512,17 @@ IMEInputHandler::GetCurrentTSMDocumentID
  *    run after the stack is finished, e.g, some methods cannot run the jobs
  *    during processing the focus event.  And also some other jobs should be
  *    run at the next focus event is processed.
  *    The pending methods are recorded in mPendingMethods.  They are executed
  *    by ExecutePendingMethods via FlushPendingMethods.
  *
  ******************************************************************************/
 
-NS_IMETHODIMP
+nsresult
 IMEInputHandler::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
                            const IMENotification& aNotification)
 {
   switch (aNotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
       CommitIMEComposition();
       return NS_OK;
     case REQUEST_TO_CANCEL_COMPOSITION:
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -303,31 +303,31 @@ public:
   virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                        nsNativeWidget aNativeParent,
                                        const LayoutDeviceIntRect& aRect,
                                        nsWidgetInitData* aInitData = nullptr)
                                        override;
 
   virtual void            Destroy() override;
 
-  NS_IMETHOD              Show(bool aState) override;
+  virtual void            Show(bool aState) override;
   virtual bool            IsVisible() const override;
 
   virtual void            SetParent(nsIWidget* aNewParent) override;
   virtual nsIWidget*      GetParent(void) override;
   virtual float           GetDPI() override;
 
   virtual void            Move(double aX, double aY) override;
   virtual void            Resize(double aWidth, double aHeight, bool aRepaint) override;
   virtual void            Resize(double aX, double aY,
                                  double aWidth, double aHeight, bool aRepaint) override;
 
   virtual void            Enable(bool aState) override;
   virtual bool            IsEnabled() const override;
-  NS_IMETHOD              SetFocus(bool aRaise) override;
+  virtual nsresult        SetFocus(bool aRaise) override;
   virtual LayoutDeviceIntRect GetBounds() override;
   virtual LayoutDeviceIntRect GetClientBounds() override;
   virtual LayoutDeviceIntRect GetScreenBounds() override;
 
   // Returns the "backing scale factor" of the view's window, which is the
   // ratio of pixels in the window's backing store to Cocoa points. Prior to
   // HiDPI support in OS X 10.7, this was always 1.0, but in HiDPI mode it
   // will be 2.0 (and might potentially other values as screen resolutions
@@ -342,52 +342,54 @@ public:
   // Call if the window's backing scale factor changes - i.e., it is moved
   // between HiDPI and non-HiDPI screens
   void                    BackingScaleFactorChanged();
 
   virtual double          GetDefaultScaleInternal() override;
 
   virtual int32_t         RoundsWidgetCoordinatesTo() override;
 
-  NS_IMETHOD              Invalidate(const LayoutDeviceIntRect &aRect) override;
+  virtual void            Invalidate(const LayoutDeviceIntRect &aRect) override;
 
   virtual void*           GetNativeData(uint32_t aDataType) override;
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
   virtual bool            ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
 
   static  bool            ConvertStatus(nsEventStatus aStatus)
                           { return aStatus == nsEventStatus_eConsumeNoDefault; }
-  NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+  virtual nsresult        DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) override;
 
   virtual bool            WidgetTypeSupportsAcceleration() override;
   virtual bool            ShouldUseOffMainThreadCompositing() override;
 
-  NS_IMETHOD        SetCursor(nsCursor aCursor) override;
-  NS_IMETHOD        SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) override;
+  virtual void      SetCursor(nsCursor aCursor) override;
+  virtual nsresult  SetCursor(imgIContainer* aCursor,
+                              uint32_t aHotspotX, uint32_t aHotspotY) override;
 
-  NS_IMETHOD        SetTitle(const nsAString& title) override;
+  virtual nsresult  SetTitle(const nsAString& title) override;
 
   virtual MOZ_MUST_USE nsresult
                     GetAttention(int32_t aCycleCount) override;
 
   virtual bool HasPendingInputEvent() override;
 
-  NS_IMETHOD        ActivateNativeMenuItemAt(const nsAString& indexString) override;
-  NS_IMETHOD        ForceUpdateNativeMenuAt(const nsAString& indexString) override;
-  NS_IMETHOD        GetSelectionAsPlaintext(nsAString& aResult) override;
+  virtual nsresult  ActivateNativeMenuItemAt(const nsAString& indexString) override;
+  virtual nsresult  ForceUpdateNativeMenuAt(const nsAString& indexString) override;
+  virtual MOZ_MUST_USE nsresult
+                    GetSelectionAsPlaintext(nsAString& aResult) override;
 
-  NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                    const InputContextAction& aAction) override;
-  NS_IMETHOD_(InputContext) GetInputContext() override;
-  NS_IMETHOD_(TextEventDispatcherListener*)
+  virtual void SetInputContext(const InputContext& aContext,
+                               const InputContextAction& aAction) override;
+  virtual InputContext GetInputContext() override;
+  virtual TextEventDispatcherListener*
     GetNativeTextEventDispatcherListener() override;
   virtual MOZ_MUST_USE nsresult AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override;
-  NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
+  virtual bool ExecuteNativeKeyBinding(
                       NativeKeyBindingsType aType,
                       const mozilla::WidgetKeyboardEvent& aEvent,
                       DoCommandCallback aCallback,
                       void* aCallbackData) override;
   bool ExecuteNativeKeyBindingRemapped(
                       NativeKeyBindingsType aType,
                       const mozilla::WidgetKeyboardEvent& aEvent,
                       DoCommandCallback aCallback,
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -712,35 +712,35 @@ ManipulateViewWithoutNeedingDisplay(NSVi
     win = (BaseWindow*)[aView window];
   }
   [win disableSetNeedsDisplay];
   aCallback();
   [win enableSetNeedsDisplay];
 }
 
 // Hide or show this component
-NS_IMETHODIMP nsChildView::Show(bool aState)
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+void
+nsChildView::Show(bool aState)
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (aState != mVisible) {
     // Provide an autorelease pool because this gets called during startup
     // on the "hidden window", resulting in cocoa object leakage if there's
     // no pool in place.
     nsAutoreleasePool localPool;
 
     ManipulateViewWithoutNeedingDisplay(mView, ^{
       [mView setHidden:!aState];
     });
 
     mVisible = aState;
   }
-  return NS_OK;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 // Change the parent of this widget
 void
 nsChildView::SetParent(nsIWidget* aNewParent)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
@@ -824,45 +824,48 @@ nsChildView::Enable(bool aState)
 {
 }
 
 bool nsChildView::IsEnabled() const
 {
   return true;
 }
 
-NS_IMETHODIMP nsChildView::SetFocus(bool aRaise)
+nsresult
+nsChildView::SetFocus(bool aRaise)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   NSWindow* window = [mView window];
   if (window)
     [window makeFirstResponder:mView];
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 // Override to set the cursor on the mac
-NS_IMETHODIMP nsChildView::SetCursor(nsCursor aCursor)
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+void
+nsChildView::SetCursor(nsCursor aCursor)
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if ([mView isDragInProgress])
-    return NS_OK; // Don't change the cursor during dragging.
+    return; // Don't change the cursor during dragging.
 
   nsBaseWidget::SetCursor(aCursor);
-  return [[nsCursorManager sharedInstance] setCursor:aCursor];
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
+  [[nsCursorManager sharedInstance] setCursor:aCursor];
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 // implement to fix "hidden virtual function" warning
-NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
-                                      uint32_t aHotspotX, uint32_t aHotspotY)
+nsresult
+nsChildView::SetCursor(imgIContainer* aCursor,
+                       uint32_t aHotspotX, uint32_t aHotspotY)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   nsBaseWidget::SetCursor(aCursor, aHotspotX, aHotspotY);
   return [[nsCursorManager sharedInstance] setCursorWithImage:aCursor hotSpotX:aHotspotX hotSpotY:aHotspotY scaleFactor:BackingScaleFactor()];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
@@ -1237,17 +1240,18 @@ static NSMenuItem* NativeMenuItemWithLoc
         return nil;
     }
   }
 
   return nil;
 }
 
 // Used for testing native menu system structure and event handling.
-NS_IMETHODIMP nsChildView::ActivateNativeMenuItemAt(const nsAString& indexString)
+nsresult
+nsChildView::ActivateNativeMenuItemAt(const nsAString& indexString)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   NSString* locationString = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(indexString.BeginReading())
                                                      length:indexString.Length()];
   NSMenuItem* item = NativeMenuItemWithLocation([NSApp mainMenu], locationString);
   // We can't perform an action on an item with a submenu, that will raise
   // an obj-c exception.
@@ -1261,17 +1265,18 @@ NS_IMETHODIMP nsChildView::ActivateNativ
     }
   }
   return NS_ERROR_FAILURE;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 // Used for testing native menu system structure and event handling.
-NS_IMETHODIMP nsChildView::ForceUpdateNativeMenuAt(const nsAString& indexString)
+nsresult
+nsChildView::ForceUpdateNativeMenuAt(const nsAString& indexString)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   nsCocoaWindow *widget = GetXULWindowWidget();
   if (widget) {
     nsMenuBarX* mb = widget->GetMenuBar();
     if (mb) {
       if (indexString.IsEmpty())
@@ -1331,38 +1336,37 @@ static void blinkRgn(RgnHandle rgn)
 
   if (oldClip != NULL)
     ::SetClip(oldClip);
 }
 
 #endif
 
 // Invalidate this component's visible area
-NS_IMETHODIMP nsChildView::Invalidate(const LayoutDeviceIntRect& aRect)
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+void
+nsChildView::Invalidate(const LayoutDeviceIntRect& aRect)
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mView || !mVisible)
-    return NS_OK;
+    return;
 
   NS_ASSERTION(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT,
                "Shouldn't need to invalidate with accelerated OMTC layers!");
 
   if ([NSView focusView]) {
     // if a view is focussed (i.e. being drawn), then postpone the invalidate so that we
     // don't lose it.
     [mView setNeedsPendingDisplayInRect:DevPixelsToCocoaPoints(aRect)];
   }
   else {
     [mView setNeedsDisplayInRect:DevPixelsToCocoaPoints(aRect)];
   }
 
-  return NS_OK;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 bool
 nsChildView::WidgetTypeSupportsAcceleration()
 {
   // Don't use OpenGL for transparent windows or for popup windows.
   return mView && [[mView window] isOpaque] &&
          ![[mView window] isKindOfClass:[PopupWindow class]];
@@ -1388,18 +1392,18 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t 
 #pragma mark -
 
 nsresult nsChildView::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
 {
   return NS_OK;
 }
 
 // Invokes callback and ProcessEvent methods on Event Listener object
-NS_IMETHODIMP nsChildView::DispatchEvent(WidgetGUIEvent* event,
-                                         nsEventStatus& aStatus)
+nsresult
+nsChildView::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
 {
   RefPtr<nsChildView> kungFuDeathGrip(this);
 
 #ifdef DEBUG
   debug_DumpEvent(stdout, event->mWidget, event, "something", 0);
 #endif
 
   NS_ASSERTION(!(mTextInputHandler && mTextInputHandler->IsIMEComposing() &&
@@ -1603,17 +1607,18 @@ LayoutDeviceIntPoint nsChildView::Widget
   FlipCocoaScreenCoordinate(origin);
 
   // convert to device pixels
   return CocoaPointsToDevPixels(origin);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
-NS_IMETHODIMP nsChildView::SetTitle(const nsAString& title)
+nsresult
+nsChildView::SetTitle(const nsAString& title)
 {
   // child views don't have titles
   return NS_OK;
 }
 
 nsresult
 nsChildView::GetAttention(int32_t aCycleCount)
 {
@@ -1712,17 +1717,17 @@ nsChildView::SetPluginFocused(bool& aFoc
       ComplexTextInputPanel::GetSharedComplexTextInputPanel();
     if (ctiPanel) {
       ctiPanel->CancelComposition();
     }
   }
   mPluginFocused = aFocused;
 }
 
-NS_IMETHODIMP_(void)
+void
 nsChildView::SetInputContext(const InputContext& aContext,
                              const InputContextAction& aAction)
 {
   NS_ENSURE_TRUE_VOID(mTextInputHandler);
 
   if (mTextInputHandler->IsFocused()) {
     if (aContext.IsPasswordEditor()) {
       TextInputHandler::EnableSecureEventInput();
@@ -1750,17 +1755,17 @@ nsChildView::SetInputContext(const Input
       mTextInputHandler->SetASCIICapableOnly(true);
       mTextInputHandler->EnableIME(false);
       break;
     default:
       NS_ERROR("not implemented!");
   }
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 nsChildView::GetInputContext()
 {
   switch (mInputContext.mIMEState.mEnabled) {
     case IMEState::ENABLED:
     case IMEState::PLUGIN:
       if (mTextInputHandler) {
         mInputContext.mIMEState.mOpen =
           mTextInputHandler->IsIMEOpened() ? IMEState::OPEN : IMEState::CLOSED;
@@ -1770,17 +1775,17 @@ nsChildView::GetInputContext()
       MOZ_FALLTHROUGH;
     default:
       mInputContext.mIMEState.mOpen = IMEState::CLOSED;
       break;
   }
   return mInputContext;
 }
 
-NS_IMETHODIMP_(TextEventDispatcherListener*)
+TextEventDispatcherListener*
 nsChildView::GetNativeTextEventDispatcherListener()
 {
   if (NS_WARN_IF(!mTextInputHandler)) {
     return nullptr;
   }
   return mTextInputHandler;
 }
 
@@ -1819,17 +1824,17 @@ nsChildView::ExecuteNativeKeyBindingRema
   charactersIgnoringModifiers:chars
                     isARepeat:[originalEvent isARepeat]
                       keyCode:aCocoaKeyCode];
 
   NativeKeyBindings* keyBindings = NativeKeyBindings::GetInstance(aType);
   return keyBindings->Execute(modifiedEvent, aCallback, aCallbackData);
 }
 
-NS_IMETHODIMP_(bool)
+bool
 nsChildView::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                                      const WidgetKeyboardEvent& aEvent,
                                      DoCommandCallback aCallback,
                                      void* aCallbackData)
 {
   // If the key is a cursor-movement arrow, and the current selection has
   // vertical writing-mode, we'll remap so that the movement command
   // generated (in terms of characters/lines) will be appropriate for
@@ -6167,17 +6172,17 @@ provideDataForType:(NSString*)aType
                                     eContentCommandPasteTransferable,
                                     mGeckoChild);
   command.mTransferable = trans;
   mGeckoChild->DispatchWindowEvent(command);
 
   return command.mSucceeded && command.mIsEnabled;
 }
 
-NS_IMETHODIMP
+nsresult
 nsChildView::GetSelectionAsPlaintext(nsAString& aResult)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   if (!nsClipboard::sSelectionCache) {
     MOZ_ASSERT(aResult.IsEmpty());
     return NS_OK;
   }
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -232,25 +232,25 @@ public:
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData = nullptr)
                                          override;
 
     virtual void            Destroy() override;
 
-    NS_IMETHOD              Show(bool aState) override;
+    virtual void            Show(bool aState) override;
     virtual nsIWidget*      GetSheetWindowParent(void) override;
     virtual void            Enable(bool aState) override;
     virtual bool            IsEnabled() const override;
     virtual void            SetModal(bool aState) override;
     virtual void            SetFakeModal(bool aState) override;
     virtual bool            IsRunningAppModal() override;
     virtual bool            IsVisible() const override;
-    NS_IMETHOD              SetFocus(bool aState=false) override;
+    virtual nsresult        SetFocus(bool aState=false) override;
     virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
     virtual LayoutDeviceIntPoint GetClientOffset() override;
     virtual LayoutDeviceIntSize
     ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
 
     virtual void* GetNativeData(uint32_t aDataType) override;
 
     virtual void            ConstrainPosition(bool aAllowSlop,
@@ -263,67 +263,69 @@ public:
     void EnteredFullScreen(bool aFullScreen, bool aNativeMode = true);
     virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
     virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
                                              uint16_t aDuration,
                                              nsISupports* aData,
                                              nsIRunnable* aCallback) override;
     virtual nsresult MakeFullScreen(
       bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override final;
-    NS_IMETHOD MakeFullScreenWithNativeTransition(
+    virtual nsresult MakeFullScreenWithNativeTransition(
       bool aFullScreen, nsIScreen* aTargetScreen = nullptr) override final;
     NSAnimation* FullscreenTransitionAnimation() const { return mFullscreenTransitionAnimation; }
     void ReleaseFullscreenTransitionAnimation()
     {
       MOZ_ASSERT(mFullscreenTransitionAnimation,
                  "Should only be called when there is animation");
       [mFullscreenTransitionAnimation release];
       mFullscreenTransitionAnimation = nil;
     }
 
     virtual void            Resize(double aWidth, double aHeight, bool aRepaint) override;
     virtual void            Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
     virtual LayoutDeviceIntRect GetClientBounds() override;
     virtual LayoutDeviceIntRect GetScreenBounds() override;
     void                    ReportMoveEvent();
     void                    ReportSizeEvent();
-    NS_IMETHOD              SetCursor(nsCursor aCursor) override;
-    NS_IMETHOD              SetCursor(imgIContainer* aCursor, uint32_t aHotspotX, uint32_t aHotspotY) override;
+    virtual void            SetCursor(nsCursor aCursor) override;
+    virtual nsresult        SetCursor(imgIContainer* aCursor,
+                                      uint32_t aHotspotX, uint32_t aHotspotY)
+                                      override;
 
     CGFloat                 BackingScaleFactor();
     void                    BackingScaleFactorChanged();
     virtual double          GetDefaultScaleInternal() override;
     virtual int32_t         RoundsWidgetCoordinatesTo() override;
 
     mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final {
       return mozilla::DesktopToLayoutDeviceScale(BackingScaleFactor());
     }
 
-    NS_IMETHOD              SetTitle(const nsAString& aTitle) override;
+    virtual nsresult        SetTitle(const nsAString& aTitle) override;
 
-    NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
+    virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
     virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
     virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
                                           LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
                                           LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
-    NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
-                             nsEventStatus& aStatus) override;
+    virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+                                   nsEventStatus& aStatus) override;
     virtual void CaptureRollupEvents(nsIRollupListener * aListener,
                                      bool aDoCapture) override;
     virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
     virtual bool HasPendingInputEvent() override;
     virtual nsTransparencyMode GetTransparencyMode() override;
     virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
     virtual void SetWindowShadowStyle(int32_t aStyle) override;
     virtual void SetShowsToolbarButton(bool aShow) override;
     virtual void SetShowsFullScreenButton(bool aShow) override;
     virtual void SetWindowAnimationType(WindowAnimationType aType) override;
     virtual void SetDrawsTitle(bool aDrawTitle) override;
     virtual void SetUseBrightTitlebarForeground(bool aBrightForeground) override;
-    NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
+    virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
     virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
     virtual void SetDrawsInTitlebar(bool aState) override;
     virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
     virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
                                                 uint32_t aNativeMessage,
                                                 uint32_t aModifierFlags,
                                                 nsIObserver* aObserver) override;
 
@@ -333,24 +335,23 @@ public:
     virtual bool DragEvent(unsigned int aMessage, mozilla::gfx::Point aMouseGlobal, UInt16 aKeyModifiers);
 
     bool HasModalDescendents() { return mNumModalDescendents > 0; }
     NSWindow *GetCocoaWindow() { return mWindow; }
 
     void SetMenuBar(nsMenuBarX* aMenuBar);
     nsMenuBarX *GetMenuBar();
 
-    NS_IMETHOD_(void) SetInputContext(
-                        const InputContext& aContext,
-                        const InputContextAction& aAction) override;
-    NS_IMETHOD_(InputContext) GetInputContext() override
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction) override;
+    virtual InputContext GetInputContext() override
     {
       return mInputContext;
     }
-    NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
+    virtual bool ExecuteNativeKeyBinding(
                         NativeKeyBindingsType aType,
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData) override;
 
     void SetPopupWindowLevel();
 
 protected:
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -493,17 +493,17 @@ nsresult nsCocoaWindow::CreateNativeWind
   [[WindowDataMap sharedWindowDataMap] ensureDataForWindow:mWindow];
   mWindowMadeHere = true;
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-NS_IMETHODIMP
+nsresult
 nsCocoaWindow::CreatePopupContentView(const LayoutDeviceIntRect &aRect)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   // We need to make our content view a ChildView.
   mPopupContentView = new nsChildView();
   if (!mPopupContentView)
     return NS_ERROR_FAILURE;
@@ -728,56 +728,57 @@ nsCocoaWindow::SetFakeModal(bool aState)
 
 bool
 nsCocoaWindow::IsRunningAppModal()
 {
   return [NSApp _isRunningAppModal];
 }
 
 // Hide or show this window
-NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
+void
+nsCocoaWindow::Show(bool bState)
 {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mWindow)
-    return NS_OK;
+    return;
 
   // We need to re-execute sometimes in order to bring already-visible
   // windows forward.
   if (!mSheetNeedsShow && !bState && ![mWindow isVisible])
-    return NS_OK;
+    return;
 
   // Protect against re-entering.
   if (bState && [mWindow isBeingShown])
-    return NS_OK;
+    return;
 
   [mWindow setBeingShown:bState];
 
   nsIWidget* parentWidget = mParent;
   nsCOMPtr<nsPIWidgetCocoa> piParentWidget(do_QueryInterface(parentWidget));
   NSWindow* nativeParentWindow = (parentWidget) ?
     (NSWindow*)parentWidget->GetNativeData(NS_NATIVE_WINDOW) : nil;
 
   if (bState && !mBounds.IsEmpty()) {
     // Don't try to show a popup when the parent isn't visible or is minimized.
     if (mWindowType == eWindowType_popup && nativeParentWindow) {
       if (![nativeParentWindow isVisible] || [nativeParentWindow isMiniaturized]) {
-        return NS_OK;
+        return;
       }
     }
 
     if (mPopupContentView) {
       // Ensure our content view is visible. We never need to hide it.
       mPopupContentView->Show(true);
     }
 
     if (mWindowType == eWindowType_sheet) {
       // bail if no parent window (its basically what we do in Carbon)
       if (!nativeParentWindow || !piParentWidget)
-        return NS_ERROR_FAILURE;
+        return;
 
       NSWindow* topNonSheetWindow = nativeParentWindow;
       
       // If this sheet is the child of another sheet, hide the parent so that
       // this sheet can be displayed. Leave the parent mSheetNeedsShow alone,
       // that is only used to handle sibling sheet contention. The parent will
       // return once there are no more child sheets.
       bool parentIsSheet = false;
@@ -978,19 +979,17 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool b
           postNotificationName:@"com.apple.HIToolbox.endMenuTrackingNotification"
                         object:@"org.mozilla.gecko.PopupWindow"];
       }
     }
   }
 
   [mWindow setBeingShown:NO];
 
-  return NS_OK;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
+  NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 struct ShadowParams {
   float standardDeviation;
   float density;
   int offsetX;
   int offsetY;
   unsigned int flags;
@@ -1333,19 +1332,18 @@ nsCocoaWindow::HideWindowChrome(bool aSh
   while ((child = [enumerator nextObject])) {
     [mWindow addChildWindow:child ordered:NSWindowAbove];
   }
 
   // Show the new window.
   if (isVisible) {
     bool wasAnimationSuppressed = mIsAnimationSuppressed;
     mIsAnimationSuppressed = true;
-    rv = Show(true);
+    Show(true);
     mIsAnimationSuppressed = wasAnimationSuppressed;
-    NS_ENSURE_SUCCESS_VOID(rv);
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 class FullscreenTransitionData : public nsISupports
 {
 public:
@@ -1486,17 +1484,17 @@ nsCocoaWindow::ShouldToggleNativeFullscr
 }
 
 nsresult
 nsCocoaWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
 {
   return DoMakeFullScreen(aFullScreen, false);
 }
 
-NS_IMETHODIMP
+nsresult
 nsCocoaWindow::MakeFullScreenWithNativeTransition(bool aFullScreen,
                                                   nsIScreen* aTargetScreen)
 {
   return DoMakeFullScreen(aFullScreen, true);
 }
 
 nsresult
 nsCocoaWindow::DoMakeFullScreen(bool aFullScreen, bool aUseSystemTransition)
@@ -1776,34 +1774,36 @@ int32_t
 nsCocoaWindow::RoundsWidgetCoordinatesTo()
 {
   if (BackingScaleFactor() == 2.0) {
     return 2;
   }
   return 1;
 }
 
-NS_IMETHODIMP nsCocoaWindow::SetCursor(nsCursor aCursor)
+void
+nsCocoaWindow::SetCursor(nsCursor aCursor)
 {
-  if (mPopupContentView)
-    return mPopupContentView->SetCursor(aCursor);
-
-  return NS_OK;
+  if (mPopupContentView) {
+    mPopupContentView->SetCursor(aCursor);
+  }
 }
 
-NS_IMETHODIMP nsCocoaWindow::SetCursor(imgIContainer* aCursor,
-                                       uint32_t aHotspotX, uint32_t aHotspotY)
+nsresult
+nsCocoaWindow::SetCursor(imgIContainer* aCursor,
+                         uint32_t aHotspotX, uint32_t aHotspotY)
 {
   if (mPopupContentView)
     return mPopupContentView->SetCursor(aCursor, aHotspotX, aHotspotY);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsCocoaWindow::SetTitle(const nsAString& aTitle)
+nsresult
+nsCocoaWindow::SetTitle(const nsAString& aTitle)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   if (!mWindow)
     return NS_OK;
 
   const nsString& strTitle = PromiseFlatString(aTitle);
   NSString* title = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(strTitle.get())
@@ -1818,23 +1818,22 @@ NS_IMETHODIMP nsCocoaWindow::SetTitle(co
     [mWindow setTitle:title];
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-NS_IMETHODIMP nsCocoaWindow::Invalidate(const LayoutDeviceIntRect& aRect)
+void
+nsCocoaWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
   if (mPopupContentView) {
-    return mPopupContentView->Invalidate(aRect);
+    mPopupContentView->Invalidate(aRect);
   }
-
-  return NS_OK;
 }
 
 // Pass notification of some drag event to Gecko
 //
 // The drag manager has let us know that something related to a drag has
 // occurred in this window. It could be any number of things, ranging from 
 // a drop, to a drag enter/leave, or a drag over event. The actual event
 // is passed in |aMessage| and is passed along to our event hanlder so Gecko
@@ -1891,17 +1890,17 @@ NS_IMETHODIMP nsCocoaWindow::GetIsSheet(
 
 NS_IMETHODIMP nsCocoaWindow::GetSheetWindowParent(NSWindow** sheetWindowParent)
 {
   *sheetWindowParent = mSheetWindowParent;
   return NS_OK;
 }
 
 // Invokes callback and ProcessEvent methods on Event Listener object
-NS_IMETHODIMP 
+nsresult
 nsCocoaWindow::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
 {
   aStatus = nsEventStatus_eIgnore;
 
   nsCOMPtr<nsIWidget> kungFuDeathGrip(event->mWidget);
   mozilla::Unused << kungFuDeathGrip; // Not used within this function
 
   if (mWidgetListener)
@@ -2001,17 +2000,18 @@ void nsCocoaWindow::SetMenuBar(nsMenuBar
   // displayed when the app starts up.
   id windowDelegate = [mWindow delegate];
   if (mMenuBar &&
       ((!gSomeMenuBarPainted && nsMenuUtilsX::GetHiddenWindowMenuBar() == mMenuBar) ||
        (windowDelegate && [windowDelegate toplevelActiveState])))
     mMenuBar->Paint();
 }
 
-NS_IMETHODIMP nsCocoaWindow::SetFocus(bool aState)
+nsresult
+nsCocoaWindow::SetFocus(bool aState)
 {
   if (!mWindow)
     return NS_OK;
 
   if (mPopupContentView) {
     mPopupContentView->SetFocus(aState);
   }
   else if (aState && ([mWindow isVisible] || [mWindow isMiniaturized])) {
@@ -2225,17 +2225,18 @@ nsCocoaWindow::SetUseBrightTitlebarForeg
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [mWindow setUseBrightTitlebarForeground:aBrightForeground];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-NS_IMETHODIMP nsCocoaWindow::SetNonClientMargins(LayoutDeviceIntMargin &margins)
+nsresult
+nsCocoaWindow::SetNonClientMargins(LayoutDeviceIntMargin &margins)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   SetDrawsInTitlebar(margins.top == 0);
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
@@ -2330,28 +2331,28 @@ void nsCocoaWindow::SetPopupWindowLevel(
   else {
     // Otherwise, this is a top-level or parent popup. Parent popups always
     // appear just above their parent and essentially ignore the level.
     [mWindow setLevel:NSPopUpMenuWindowLevel];
     [mWindow setHidesOnDeactivate:NO];
   }
 }
 
-NS_IMETHODIMP_(void)
+void
 nsCocoaWindow::SetInputContext(const InputContext& aContext,
                                const InputContextAction& aAction)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   mInputContext = aContext;
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-NS_IMETHODIMP_(bool)
+bool
 nsCocoaWindow::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                                        const WidgetKeyboardEvent& aEvent,
                                        DoCommandCallback aCallback,
                                        void* aCallbackData)
 {
   NativeKeyBindings* keyBindings = NativeKeyBindings::GetInstance(aType);
   return keyBindings->Execute(aEvent, aCallback, aCallbackData);
 }
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -340,48 +340,49 @@ nsWindow::Destroy()
     mOnDestroyCalled = true;
     mScreen->UnregisterWindow(this);
     if (this == gFocusedWindow) {
         gFocusedWindow = nullptr;
     }
     nsBaseWidget::OnDestroy();
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Show(bool aState)
 {
     if (mWindowType == eWindowType_invisible) {
-        return NS_OK;
+        return;
     }
 
     if (mVisible == aState) {
-        return NS_OK;
+        return;
     }
 
     mVisible = aState;
     if (!IS_TOPLEVEL()) {
-        return mParent ? mParent->Show(aState) : NS_OK;
+        if (mParent) {
+            mParent->Show(aState);
+        }
+        return;
     }
 
     if (aState) {
         BringToTop();
     } else {
         const nsTArray<nsWindow*>& windows =
             mScreen->GetTopWindows();
         for (unsigned int i = 0; i < windows.Length(); i++) {
             nsWindow *win = windows[i];
             if (!win->mVisible) {
                 continue;
             }
             win->BringToTop();
             break;
         }
     }
-
-    return NS_OK;
 }
 
 bool
 nsWindow::IsVisible() const
 {
     return mVisible;
 }
 
@@ -423,52 +424,51 @@ nsWindow::Enable(bool aState)
 }
 
 bool
 nsWindow::IsEnabled() const
 {
     return true;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetFocus(bool aRaise)
 {
     if (aRaise) {
         BringToTop();
     }
 
     if (!IS_TOPLEVEL() && mScreen->IsPrimaryScreen()) {
         // We should only set focused window on non-toplevel primary window.
         gFocusedWindow = this;
     }
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>&)
 {
     return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
     nsWindow *top = mParent;
     while (top && top->mParent) {
         top = top->mParent;
     }
     const nsTArray<nsWindow*>& windows = mScreen->GetTopWindows();
     if (top != windows[0] && this != windows[0]) {
-        return NS_OK;
+        return;
     }
 
     gDrawRequest = true;
     mozilla::NotifyEvent();
-    return NS_OK;
 }
 
 LayoutDeviceIntPoint
 nsWindow::WidgetToScreenOffset()
 {
     LayoutDeviceIntPoint p(0, 0);
     nsWindow *w = this;
 
@@ -518,33 +518,33 @@ nsWindow::SetNativeData(uint32_t aDataTy
         }
         mScreen->SetEGLInfo(GLContextEGL::Cast(context)->GetEGLDisplay(),
                             GLContextEGL::Cast(context)->GetEGLSurface(),
                             context);
         return;
     }
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus)
 {
     if (mWidgetListener) {
       aStatus = mWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
     }
     return NS_OK;
 }
 
-NS_IMETHODIMP_(void)
+void
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
     mInputContext = aContext;
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 nsWindow::GetInputContext()
 {
     return mInputContext;
 }
 
 nsresult
 nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*)
 {
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -49,47 +49,47 @@ public:
 
     using nsBaseWidget::Create; // for Create signature not overridden here
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          void* aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData) override;
     virtual void Destroy();
 
-    NS_IMETHOD Show(bool aState);
+    virtual void Show(bool aState);
     virtual bool IsVisible() const;
     virtual void Move(double aX,
                       double aY);
     virtual void Resize(double aWidth,
                         double aHeight,
                         bool  aRepaint);
     virtual void Resize(double aX,
                         double aY,
                         double aWidth,
                         double aHeight,
                         bool aRepaint);
     virtual void Enable(bool aState);
     virtual bool IsEnabled() const;
-    NS_IMETHOD SetFocus(bool aRaise = false);
-    NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
-    NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect);
+    virtual nsresult SetFocus(bool aRaise = false);
+    virtual nsresult ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
+    virtual void Invalidate(const LayoutDeviceIntRect& aRect);
     virtual void* GetNativeData(uint32_t aDataType);
     virtual void SetNativeData(uint32_t aDataType, uintptr_t aVal);
-    NS_IMETHOD SetTitle(const nsAString& aTitle)
+    virtual nsresult SetTitle(const nsAString& aTitle)
     {
         return NS_OK;
     }
     virtual LayoutDeviceIntPoint WidgetToScreenOffset();
     void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput);
     void DispatchTouchEventForAPZ(const mozilla::MultiTouchInput& aInput,
                                   const ScrollableLayerGuid& aGuid,
                                   const uint64_t aInputBlockId,
                                   nsEventStatus aApzResponse);
-    NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
-                             nsEventStatus& aStatus);
+    virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+                                   nsEventStatus& aStatus);
     virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                                 TouchPointerState aPointerState,
                                                 LayoutDeviceIntPoint aPoint,
                                                 double aPointerPressure,
                                                 uint32_t aPointerOrientation,
                                                 nsIObserver* aObserver) override;
 
     virtual nsresult MakeFullScreen(
@@ -102,19 +102,19 @@ public:
     virtual float GetDPI();
     virtual double GetDefaultScaleInternal();
     virtual mozilla::layers::LayerManager*
         GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
                         LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
                         LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT);
     virtual void DestroyCompositor();
 
-    NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                      const InputContextAction& aAction);
-    NS_IMETHOD_(InputContext) GetInputContext();
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction);
+    virtual InputContext GetInputContext();
 
     virtual uint32_t GetGLFrameBufferFormat() override;
 
     virtual LayoutDeviceIntRect GetNaturalBounds() override;
     virtual bool NeedsPaint();
 
     virtual Composer2D* GetComposer2D() override;
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1057,21 +1057,21 @@ void nsWindow::SetSizeConstraints(const 
             LayoutDeviceIntSize(NS_MAXSIZE, NS_MAXSIZE)) {
             hints |= GDK_HINT_MAX_SIZE;
         }
         gtk_window_set_geometry_hints(GTK_WINDOW(mShell), nullptr,
                                       &geometry, GdkWindowHints(hints));
     }
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Show(bool aState)
 {
     if (aState == mIsShown)
-        return NS_OK;
+        return;
 
     // Clear our cached resources when the window is hidden.
     if (mIsShown && !aState) {
         ClearCachedResources();
     }
 
     mIsShown = aState;
 
@@ -1084,31 +1084,29 @@ nsWindow::Show(bool aState)
     }
 
     // Ok, someone called show on a window that isn't sized to a sane
     // value.  Mark this window as needing to have Show() called on it
     // and return.
     if ((aState && !AreBoundsSane()) || !mCreated) {
         LOG(("\tbounds are insane or window hasn't been created yet\n"));
         mNeedsShow = true;
-        return NS_OK;
+        return;
     }
 
     // If someone is hiding this widget, clear any needing show flag.
     if (!aState)
         mNeedsShow = false;
 
 #ifdef ACCESSIBILITY
     if (aState && a11y::ShouldA11yBeEnabled())
         CreateRootAccessible();
 #endif
 
     NativeShow(aState);
-
-    return NS_OK;
 }
 
 void
 nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
 {
     double scale = BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
     int32_t width = NSToIntRound(scale * aWidth);
     int32_t height = NSToIntRound(scale * aHeight);
@@ -1388,17 +1386,17 @@ nsWindow::GetLastUserInputTime()
     if (sLastUserInputTime != GDK_CURRENT_TIME &&
         TimestampIsNewerThan(sLastUserInputTime, timestamp)) {
         return sLastUserInputTime;
     }
 
     return timestamp;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetFocus(bool aRaise)
 {
     // Make sure that our owning widget has focus.  If it doesn't try to
     // grab it.  Note that we don't set our focus flag in this case.
 
     LOGFOCUS(("  SetFocus %d [%p]\n", aRaise, (void *)this));
 
     GtkWidget *owningWidget = GetMozContainerWidget();
@@ -1587,50 +1585,49 @@ nsWindow::OnPropertyNotifyEvent(GtkWidge
 
   if (GetCurrentTimeGetter()->PropertyNotifyHandler(aWidget, aEvent)) {
     return TRUE;
   }
 
   return FALSE;
 }
 
-NS_IMETHODIMP
+void
 nsWindow::SetCursor(nsCursor aCursor)
 {
     // if we're not the toplevel window pass up the cursor request to
     // the toplevel window to handle it.
     if (!mContainer && mGdkWindow) {
         nsWindow *window = GetContainerWindow();
         if (!window)
-            return NS_ERROR_FAILURE;
-
-        return window->SetCursor(aCursor);
+            return;
+
+        window->SetCursor(aCursor);
+        return;
     }
 
     // Only change cursor if it's actually been changed
     if (aCursor != mCursor || mUpdateCursor) {
         GdkCursor *newCursor = nullptr;
         mUpdateCursor = false;
 
         newCursor = get_gtk_cursor(aCursor);
 
         if (nullptr != newCursor) {
             mCursor = aCursor;
 
             if (!mContainer)
-                return NS_OK;
+                return;
 
             gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mContainer)), newCursor);
         }
     }
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
+}
+
+nsresult
 nsWindow::SetCursor(imgIContainer* aCursor,
                     uint32_t aHotspotX, uint32_t aHotspotY)
 {
     // if we're not the toplevel window pass up the cursor request to
     // the toplevel window to handle it.
     if (!mContainer && mGdkWindow) {
         nsWindow *window = GetContainerWindow();
         if (!window)
@@ -1684,29 +1681,27 @@ nsWindow::SetCursor(imgIContainer* aCurs
 #else
         gdk_cursor_unref(cursor);
 #endif
     }
 
     return rv;
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
     if (!mGdkWindow)
-        return NS_OK;
+        return;
 
     GdkRectangle rect = DevicePixelsToGdkRectRoundOut(aRect);
     gdk_window_invalidate_rect(mGdkWindow, &rect, FALSE);
 
     LOGDRAW(("Invalidate (rect) [%p]: %d %d %d %d\n", (void *)this,
              rect.x, rect.y, rect.width, rect.height));
-
-    return NS_OK;
 }
 
 void*
 nsWindow::GetNativeData(uint32_t aDataType)
 {
     switch (aDataType) {
     case NS_NATIVE_WINDOW:
     case NS_NATIVE_WIDGET: {
@@ -1772,17 +1767,17 @@ nsWindow::SetNativeData(uint32_t aDataTy
 {
     if (aDataType != NS_NATIVE_PLUGIN_OBJECT_PTR) {
         NS_WARNING("nsWindow::SetNativeData called with bad value");
         return;
     }
     mPluginNativeWindow = (nsPluginNativeWindowGtk*)aVal;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetTitle(const nsAString& aTitle)
 {
     if (!mShell)
         return NS_OK;
 
     // convert the string into utf8 and set the title.
 #define UTF8_FOLLOWBYTE(ch) (((ch) & 0xC0) == 0x80)
     NS_ConvertUTF16toUTF8 titleUTF8(aTitle);
@@ -6388,27 +6383,27 @@ nsWindow::DispatchRestoreEventAccessible
 #endif /* #ifdef ACCESSIBILITY */
 
 // nsChildWindow class
 
 nsChildWindow::nsChildWindow() = default;
 
 nsChildWindow::~nsChildWindow() = default;
 
-NS_IMETHODIMP_(void)
+void
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
     if (!mIMContext) {
         return;
     }
     mIMContext->SetInputContext(this, &aContext, &aAction);
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 nsWindow::GetInputContext()
 {
   InputContext context;
   if (!mIMContext) {
       context.mIMEState.mEnabled = IMEState::DISABLED;
       context.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
   } else {
       context = mIMContext->GetInputContext();
@@ -6420,17 +6415,17 @@ nsIMEUpdatePreference
 nsWindow::GetIMEUpdatePreference()
 {
     if (!mIMContext) {
         return nsIMEUpdatePreference();
     }
     return mIMContext->GetIMEUpdatePreference();
 }
 
-NS_IMETHODIMP_(TextEventDispatcherListener*)
+TextEventDispatcherListener*
 nsWindow::GetNativeTextEventDispatcherListener()
 {
     if (NS_WARN_IF(!mIMContext)) {
         return nullptr;
     }
     return mIMContext;
 }
 
@@ -6446,17 +6441,17 @@ nsWindow::ExecuteNativeKeyBindingRemappe
     modifiedEvent.mKeyCode = aGeckoKeyCode;
     static_cast<GdkEventKey*>(modifiedEvent.mNativeKeyEvent)->keyval =
         aNativeKeyCode;
 
     NativeKeyBindings* keyBindings = NativeKeyBindings::GetInstance(aType);
     return keyBindings->Execute(modifiedEvent, aCallback, aCallbackData);
 }
 
-NS_IMETHODIMP_(bool)
+bool
 nsWindow::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
                                   const WidgetKeyboardEvent& aEvent,
                                   DoCommandCallback aCallback,
                                   void* aCallbackData)
 {
     if (aEvent.mKeyCode >= NS_VK_LEFT && aEvent.mKeyCode <= NS_VK_DOWN) {
 
         // Check if we're targeting content with vertical writing mode,
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -111,42 +111,42 @@ public:
     virtual void       SetModal(bool aModal) override;
     virtual bool       IsVisible() const override;
     virtual void       ConstrainPosition(bool aAllowSlop,
                                          int32_t *aX,
                                          int32_t *aY) override;
     virtual void       SetSizeConstraints(const SizeConstraints& aConstraints) override;
     virtual void       Move(double aX,
                             double aY) override;
-    NS_IMETHOD         Show             (bool aState) override;
+    virtual void       Show             (bool aState) override;
     virtual void       Resize           (double aWidth,
                                          double aHeight,
                                          bool   aRepaint) override;
     virtual void       Resize           (double aX,
                                          double aY,
                                          double aWidth,
                                          double aHeight,
                                          bool   aRepaint) override;
     virtual bool       IsEnabled() const override;
 
     void               SetZIndex(int32_t aZIndex) override;
     virtual void       SetSizeMode(nsSizeMode aMode) override;
     virtual void       Enable(bool aState) override;
-    NS_IMETHOD         SetFocus(bool aRaise = false) override;
+    virtual nsresult   SetFocus(bool aRaise = false) override;
     virtual LayoutDeviceIntRect GetScreenBounds() override;
     virtual LayoutDeviceIntRect GetClientBounds() override;
     virtual LayoutDeviceIntSize GetClientSize() override;
     virtual LayoutDeviceIntPoint GetClientOffset() override;
-    NS_IMETHOD         SetCursor(nsCursor aCursor) override;
-    NS_IMETHOD         SetCursor(imgIContainer* aCursor,
+    virtual void       SetCursor(nsCursor aCursor) override;
+    virtual nsresult   SetCursor(imgIContainer* aCursor,
                                  uint32_t aHotspotX, uint32_t aHotspotY) override;
-    NS_IMETHOD         Invalidate(const LayoutDeviceIntRect& aRect) override;
+    virtual void       Invalidate(const LayoutDeviceIntRect& aRect) override;
     virtual void*      GetNativeData(uint32_t aDataType) override;
     void               SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
-    NS_IMETHOD         SetTitle(const nsAString& aTitle) override;
+    virtual nsresult   SetTitle(const nsAString& aTitle) override;
     virtual void       SetIcon(const nsAString& aIconSpec) override;
     virtual void       SetWindowClass(const nsAString& xulWinType) override;
     virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
     virtual void       CaptureMouse(bool aCapture) override;
     virtual void       CaptureRollupEvents(nsIRollupListener *aListener,
                                            bool aDoCapture) override;
     virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
     virtual nsresult   SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
@@ -280,30 +280,30 @@ public:
     // If this dispatched the keydown event actually, this returns TRUE,
     // otherwise, FALSE.
     bool               DispatchKeyDownEvent(GdkEventKey *aEvent,
                                             bool *aIsCancelled);
     WidgetEventTime    GetWidgetEventTime(guint32 aEventTime);
     mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime);
     mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter();
 
-    NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                      const InputContextAction& aAction) override;
-    NS_IMETHOD_(InputContext) GetInputContext() override;
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction) override;
+    virtual InputContext GetInputContext() override;
     virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
-    NS_IMETHOD_(TextEventDispatcherListener*)
+    virtual TextEventDispatcherListener*
         GetNativeTextEventDispatcherListener() override;
     bool ExecuteNativeKeyBindingRemapped(
                         NativeKeyBindingsType aType,
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData,
                         uint32_t aGeckoKeyCode,
                         uint32_t aNativeKeyCode);
-    NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
+    virtual bool ExecuteNativeKeyBinding(
                         NativeKeyBindingsType aType,
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData) override;
 
     // These methods are for toplevel windows only.
     void               ResizeTransparencyBitmap();
     void               ApplyTransparencyBitmap();
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -736,24 +736,25 @@ nsBaseWidget::SetSizeMode(nsSizeMode aMo
 // Get this component cursor
 //
 //-------------------------------------------------------------------------
 nsCursor nsBaseWidget::GetCursor()
 {
   return mCursor;
 }
 
-NS_IMETHODIMP nsBaseWidget::SetCursor(nsCursor aCursor)
+void
+nsBaseWidget::SetCursor(nsCursor aCursor)
 {
   mCursor = aCursor;
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsBaseWidget::SetCursor(imgIContainer* aCursor,
-                                      uint32_t aHotspotX, uint32_t aHotspotY)
+nsresult
+nsBaseWidget::SetCursor(imgIContainer* aCursor,
+                        uint32_t aHotspotX, uint32_t aHotspotY)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 //-------------------------------------------------------------------------
 //
 // Window transparency methods
 //
@@ -1567,17 +1568,17 @@ nsBaseWidget::GetRestoredBounds(LayoutDe
 }
 
 LayoutDeviceIntPoint
 nsBaseWidget::GetClientOffset()
 {
   return LayoutDeviceIntPoint(0, 0);
 }
 
-NS_IMETHODIMP
+nsresult
 nsBaseWidget::SetNonClientMargins(LayoutDeviceIntMargin &margins)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 uint32_t nsBaseWidget::GetMaxTouchPoints() const
 {
   return 0;
@@ -1753,17 +1754,17 @@ nsBaseWidget::NotifyUIStateChanged(UISta
   if (nsIDocument* doc = GetDocument()) {
     nsPIDOMWindowOuter* win = doc->GetWindow();
     if (win) {
       win->SetKeyboardIndicators(aShowAccelerators, aShowFocusRings);
     }
   }
 }
 
-NS_IMETHODIMP
+nsresult
 nsBaseWidget::NotifyIME(const IMENotification& aIMENotification)
 {
   switch (aIMENotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
     case REQUEST_TO_CANCEL_COMPOSITION:
       // Currently, if native IME handler doesn't use TextEventDispatcher,
       // the request may be notified to mTextEventDispatcher or native IME
       // directly.  Therefore, if mTextEventDispatcher has a composition,
@@ -1797,34 +1798,34 @@ void
 nsBaseWidget::EnsureTextEventDispatcher()
 {
   if (mTextEventDispatcher) {
     return;
   }
   mTextEventDispatcher = new TextEventDispatcher(this);
 }
 
-NS_IMETHODIMP_(nsIWidget::TextEventDispatcher*)
+nsIWidget::TextEventDispatcher*
 nsBaseWidget::GetTextEventDispatcher()
 {
   EnsureTextEventDispatcher();
   return mTextEventDispatcher;
 }
 
 void*
 nsBaseWidget::GetPseudoIMEContext()
 {
   TextEventDispatcher* dispatcher = GetTextEventDispatcher();
   if (!dispatcher) {
     return nullptr;
   }
   return dispatcher->GetPseudoIMEContext();
 }
 
-NS_IMETHODIMP_(TextEventDispatcherListener*)
+TextEventDispatcherListener*
 nsBaseWidget::GetNativeTextEventDispatcherListener()
 {
   // TODO: If all platforms supported use of TextEventDispatcher for handling
   //       native IME and keyboard events, this method should be removed since
   //       in such case, this is overridden by all the subclasses.
   return nullptr;
 }
 
@@ -2242,17 +2243,17 @@ nsBaseWidget::DefaultFillScrollCapture(D
   aSnapshotDrawTarget->FillRect(
     gfx::Rect(0, 0, dtSize.width, dtSize.height),
     gfx::ColorPattern(gfx::Color::FromABGR(kScrollCaptureFillColor)),
     gfx::DrawOptions(1.f, gfx::CompositionOp::OP_SOURCE));
   aSnapshotDrawTarget->Flush();
 }
 #endif
 
-NS_IMETHODIMP_(nsIWidget::NativeIMEContext)
+nsIWidget::NativeIMEContext
 nsIWidget::GetNativeIMEContext()
 {
   return NativeIMEContext(this);
 }
 
 nsresult
 nsIWidget::OnWindowedPluginKeyEvent(const NativeEventData& aKeyEventData,
                                     nsIKeyEventInPluginCallback* aCallback)
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -164,18 +164,18 @@ public:
 
   virtual void            SetSizeMode(nsSizeMode aMode) override;
   virtual nsSizeMode      SizeMode() override
   {
     return mSizeMode;
   }
 
   virtual nsCursor        GetCursor() override;
-  NS_IMETHOD              SetCursor(nsCursor aCursor) override;
-  NS_IMETHOD              SetCursor(imgIContainer* aCursor,
+  virtual void            SetCursor(nsCursor aCursor) override;
+  virtual nsresult        SetCursor(imgIContainer* aCursor,
                                     uint32_t aHotspotX, uint32_t aHotspotY) override;
   virtual void            ClearCachedCursor() override { mUpdateCursor = true; }
   virtual void            SetTransparencyMode(nsTransparencyMode aMode) override;
   virtual nsTransparencyMode GetTransparencyMode() override;
   virtual void            GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
   virtual void            SetWindowShadowStyle(int32_t aStyle) override {}
   virtual void            SetShowsToolbarButton(bool aShow) override {}
   virtual void            SetShowsFullScreenButton(bool aShow) override {}
@@ -235,17 +235,17 @@ public:
                                             int32_t *aY) override {}
   virtual void            MoveClient(double aX, double aY) override;
   virtual void            ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
   virtual void            ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
   virtual LayoutDeviceIntRect GetBounds() override;
   virtual LayoutDeviceIntRect GetClientBounds() override;
   virtual LayoutDeviceIntRect GetScreenBounds() override;
   virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
-  NS_IMETHOD              SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
+  virtual nsresult        SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
   virtual LayoutDeviceIntPoint GetClientOffset() override;
   virtual void            EnableDragDrop(bool aEnable) override {};
   virtual MOZ_MUST_USE nsresult
                           GetAttention(int32_t aCycleCount) override
                           { return NS_OK; }
   virtual bool            HasPendingInputEvent() override;
   virtual void            SetIcon(const nsAString &aIconSpec) override {}
   virtual void            SetWindowTitlebarColor(nscolor aColor, bool aActive)
@@ -258,32 +258,33 @@ public:
                                           int32_t aHorizontal,
                                           int32_t aVertical) override
                           { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual MOZ_MUST_USE nsresult
                           BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override
                           { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual nsresult        ActivateNativeMenuItemAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual nsresult        ForceUpdateNativeMenuAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
-  NS_IMETHOD              NotifyIME(const IMENotification& aIMENotification) override final;
+  virtual nsresult        NotifyIME(const IMENotification& aIMENotification)
+                            override final;
   virtual MOZ_MUST_USE nsresult
                           StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
                                          int32_t aPanelX, int32_t aPanelY,
                                          nsString& aCommitted) override
                           { return NS_ERROR_NOT_IMPLEMENTED; }
   virtual void            SetPluginFocused(bool& aFocused) override {}
   virtual void            SetCandidateWindowForPlugin(
                             const mozilla::widget::CandidateWindowPosition&
                               aPosition) override
                           { }
   virtual void            DefaultProcOfPluginEvent(
                             const mozilla::WidgetPluginEvent& aEvent) override
                           { }
   virtual MOZ_MUST_USE nsresult AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override { return NS_ERROR_NOT_IMPLEMENTED; }
-  NS_IMETHOD_(bool)       ExecuteNativeKeyBinding(
+  virtual bool            ExecuteNativeKeyBinding(
                             NativeKeyBindingsType aType,
                             const mozilla::WidgetKeyboardEvent& aEvent,
                             DoCommandCallback aCallback,
                             void* aCallbackData) override { return false; }
   bool                    ComputeShouldAccelerate();
   virtual bool            WidgetTypeSupportsAcceleration() { return true; }
   virtual nsIMEUpdatePreference GetIMEUpdatePreference() override { return nsIMEUpdatePreference(); }
   virtual MOZ_MUST_USE nsresult OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
@@ -291,18 +292,18 @@ public:
   CreateChild(const LayoutDeviceIntRect& aRect,
               nsWidgetInitData* aInitData = nullptr,
               bool aForceUseIWidgetParent = false) override;
   virtual void            AttachViewToTopLevel(bool aUseAttachedEvents) override;
   virtual nsIWidgetListener* GetAttachedWidgetListener() override;
   virtual void               SetAttachedWidgetListener(nsIWidgetListener* aListener) override;
   virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override;
   virtual void               SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) override;
-  NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() override final;
-  NS_IMETHOD_(TextEventDispatcherListener*)
+  virtual TextEventDispatcher* GetTextEventDispatcher() override final;
+  virtual TextEventDispatcherListener*
     GetNativeTextEventDispatcherListener() override;
   virtual void ZoomToRect(const uint32_t& aPresShellId,
                           const FrameMetrics::ViewID& aViewId,
                           const CSSRect& aRect,
                           const uint32_t& aFlags) override;
   // Dispatch an event that must be first be routed through APZ.
   nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
   void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) override;
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -631,17 +631,17 @@ class nsIWidget : public nsISupports
     }
 
     /**
      * Show or hide this widget
      *
      * @param aState true to show the Widget, false to hide it
      *
      */
-    NS_IMETHOD Show(bool aState) = 0;
+    virtual void Show(bool aState) = 0;
 
     /**
      * Make the window modal.
      */
     virtual void SetModal(bool aModal) = 0;
 
     /**
      * Make the non-modal window opened by modal window fake-modal, that will
@@ -854,17 +854,17 @@ class nsIWidget : public nsISupports
      * Request activation of this window or give focus to this widget.
      *
      * @param aRaise If true, this function requests activation of this
      *               widget's toplevel window.
      *               If false, the appropriate toplevel window (which in
      *               the case of popups may not be this widget's toplevel
      *               window) is already active.
      */
-    NS_IMETHOD SetFocus(bool aRaise = false) = 0;
+    virtual nsresult SetFocus(bool aRaise = false) = 0;
 
     /**
      * Get this widget's outside dimensions relative to its parent widget. For
      * popup widgets the returned rect is in screen coordinates and not
      * relative to its parent widget.
      *
      * @return the x, y, width and height of this widget.
      */
@@ -908,19 +908,18 @@ class nsIWidget : public nsISupports
      * the system default frame size for that border. Pass zero to remove
      * a border, or pass a specific value adjust a border. Units are in
      * pixels. (DPI dependent)
      *
      * Platform notes:
      *  Windows: shrinking top non-client height will remove application
      *  icon and window title text. Glass desktops will refuse to set
      *  dimensions between zero and size < system default.
-     *
      */
-    NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) = 0;
+    virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) = 0;
 
     /**
      * Get the client offset from the window origin.
      *
      * @return the x and y of the offset.
      */
     virtual LayoutDeviceIntPoint GetClientOffset() = 0;
 
@@ -950,18 +949,17 @@ class nsIWidget : public nsISupports
 
     virtual nsCursor GetCursor(void) = 0;
 
     /**
      * Set the cursor for this widget
      *
      * @param aCursor the new cursor for this widget
      */
-
-    NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
+    virtual void SetCursor(nsCursor aCursor) = 0;
 
     /**
      * If a cursor type is currently cached locally for this widget, clear the
      * cached cursor to force an update on the next SetCursor call.
      */
 
     virtual void ClearCachedCursor() = 0;
 
@@ -969,18 +967,18 @@ class nsIWidget : public nsISupports
      * Sets an image as the cursor for this widget.
      *
      * @param aCursor the cursor to set
      * @param aX the X coordinate of the hotspot (from left).
      * @param aY the Y coordinate of the hotspot (from top).
      * @retval NS_ERROR_NOT_IMPLEMENTED if setting images as cursors is not
      *         supported
      */
-    NS_IMETHOD SetCursor(imgIContainer* aCursor,
-                         uint32_t aHotspotX, uint32_t aHotspotY) = 0;
+    virtual nsresult SetCursor(imgIContainer* aCursor,
+                               uint32_t aHotspotX, uint32_t aHotspotY) = 0;
 
     /**
      * Get the window type of this widget.
      */
     nsWindowType WindowType() { return mWindowType; }
 
     /**
      * Determines if this widget is one of the three types of plugin widgets.
@@ -1216,17 +1214,17 @@ class nsIWidget : public nsISupports
     {
       return MakeFullScreen(aFullScreen, aTargetScreen);
     }
 
     /**
      * Invalidate a specified rect for a widget so that it will be repainted
      * later.
      */
-    NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) = 0;
+    virtual void Invalidate(const LayoutDeviceIntRect& aRect) = 0;
 
     enum LayerManagerPersistence
     {
       LAYER_MANAGER_CURRENT = 0,
       LAYER_MANAGER_PERSISTENT
     };
 
     /**
@@ -1308,17 +1306,17 @@ class nsIWidget : public nsISupports
     //@}
 
     /**
      * Set the widget's title.
      * Must be called after Create.
      *
      * @param aTitle string displayed as the title of the widget
      */
-    NS_IMETHOD SetTitle(const nsAString& aTitle) = 0;
+    virtual nsresult SetTitle(const nsAString& aTitle) = 0;
 
     /**
      * Set the widget's icon.
      * Must be called after Create.
      *
      * @param aIconSpec string specifying the icon to use; convention is to
      *                  pass a resource: URL from which a platform-dependent
      *                  resource file name will be constructed
@@ -1337,20 +1335,19 @@ class nsIWidget : public nsISupports
      * which includes the area for the borders and titlebar. This method
      * should work even when the window is not yet visible.
      */
     virtual LayoutDeviceIntSize ClientToWindowSize(
                 const LayoutDeviceIntSize& aClientSize) = 0;
 
     /**
      * Dispatches an event to the widget
-     *
      */
-    NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* event,
-                             nsEventStatus & aStatus) = 0;
+    virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* event,
+                                   nsEventStatus & aStatus) = 0;
 
     /**
      * Dispatches an event to APZ only.
      * No-op in the child process.
      */
     virtual void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) = 0;
 
     /**
@@ -1721,29 +1718,29 @@ public:
     virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) = 0;
 
     /**
      * This is used for testing macOS service menu code.
      *
      * @param aResult - the current text selection. Is empty if no selection.
      * @return nsresult - whether or not aResult was assigned the selected text.
      */
-    NS_IMETHOD
+    virtual MOZ_MUST_USE nsresult
     GetSelectionAsPlaintext(nsAString& aResult)
     {
       return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     /**
      * Notify IME of the specified notification.
      *
      * @return If the notification is mouse button event and it's consumed by
      *         IME, this returns NS_SUCCESS_EVENT_CONSUMED.
      */
-    NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) = 0;
+    virtual nsresult NotifyIME(const IMENotification& aIMENotification) = 0;
 
     /**
      * Start plugin IME.  If this results in a string getting committed, the
      * result is in aCommitted (otherwise aCommitted is empty).
      *
      * aKeyboardEvent     The event with which plugin IME is to be started
      * panelX and panelY  Location in screen coordinates of the IME input panel
      *                    (should be just under the plugin)
@@ -1781,30 +1778,30 @@ public:
      * Handle default action when PluginEvent isn't handled
      */
     virtual void DefaultProcOfPluginEvent(
                    const mozilla::WidgetPluginEvent& aEvent) = 0;
 
     /*
      * Notifies the input context changes.
      */
-    NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
-                                      const InputContextAction& aAction) = 0;
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction) = 0;
 
     /*
      * Get current input context.
      */
-    NS_IMETHOD_(InputContext) GetInputContext() = 0;
+    virtual InputContext GetInputContext() = 0;
 
     /**
      * Get native IME context.  This is different from GetNativeData() with
      * NS_RAW_NATIVE_IME_CONTEXT, the result is unique even if in a remote
      * process.
      */
-    NS_IMETHOD_(NativeIMEContext) GetNativeIMEContext();
+    virtual NativeIMEContext GetNativeIMEContext();
 
     /*
      * Given a WidgetKeyboardEvent, this method synthesizes a corresponding
      * native (OS-level) event for it. This method allows tests to simulate
      * keystrokes that trigger native key bindings (which require a native
      * event).
      */
     virtual MOZ_MUST_USE nsresult
@@ -1815,17 +1812,17 @@ public:
      */
     typedef void (*DoCommandCallback)(mozilla::Command, void*);
     enum NativeKeyBindingsType
     {
       NativeKeyBindingsForSingleLineEditor,
       NativeKeyBindingsForMultiLineEditor,
       NativeKeyBindingsForRichTextEditor
     };
-    NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
+    virtual bool ExecuteNativeKeyBinding(
                         NativeKeyBindingsType aType,
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData) = 0;
 
     /*
      * Retrieves preference for IME updates
      */
@@ -1955,24 +1952,24 @@ public:
     virtual void UpdateZoomConstraints(const uint32_t& aPresShellId,
                                        const FrameMetrics::ViewID& aViewId,
                                        const mozilla::Maybe<ZoomConstraints>& aConstraints) {};
 
     /**
      * GetTextEventDispatcher() returns TextEventDispatcher belonging to the
      * widget.  Note that this never returns nullptr.
      */
-    NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() = 0;
+    virtual TextEventDispatcher* GetTextEventDispatcher() = 0;
 
     /**
      * GetNativeTextEventDispatcherListener() returns a
      * TextEventDispatcherListener instance which is used when the widget
      * instance handles native IME and/or keyboard events.
      */
-    NS_IMETHOD_(TextEventDispatcherListener*)
+    virtual TextEventDispatcherListener*
       GetNativeTextEventDispatcherListener() = 0;
 
     virtual void ZoomToRect(const uint32_t& aPresShellId,
                             const FrameMetrics::ViewID& aViewId,
                             const CSSRect& aRect,
                             const uint32_t& aFlags) = 0;
 
     /**
--- a/widget/uikit/nsWindow.h
+++ b/widget/uikit/nsWindow.h
@@ -30,25 +30,25 @@ public:
     //
 
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
                                          nsWidgetInitData* aInitData = nullptr)
                                          override;
     virtual void Destroy() override;
-    NS_IMETHOD Show(bool aState) override;
+    virtual void Show(bool aState) override;
     virtual void            Enable(bool aState) override {}
     virtual bool            IsEnabled() const override {
         return true;
     }
     virtual bool            IsVisible() const override {
         return mVisible;
     }
-    NS_IMETHOD              SetFocus(bool aState=false) override;
+    virtual nsresult        SetFocus(bool aState=false) override;
     virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
 
     virtual void SetBackgroundColor(const nscolor &aColor) override;
     virtual void* GetNativeData(uint32_t aDataType) override;
 
     virtual void            Move(double aX, double aY) override;
     virtual void            SetSizeMode(nsSizeMode aMode) override;
     void                    EnteredFullScreen(bool aFullScreen);
@@ -65,37 +65,37 @@ public:
         //XXX: terrible
         return 326.0f;
     }
     virtual double          GetDefaultScaleInternal() override {
         return BackingScaleFactor();
     }
     virtual int32_t         RoundsWidgetCoordinatesTo() override;
 
-    NS_IMETHOD              SetTitle(const nsAString& aTitle) override {
+    virtual nsresult        SetTitle(const nsAString& aTitle) override {
         return NS_OK;
     }
 
-    NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
+    virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
     virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
-    NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
-                             nsEventStatus& aStatus) override;
+    virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+                                   nsEventStatus& aStatus) override;
 
     void WillPaintWindow();
     bool PaintWindow(LayoutDeviceIntRegion aRegion);
 
     bool HasModalDescendents() { return false; }
 
-    //NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) override;
-    NS_IMETHOD_(void) SetInputContext(
-                        const InputContext& aContext,
-                        const InputContextAction& aAction);
-    NS_IMETHOD_(InputContext) GetInputContext();
+    //virtual nsresult
+    //NotifyIME(const IMENotification& aIMENotification) override;
+    virtual void SetInputContext(const InputContext& aContext,
+                                 const InputContextAction& aAction);
+    virtual InputContext GetInputContext();
     /*
-    NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
+    virtual bool ExecuteNativeKeyBinding(
                         NativeKeyBindingsType aType,
                         const mozilla::WidgetKeyboardEvent& aEvent,
                         DoCommandCallback aCallback,
                         void* aCallbackData) override;
     */
 
 protected:
     virtual ~nsWindow();
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -538,44 +538,43 @@ nsWindow::Destroy()
 
     TearDownView();
 
     nsBaseWidget::OnDestroy();
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& config)
 {
     for (uint32_t i = 0; i < config.Length(); ++i) {
         nsWindow *childWin = (nsWindow*) config[i].mChild.get();
         childWin->Resize(config[i].mBounds.x,
                          config[i].mBounds.y,
                          config[i].mBounds.width,
                          config[i].mBounds.height,
                          false);
     }
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Show(bool aState)
 {
   if (aState != mVisible) {
       mNativeView.hidden = aState ? NO : YES;
       if (aState) {
           UIView* parentView = mParent ? mParent->mNativeView : nsAppShell::gWindow.rootViewController.view;
           [parentView bringSubviewToFront:mNativeView];
           [mNativeView setNeedsDisplay];
       }
       mVisible = aState;
   }
-  return NS_OK;
 }
 
 void
 nsWindow::Move(double aX, double aY)
 {
   if (!mNativeView || (mBounds.x == aX && mBounds.y == aY))
     return;
 
@@ -651,33 +650,31 @@ nsWindow::SetSizeMode(nsSizeMode aMode)
     mSizeMode = static_cast<nsSizeMode>(aMode);
     if (aMode == nsSizeMode_Maximized || aMode == nsSizeMode_Fullscreen) {
         // Resize to fill screen
         nsBaseWidget::InfallibleMakeFullScreen(true);
     }
     ReportSizeModeEvent(aMode);
 }
 
-NS_IMETHODIMP
+void
 nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
   if (!mNativeView || !mVisible)
-    return NS_OK;
+    return;
 
   MOZ_RELEASE_ASSERT(GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_CLIENT,
                      "Shouldn't need to invalidate with accelerated OMTC layers!");
 
 
   [mNativeView setNeedsLayout];
   [mNativeView setNeedsDisplayInRect:DevPixelsToUIKitPoints(mBounds, BackingScaleFactor())];
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetFocus(bool aRaise)
 {
   [[mNativeView window] makeKeyWindow];
   [mNativeView becomeFirstResponder];
   return NS_OK;
 }
 
 void nsWindow::WillPaintWindow()
@@ -755,38 +752,38 @@ LayoutDeviceIntPoint nsWindow::WidgetToS
     }
 
     offset.x += temp.x;
     offset.y += temp.y;
 
     return offset;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                         nsEventStatus& aStatus)
 {
   aStatus = nsEventStatus_eIgnore;
   nsCOMPtr<nsIWidget> kungFuDeathGrip(aEvent->mWidget);
 
   if (mWidgetListener)
     aStatus = mWidgetListener->HandleEvent(aEvent, mUseAttachedEvents);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP_(void)
+void
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
     //TODO: actually show VKB
     mInputContext = aContext;
 }
 
-NS_IMETHODIMP_(mozilla::widget::InputContext)
+mozilla::widget::InputContext
 nsWindow::GetInputContext()
 {
     return mInputContext;
 }
 
 void
 nsWindow::SetBackgroundColor(const nscolor &aColor)
 {
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1415,17 +1415,18 @@ nsWindow::GetFallbackScrollSnapshot(cons
 /**************************************************************
  *
  * SECTION: nsIWidget::Show
  *
  * Hide or show this component.
  *
  **************************************************************/
 
-NS_IMETHODIMP nsWindow::Show(bool bState)
+void
+nsWindow::Show(bool bState)
 {
   if (mWindowType == eWindowType_popup) {
     // See bug 603793. When we try to draw D3D9/10 windows with a drop shadow
     // without the DWM on a secondary monitor, windows fails to composite
     // our windows correctly. We therefor switch off the drop shadow for
     // pop-up windows when the DWM is disabled and two monitors are
     // connected.
     if (HasBogusPopupsDropShadowOnMultiMonitor() &&
@@ -1530,27 +1531,25 @@ NS_IMETHODIMP nsWindow::Show(bool bState
       if (mWindowType != eWindowType_dialog) {
         ::ShowWindow(mWnd, SW_HIDE);
       } else {
         ::SetWindowPos(mWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
                        SWP_NOZORDER | SWP_NOACTIVATE);
       }
     }
   }
-  
+
 #ifdef MOZ_XUL
   if (!wasVisible && bState) {
     Invalidate();
     if (syncInvalidate && !mInDtor && !mOnDestroyCalled) {
       ::UpdateWindow(mWnd);
     }
   }
 #endif
-
-  return NS_OK;
 }
 
 /**************************************************************
  *
  * SECTION: nsIWidget::IsVisible
  *
  * Returns the visibility state.
  *
@@ -2133,17 +2132,18 @@ bool nsWindow::IsEnabled() const
 /**************************************************************
  *
  * SECTION: nsIWidget::SetFocus
  *
  * Give the focus to this widget.
  *
  **************************************************************/
 
-NS_IMETHODIMP nsWindow::SetFocus(bool aRaise)
+nsresult
+nsWindow::SetFocus(bool aRaise)
 {
   if (mWnd) {
 #ifdef WINSTATE_DEBUG_OUTPUT
     if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
       MOZ_LOG(gWindowsLog, LogLevel::Info,
              ("*** SetFocus: [  top] raise=%d\n", aRaise));
     } else {
       MOZ_LOG(gWindowsLog, LogLevel::Info,
@@ -2595,17 +2595,17 @@ nsWindow::UpdateNonClientMargins(int32_t
     // Force a reflow of content based on the new client
     // dimensions.
     ResetLayout();
   }
 
   return true;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindow::SetNonClientMargins(LayoutDeviceIntMargin &margins)
 {
   if (!mIsTopWidgetWindow ||
       mBorderStyle == eBorderStyle_none)
     return NS_ERROR_INVALID_ARG;
 
   if (mHideChrome) {
     mFutureMarginsOnceChromeShows = margins;
@@ -2726,17 +2726,18 @@ void nsWindow::SetBackgroundColor(const 
  *
  * SECTION: nsIWidget::SetCursor
  *
  * SetCursor and related utilities for manging cursor state.
  *
  **************************************************************/
 
 // Set this component cursor
-NS_IMETHODIMP nsWindow::SetCursor(nsCursor aCursor)
+void
+nsWindow::SetCursor(nsCursor aCursor)
 {
   // Only change cursor if it's changing
 
   //XXX mCursor isn't always right.  Scrollbars and others change it, too.
   //XXX If we want this optimization we need a better way to do it.
   //if (aCursor != mCursor) {
   HCURSOR newCursor = nullptr;
 
@@ -2877,23 +2878,22 @@ NS_IMETHODIMP nsWindow::SetCursor(nsCurs
     
     if (sHCursor == oldCursor) {
       NS_IF_RELEASE(sCursorImgContainer);
       if (sHCursor != nullptr)
         ::DestroyIcon(sHCursor);
       sHCursor = nullptr;
     }
   }
-
-  return NS_OK;
 }
 
 // Setting the actual cursor
-NS_IMETHODIMP nsWindow::SetCursor(imgIContainer* aCursor,
-                                  uint32_t aHotspotX, uint32_t aHotspotY)
+nsresult
+nsWindow::SetCursor(imgIContainer* aCursor,
+                    uint32_t aHotspotX, uint32_t aHotspotY)
 {
   if (sCursorImgContainer == aCursor && sHCursor) {
     ::SetCursor(sHCursor);
     return NS_OK;
   }
 
   int32_t width;
   int32_t height;
@@ -3107,22 +3107,23 @@ nsWindow::HideWindowChrome(bool aShouldH
  *
  * SECTION: nsWindow::Invalidate
  *
  * Invalidate an area of the client for painting.
  *
  **************************************************************/
 
 // Invalidate this component visible area
-NS_IMETHODIMP nsWindow::Invalidate(bool aEraseBackground,
-                                   bool aUpdateNCArea,
-                                   bool aIncludeChildren)
+void
+nsWindow::Invalidate(bool aEraseBackground,
+                     bool aUpdateNCArea,
+                     bool aIncludeChildren)
 {
   if (!mWnd) {
-    return NS_OK;
+    return;
   }
 
 #ifdef WIDGET_DEBUG_OUTPUT
   debug_DumpInvalidate(stdout,
                        this,
                        nullptr,
                        "noname",
                        (int32_t) mWnd);
@@ -3135,21 +3136,21 @@ NS_IMETHODIMP nsWindow::Invalidate(bool 
   if (aUpdateNCArea) {
     flags |= RDW_FRAME;
   }
   if (aIncludeChildren) {
     flags |= RDW_ALLCHILDREN;
   }
 
   VERIFY(::RedrawWindow(mWnd, nullptr, nullptr, flags));
-  return NS_OK;
 }
 
 // Invalidate this component visible area
-NS_IMETHODIMP nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
+void
+nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
 {
   if (mWnd) {
 #ifdef WIDGET_DEBUG_OUTPUT
     debug_DumpInvalidate(stdout,
                          this,
                          &aRect,
                          "noname",
                          (int32_t) mWnd);
@@ -3159,17 +3160,16 @@ NS_IMETHODIMP nsWindow::Invalidate(const
 
     rect.left   = aRect.x;
     rect.top    = aRect.y;
     rect.right  = aRect.x + aRect.width;
     rect.bottom = aRect.y + aRect.height;
 
     VERIFY(::InvalidateRect(mWnd, &rect, FALSE));
   }
-  return NS_OK;
 }
 
 static LRESULT CALLBACK
 FullscreenTransitionWindowProc(HWND hWnd, UINT uMsg,
                                WPARAM wParam, LPARAM lParam)
 {
   switch (uMsg) {
     case WM_FULLSCREEN_TRANSITION_BEFORE:
@@ -3524,17 +3524,18 @@ void nsWindow::FreeNativeData(void * dat
 /**************************************************************
  *
  * SECTION: nsIWidget::SetTitle
  *
  * Set the main windows title text.
  *
  **************************************************************/
 
-NS_IMETHODIMP nsWindow::SetTitle(const nsAString& aTitle)
+nsresult
+nsWindow::SetTitle(const nsAString& aTitle)
 {
   const nsString& strTitle = PromiseFlatString(aTitle);
   AutoRestore<bool> sendingText(mSendingSetText);
   mSendingSetText = true;
   ::SendMessageW(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCWSTR)strTitle.get());
   return NS_OK;
 }
 
@@ -3996,18 +3997,18 @@ nsWindow::CurrentMessageWidgetEventTime(
  * SECTION: Moz event dispatch helpers
  *
  * Helpers for dispatching different types of moz events.
  *
  **************************************************************/
 
 // Main event dispatch. Invokes callback and ProcessEvent method on
 // Event Listener object. Part of nsIWidget.
-NS_IMETHODIMP nsWindow::DispatchEvent(WidgetGUIEvent* event,
-                                      nsEventStatus& aStatus)
+nsresult
+nsWindow::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
 {
 #ifdef WIDGET_DEBUG_OUTPUT
   debug_DumpEvent(stdout,
                   event->mWidget,
                   event,
                   "something",
                   (int32_t) mWnd);
 #endif // WIDGET_DEBUG_OUTPUT
@@ -7136,26 +7137,26 @@ nsWindow::OnDPIChanged(int32_t x, int32_
  **
  ** BLOCK: IME management and accessibility
  **
  ** Handles managing IME input and accessibility.
  **
  **************************************************************
  **************************************************************/
 
-NS_IMETHODIMP_(void)
+void
 nsWindow::SetInputContext(const InputContext& aContext,
                           const InputContextAction& aAction)
 {
   InputContext newInputContext = aContext;
   IMEHandler::SetInputContext(this, newInputContext, aAction);
   mInputContext = newInputContext;
 }
 
-NS_IMETHODIMP_(InputContext)
+InputContext
 nsWindow::GetInputContext()
 {
   mInputContext.mIMEState.mOpen = IMEState::CLOSED;
   if (WinUtils::IsIMEEnabled(mInputContext) && IMEHandler::GetOpenState(this)) {
     mInputContext.mIMEState.mOpen = IMEState::OPEN;
   } else {
     mInputContext.mIMEState.mOpen = IMEState::CLOSED;
   }
@@ -7163,17 +7164,17 @@ nsWindow::GetInputContext()
 }
 
 nsIMEUpdatePreference
 nsWindow::GetIMEUpdatePreference()
 {
   return IMEHandler::GetUpdatePreference();
 }
 
-NS_IMETHODIMP_(TextEventDispatcherListener*)
+TextEventDispatcherListener*
 nsWindow::GetNativeTextEventDispatcherListener()
 {
   return IMEHandler::GetNativeTextEventDispatcherListener();
 }
 
 #ifdef ACCESSIBILITY
 #ifdef DEBUG
 #define NS_LOG_WMGETOBJECT(aWnd, aHwnd, aAcc)                                  \
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -114,63 +114,63 @@ public:
   {
     if (mozilla::widget::WinUtils::IsPerMonitorDPIAware()) {
       return mozilla::DesktopToLayoutDeviceScale(1.0);
     } else {
       return mozilla::DesktopToLayoutDeviceScale(GetDefaultScaleInternal());
     }
   }
 
-  NS_IMETHOD              Show(bool bState) override;
+  virtual void            Show(bool aState) override;
   virtual bool            IsVisible() const override;
   virtual void            ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) override;
   virtual void            SetSizeConstraints(const SizeConstraints& aConstraints) override;
   virtual const SizeConstraints GetSizeConstraints() override;
   virtual void            Move(double aX, double aY) override;
   virtual void            Resize(double aWidth, double aHeight, bool aRepaint) override;
   virtual void            Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
   virtual MOZ_MUST_USE nsresult
                           BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
                                           int32_t aHorizontal,
                                           int32_t aVertical) override;
   virtual void            PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate) override;
   virtual void            SetSizeMode(nsSizeMode aMode) override;
   virtual void            Enable(bool aState) override;
   virtual bool            IsEnabled() const override;
-  NS_IMETHOD              SetFocus(bool aRaise) override;
+  virtual nsresult        SetFocus(bool aRaise) override;
   virtual LayoutDeviceIntRect GetBounds() override;
   virtual LayoutDeviceIntRect GetScreenBounds() override;
   virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
   virtual LayoutDeviceIntRect GetClientBounds() override;
   virtual LayoutDeviceIntPoint GetClientOffset() override;
   void                    SetBackgroundColor(const nscolor& aColor) override;
-  NS_IMETHOD              SetCursor(imgIContainer* aCursor,
+  virtual nsresult        SetCursor(imgIContainer* aCursor,
                                     uint32_t aHotspotX, uint32_t aHotspotY) override;
-  NS_IMETHOD              SetCursor(nsCursor aCursor) override;
+  virtual void            SetCursor(nsCursor aCursor) override;
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
   virtual bool PrepareForFullscreenTransition(nsISupports** aData) override;
   virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
                                            uint16_t aDuration,
                                            nsISupports* aData,
                                            nsIRunnable* aCallback) override;
   virtual nsresult        MakeFullScreen(bool aFullScreen,
                                          nsIScreen* aScreen = nullptr) override;
   virtual void            HideWindowChrome(bool aShouldHide) override;
-  NS_IMETHOD              Invalidate(bool aEraseBackground = false,
+  virtual void            Invalidate(bool aEraseBackground = false,
                                      bool aUpdateNCArea = false,
                                      bool aIncludeChildren = false);
-  NS_IMETHOD              Invalidate(const LayoutDeviceIntRect& aRect);
+  virtual void            Invalidate(const LayoutDeviceIntRect& aRect);
   virtual void*           GetNativeData(uint32_t aDataType) override;
   void                    SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
   virtual void            FreeNativeData(void * data, uint32_t aDataType) override;
-  NS_IMETHOD              SetTitle(const nsAString& aTitle) override;
+  virtual nsresult        SetTitle(const nsAString& aTitle) override;
   virtual void            SetIcon(const nsAString& aIconSpec) override;
   virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
   virtual LayoutDeviceIntSize ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override;
-  NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
+  virtual nsresult        DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) override;
   virtual void            EnableDragDrop(bool aEnable) override;
   virtual void            CaptureMouse(bool aCapture) override;
   virtual void            CaptureRollupEvents(nsIRollupListener* aListener,
                                               bool aDoCapture) override;
   virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override;
   virtual bool            HasPendingInputEvent() override;
   virtual LayerManager*   GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
@@ -195,28 +195,28 @@ public:
   virtual nsresult        SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
                                                            uint32_t aNativeMessage,
                                                            double aDeltaX,
                                                            double aDeltaY,
                                                            double aDeltaZ,
                                                            uint32_t aModifierFlags,
                                                            uint32_t aAdditionalFlags,
                                                            nsIObserver* aObserver) override;
-  NS_IMETHOD_(void)       SetInputContext(const InputContext& aContext,
+  virtual void            SetInputContext(const InputContext& aContext,
                                           const InputContextAction& aAction) override;
-  NS_IMETHOD_(InputContext) GetInputContext() override;
-  NS_IMETHOD_(TextEventDispatcherListener*)
+  virtual InputContext    GetInputContext() override;
+  virtual TextEventDispatcherListener*
     GetNativeTextEventDispatcherListener() override;
 #ifdef MOZ_XUL
   virtual void            SetTransparencyMode(nsTransparencyMode aMode) override;
   virtual nsTransparencyMode GetTransparencyMode() override;
   virtual void            UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
 #endif // MOZ_XUL
   virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
-  NS_IMETHOD              SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
+  virtual nsresult        SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
   void                    SetDrawsInTitlebar(bool aState) override;
   virtual void            UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
 
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
   virtual uint32_t        GetMaxTouchPoints() const override;
 
   /**
    * Event helpers