Bug 996133: Remove unnecessary NS_DISPATCH_NORMAL arguments to NS_DispatchToMainThread. r=ehsan
authorKyle Huey <khuey@kylehuey.com>
Fri, 23 May 2014 12:53:17 -0700
changeset 203980 f1755dd27a44d889c44adb476ad0723dce7a3e82
parent 203979 0b4cefec1be5402417bc0d62d54935035fc144cb
child 203981 c27a2ec18d128c1b23da464173842afeafc27bd9
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs996133
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 996133: Remove unnecessary NS_DISPATCH_NORMAL arguments to NS_DispatchToMainThread. r=ehsan
content/base/src/EventSource.cpp
content/base/src/WebSocket.cpp
content/canvas/src/ImageEncoder.cpp
content/html/content/src/HTMLMediaElement.cpp
content/media/MediaDecoderStateMachine.cpp
content/media/MediaMetadataManager.h
content/media/MediaRecorder.cpp
content/media/MediaResource.cpp
content/media/MediaStreamGraph.cpp
content/media/RtspMediaResource.cpp
content/media/SharedThreadPool.cpp
content/media/TextTrackList.cpp
content/media/mediasource/MediaSource.cpp
content/media/mediasource/SourceBufferList.cpp
content/media/omx/AudioOffloadPlayer.cpp
content/media/plugins/MediaResourceServer.cpp
content/media/webaudio/MediaBufferDecoder.cpp
content/media/webrtc/LoadMonitor.cpp
dom/archivereader/ArchiveEvent.cpp
dom/base/Console.cpp
dom/camera/CameraPreviewMediaStream.cpp
dom/camera/GonkCameraControl.cpp
dom/filehandle/FileStreamWrappers.cpp
dom/filehandle/LockedFile.cpp
dom/indexedDB/AsyncConnectionHelper.cpp
dom/indexedDB/OpenDatabaseHelper.cpp
dom/indexedDB/TransactionThreadPool.cpp
dom/ipc/Blob.cpp
dom/ipc/FilePickerParent.cpp
dom/ipc/TabParent.cpp
dom/media/MediaManager.h
dom/plugins/ipc/PluginHangUIParent.cpp
dom/quota/QuotaManager.cpp
dom/smil/nsSMILTimedElement.cpp
dom/workers/RuntimeService.cpp
dom/workers/ScriptLoader.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/XMLHttpRequest.cpp
gfx/src/gfxCrashReporterUtils.cpp
gfx/thebes/gfxFontInfoLoader.cpp
hal/gonk/GonkDiskSpaceWatcher.cpp
image/src/RasterImage.cpp
ipc/glue/BackgroundImpl.cpp
ipc/glue/MessagePump.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
netwerk/base/src/Seer.cpp
netwerk/base/src/Tickler.cpp
netwerk/base/src/nsPACMan.cpp
netwerk/cache/nsCacheService.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/websocket/WebSocketChannelChild.cpp
toolkit/components/osfile/NativeOSFileInternals.cpp
toolkit/components/telemetry/Telemetry.cpp
xpcom/base/nsMemoryImpl.cpp
--- a/content/base/src/EventSource.cpp
+++ b/content/base/src/EventSource.cpp
@@ -377,17 +377,17 @@ EventSource::OnStartRequest(nsIRequest *
   }
   rv = httpChannel->SetOwner(principal);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIRunnable> event =
     NS_NewRunnableMethod(this, &EventSource::AnnounceConnection);
   NS_ENSURE_STATE(event);
 
-  rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  rv = NS_DispatchToMainThread(event);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mStatus = PARSE_STATE_BEGIN_OF_STREAM;
 
   return NS_OK;
 }
 
 // this method parses the characters as they become available instead of
@@ -479,17 +479,17 @@ EventSource::OnStopRequest(nsIRequest *a
   }
 
   ClearFields();
 
   nsCOMPtr<nsIRunnable> event =
     NS_NewRunnableMethod(this, &EventSource::ReestablishConnection);
   NS_ENSURE_STATE(event);
 
-  rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  rv = NS_DispatchToMainThread(event);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return healthOfRequestResult;
 }
 
 /**
  * Simple helper class that just forwards the redirect callback back
  * to the EventSource.
@@ -1005,17 +1005,17 @@ EventSource::ConsoleError()
 
 nsresult
 EventSource::DispatchFailConnection()
 {
   nsCOMPtr<nsIRunnable> event =
     NS_NewRunnableMethod(this, &EventSource::FailConnection);
   NS_ENSURE_STATE(event);
 
-  return NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  return NS_DispatchToMainThread(event);
 }
 
 void
 EventSource::FailConnection()
 {
   if (mReadyState == CLOSED) {
     return;
   }
@@ -1151,17 +1151,17 @@ EventSource::Thaw()
   nsresult rv;
   if (!mGoingToDispatchAllMessages && mMessagesToDispatch.GetSize() > 0) {
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
     NS_ENSURE_STATE(event);
 
     mGoingToDispatchAllMessages = true;
 
-    rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    rv = NS_DispatchToMainThread(event);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = InitChannelAndRequestEventSource();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
@@ -1211,17 +1211,17 @@ EventSource::DispatchCurrentMessageEvent
 
   if (!mGoingToDispatchAllMessages) {
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
     NS_ENSURE_STATE(event);
 
     mGoingToDispatchAllMessages = true;
 
-    return NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    return NS_DispatchToMainThread(event);
   }
 
   return NS_OK;
 }
 
 void
 EventSource::DispatchAllMessageEvents()
 {
--- a/content/base/src/WebSocket.cpp
+++ b/content/base/src/WebSocket.cpp
@@ -325,17 +325,17 @@ WebSocket::OnStop(nsISupports* aContext,
   return ScheduleConnectionCloseEvents(aContext, aStatusCode, true);
 }
 
 nsresult
 WebSocket::ScheduleConnectionCloseEvents(nsISupports* aContext,
                                          nsresult aStatusCode,
                                          bool sync)
 {
-  NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+  MOZ_ASSERT(NS_IsMainThread());
 
   // no-op if some other code has already initiated close event
   if (!mOnCloseScheduled) {
     mCloseEventWasClean = NS_SUCCEEDED(aStatusCode);
 
     if (aStatusCode == NS_BASE_STREAM_CLOSED) {
       // don't generate an error event just because of an unclean close
       aStatusCode = NS_OK;
@@ -346,18 +346,17 @@ WebSocket::ScheduleConnectionCloseEvents
       mFailed = true;
     }
 
     mOnCloseScheduled = true;
 
     if (sync) {
       DispatchConnectionCloseEvents();
     } else {
-      NS_DispatchToMainThread(new CallDispatchConnectionCloseEvents(this),
-                              NS_DISPATCH_NORMAL);
+      NS_DispatchToCurrentThread(new CallDispatchConnectionCloseEvents(this));
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WebSocket::OnAcknowledge(nsISupports *aContext, uint32_t aSize)
--- a/content/canvas/src/ImageEncoder.cpp
+++ b/content/canvas/src/ImageEncoder.cpp
@@ -149,17 +149,17 @@ public:
     void* imgData = nullptr;
 
     nsresult rv = ProcessImageData(&imgSize, &imgData);
     if (NS_FAILED(rv)) {
       mEncodingCompleteEvent->SetFailed();
     } else {
       mEncodingCompleteEvent->SetMembers(imgData, imgSize, mType);
     }
-    rv = NS_DispatchToMainThread(mEncodingCompleteEvent, NS_DISPATCH_NORMAL);
+    rv = NS_DispatchToMainThread(mEncodingCompleteEvent);
     if (NS_FAILED(rv)) {
       // Better to leak than to crash.
       mEncodingCompleteEvent.forget();
       return rv;
     }
 
     return rv;
   }
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -3262,17 +3262,17 @@ nsresult HTMLMediaElement::DispatchAsync
   // Save events that occur while in the bfcache. These will be dispatched
   // if the page comes out of the bfcache.
   if (mEventDeliveryPaused) {
     mPendingEvents.AppendElement(aName);
     return NS_OK;
   }
 
   nsCOMPtr<nsIRunnable> event = new nsAsyncEventRunner(aName, this);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
   return NS_OK;
 }
 
 nsresult HTMLMediaElement::DispatchPendingMediaEvents()
 {
   NS_ASSERTION(!mEventDeliveryPaused,
                "Must not be in bfcache when dispatching pending media events");
 
@@ -3454,17 +3454,17 @@ HTMLMediaElement::IsNodeOfType(uint32_t 
   return !(aFlags & ~(eCONTENT | eMEDIA));
 }
 
 void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
 {
   LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing simple source error event", this));
 
   nsCOMPtr<nsIRunnable> event = new nsSourceErrorEventRunner(this, aSourceElement);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 void HTMLMediaElement::NotifyAddedSource()
 {
   // If a source element is inserted as a child of a media element
   // that has no src attribute and whose networkState has the value
   // NETWORK_EMPTY, the user agent must invoke the media element's
   // resource selection algorithm.
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -1113,30 +1113,30 @@ void MediaDecoderStateMachine::UpdatePla
   mCurrentFrameTime = aTime - mStartTime;
   NS_ASSERTION(mCurrentFrameTime >= 0, "CurrentTime should be positive!");
   if (aTime > mEndTime) {
     NS_ASSERTION(mCurrentFrameTime > GetDuration(),
                  "CurrentTime must be after duration if aTime > endTime!");
     mEndTime = aTime;
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 }
 
 void MediaDecoderStateMachine::UpdatePlaybackPosition(int64_t aTime)
 {
   UpdatePlaybackPositionInternal(aTime);
 
   bool fragmentEnded = mFragmentEndTime >= 0 && GetMediaTime() >= mFragmentEndTime;
   if (!mPositionChangeQueued || fragmentEnded) {
     mPositionChangeQueued = true;
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackPositionChanged);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 
   mMetadataManager.DispatchMetadataIfNeeded(mDecoder, aTime);
 
   if (fragmentEnded) {
     StopPlayback();
   }
 }
@@ -1222,17 +1222,17 @@ void MediaDecoderStateMachine::UpdateEst
 {
   AssertCurrentThreadInMonitor();
   int64_t duration = GetDuration();
   if (aDuration != duration &&
       abs(aDuration - duration) > ESTIMATED_DURATION_FUZZ_FACTOR_USECS) {
     SetDuration(aDuration);
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 }
 
 void MediaDecoderStateMachine::SetMediaEndTime(int64_t aEndTime)
 {
   NS_ASSERTION(OnDecodeThread(), "Should be on decode thread");
   AssertCurrentThreadInMonitor();
 
@@ -1850,17 +1850,17 @@ nsresult MediaDecoderStateMachine::Decod
   // Inform the element that we've loaded the metadata and the first frame.
   nsCOMPtr<nsIRunnable> metadataLoadedEvent =
     new AudioMetadataEventRunner(mDecoder,
                                  mInfo.mAudio.mChannels,
                                  mInfo.mAudio.mRate,
                                  HasAudio(),
                                  HasVideo(),
                                  tags);
-  NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(metadataLoadedEvent);
 
   if (HasAudio()) {
     RefPtr<nsIRunnable> decodeTask(
       NS_NewRunnableMethod(this, &MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded));
     AudioQueue().AddPopListener(decodeTask, mDecodeTaskQueue);
   }
   if (HasVideo()) {
     RefPtr<nsIRunnable> decodeTask(
@@ -1979,17 +1979,17 @@ void MediaDecoderStateMachine::DecodeSee
       if (HasVideo()) {
         if (video) {
           {
             ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
             RenderVideoFrame(video, TimeStamp::Now());
           }
           nsCOMPtr<nsIRunnable> event =
             NS_NewRunnableMethod(mDecoder, &MediaDecoder::Invalidate);
-          NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+          NS_DispatchToMainThread(event);
         }
       }
     } else {
       DecodeError();
     }
   }
   mDecoder->StartProgressUpdates();
   if (mState == DECODER_STATE_DECODING_METADATA ||
@@ -2578,17 +2578,17 @@ void MediaDecoderStateMachine::UpdateRea
    * HTMLMediaElement::UpdateReadyStateForData. It doesn't use the value of
    * GetNextFrameStatus we computed here, because what we're computing here
    * could be stale by the time MediaDecoder::UpdateReadyStateForData runs.
    * We only compute GetNextFrameStatus here to avoid posting runnables to the main
    * thread unnecessarily.
    */
   nsCOMPtr<nsIRunnable> event;
   event = NS_NewRunnableMethod(mDecoder, &MediaDecoder::UpdateReadyStateForData);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 bool MediaDecoderStateMachine::JustExitedQuickBuffering()
 {
   return !mDecodeStartTime.IsNull() &&
     mQuickBuffering &&
     (TimeStamp::Now() - mDecodeStartTime) < TimeDuration::FromMicroseconds(QUICK_BUFFER_THRESHOLD_USECS);
 }
--- a/content/media/MediaMetadataManager.h
+++ b/content/media/MediaMetadataManager.h
@@ -52,17 +52,17 @@ namespace mozilla {
         while (metadata && aCurrentTime >= static_cast<double>(metadata->mPublishTime) / USECS_PER_S) {
           nsCOMPtr<nsIRunnable> metadataUpdatedEvent =
             new AudioMetadataEventRunner(aDecoder,
                                          metadata->mChannels,
                                          metadata->mRate,
                                          metadata->mHasAudio,
                                          metadata->mHasVideo,
                                          metadata->mTags.forget());
-          NS_DispatchToMainThread(metadataUpdatedEvent, NS_DISPATCH_NORMAL);
+          NS_DispatchToMainThread(metadataUpdatedEvent);
           delete mMetadataQueue.popFirst();
           metadata = mMetadataQueue.getFirst();
         }
       }
     protected:
       LinkedList<TimedMetadata> mMetadataQueue;
   };
 }
--- a/content/media/MediaRecorder.cpp
+++ b/content/media/MediaRecorder.cpp
@@ -626,18 +626,17 @@ MediaRecorder::RequestData(ErrorResult& 
 {
   if (mState != RecordingState::Recording) {
     aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   NS_DispatchToMainThread(
     new CreateAndDispatchBlobEventRunnable(mSessions.LastElement()->GetEncodedData(),
-                                           this),
-                                           NS_DISPATCH_NORMAL);
+                                           this));
 }
 
 JSObject*
 MediaRecorder::WrapObject(JSContext* aCx)
 {
   return MediaRecorderBinding::Wrap(aCx, this);
 }
 
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -966,17 +966,17 @@ ChannelMediaResource::CacheClientNotifyD
   // NOTE: this can be called with the media cache lock held, so don't
   // block or do anything which might try to acquire a lock!
 
   if (mDataReceivedEvent.IsPending())
     return;
 
   mDataReceivedEvent =
     NS_NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
-  NS_DispatchToMainThread(mDataReceivedEvent.get(), NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(mDataReceivedEvent.get());
 }
 
 class DataEnded : public nsRunnable {
 public:
   DataEnded(MediaDecoder* aDecoder, nsresult aStatus) :
     mDecoder(aDecoder), mStatus(aStatus) {}
   NS_IMETHOD Run() {
     mDecoder->NotifyDownloadEnded(mStatus);
@@ -985,22 +985,22 @@ public:
 private:
   nsRefPtr<MediaDecoder> mDecoder;
   nsresult                 mStatus;
 };
 
 void
 ChannelMediaResource::CacheClientNotifyDataEnded(nsresult aStatus)
 {
-  NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
+  MOZ_ASSERT(NS_IsMainThread());
   // NOTE: this can be called with the media cache lock held, so don't
   // block or do anything which might try to acquire a lock!
 
   nsCOMPtr<nsIRunnable> event = new DataEnded(mDecoder, aStatus);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToCurrentThread(event);
 }
 
 void
 ChannelMediaResource::CacheClientNotifyPrincipalChanged()
 {
   NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
 
   mDecoder->NotifyPrincipalChanged();
@@ -1311,17 +1311,17 @@ void FileMediaResource::EnsureSizeInitia
   }
   mSizeInitialized = true;
   // Get the file size and inform the decoder.
   uint64_t size;
   nsresult res = mInput->Available(&size);
   if (NS_SUCCEEDED(res) && size <= INT64_MAX) {
     mSize = (int64_t)size;
     nsCOMPtr<nsIRunnable> event = new DataEnded(mDecoder, NS_OK);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 }
 
 nsresult FileMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
 {
   MutexAutoLock lock(mLock);
 
   EnsureSizeInitialized();
@@ -1659,13 +1659,13 @@ public:
 };
 
 void BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset)
 {
   if (aNumBytes <= 0) {
     return;
   }
   RefPtr<nsIRunnable> event(new DispatchBytesConsumedEvent(mDecoder, aNumBytes, aOffset));
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 } // namespace mozilla
 
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -1049,17 +1049,17 @@ MediaStreamGraphImpl::PlayVideo(MediaStr
                               targetTime);
     } else {
       output->SetCurrentFrame(frame->GetIntrinsicSize(), frame->GetImage(),
                               targetTime);
     }
 
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
   if (!aStream->mNotifiedFinished) {
     aStream->mLastPlayedVideoFrame = *frame;
   }
 }
 
 bool
 MediaStreamGraphImpl::ShouldUpdateMainThread()
--- a/content/media/RtspMediaResource.cpp
+++ b/content/media/RtspMediaResource.cpp
@@ -567,17 +567,17 @@ RtspMediaResource::OnConnected(uint8_t a
   mMediaStreamController->GetTotalTracks(&tracks);
 
   // If the preference of RTSP video feature is not enabled and the streaming is
   // video, we give up moving forward.
   if (!IsVideoEnabled() && IsVideo(tracks, meta)) {
     // Give up, report error to media element.
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(mDecoder, &MediaDecoder::DecodeError);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
     return NS_ERROR_FAILURE;
   }
   uint64_t duration = 0;
   for (int i = 0; i < tracks; ++i) {
     nsCString rtspTrackId("RtspTrack");
     rtspTrackId.AppendInt(i);
     nsCOMPtr<nsIStreamingProtocolMetaData> trackMeta;
     mMediaStreamController->GetTrackMetaData(i, getter_AddRefs(trackMeta));
@@ -613,17 +613,17 @@ RtspMediaResource::OnConnected(uint8_t a
     mDecoder->SetDuration(duration);
   } else {
     // Live stream.
     // Check the preference "media.realtime_decoder.enabled".
     if (!Preferences::GetBool("media.realtime_decoder.enabled", false)) {
       // Give up, report error to media element.
       nsCOMPtr<nsIRunnable> event =
         NS_NewRunnableMethod(mDecoder, &MediaDecoder::DecodeError);
-      NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(event);
       return NS_ERROR_FAILURE;
     } else {
       mRealTime = true;
       bool seekable = false;
       mDecoder->SetInfinite(true);
       mDecoder->SetTransportSeekable(seekable);
       mDecoder->SetMediaSeekable(seekable);
     }
--- a/content/media/SharedThreadPool.cpp
+++ b/content/media/SharedThreadPool.cpp
@@ -160,17 +160,17 @@ NS_IMETHODIMP_(MozExternalRefCountType) 
 
     dispatchShutdownEvent = sPools->Count() == 0;
   }
   if (dispatchShutdownEvent) {
     // No more SharedThreadPools alive. Destroy the hash table.
     // Ensure that we only run on the main thread.
     // Do this in an event so that if something holds the monitor we won't
     // be deleting the monitor while it's held.
-    NS_DispatchToMainThread(new ShutdownPoolsEvent(), NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(new ShutdownPoolsEvent());
   }
   return 0;
 }
 
 NS_IMPL_QUERY_INTERFACE(SharedThreadPool, nsIThreadPool, nsIEventTarget)
 
 SharedThreadPool::SharedThreadPool(const nsCString& aName,
                                    nsIThreadPool* aPool)
--- a/content/media/TextTrackList.cpp
+++ b/content/media/TextTrackList.cpp
@@ -167,33 +167,33 @@ TextTrackList::CreateAndDispatchChangeEv
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to init the change event!");
     return;
   }
 
   event->SetTrusted(true);
 
   nsCOMPtr<nsIRunnable> eventRunner = new TrackEventRunner(this, event);
-  NS_DispatchToMainThread(eventRunner, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(eventRunner);
 }
 
 void
 TextTrackList::CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
                                                  const nsAString& aEventName)
 {
   TrackEventInit eventInit;
   eventInit.mBubbles = false;
   eventInit.mCancelable = false;
   eventInit.mTrack = aTrack;
   nsRefPtr<TrackEvent> event =
     TrackEvent::Constructor(this, aEventName, eventInit);
 
   // Dispatch the TrackEvent asynchronously.
   nsCOMPtr<nsIRunnable> eventRunner = new TrackEventRunner(this, event);
-  NS_DispatchToMainThread(eventRunner, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(eventRunner);
 }
 
 HTMLMediaElement*
 TextTrackList::GetMediaElement()
 {
   if (mTextTrackManager) {
     return mTextTrackManager->mMediaElement;
   }
--- a/content/media/mediasource/MediaSource.cpp
+++ b/content/media/mediasource/MediaSource.cpp
@@ -349,17 +349,17 @@ MediaSource::DispatchSimpleEvent(const c
   DispatchTrustedEvent(NS_ConvertUTF8toUTF16(aName));
 }
 
 void
 MediaSource::QueueAsyncSimpleEvent(const char* aName)
 {
   MSE_DEBUG("%p Queuing event %s to MediaSource", this, aName);
   nsCOMPtr<nsIRunnable> event = new AsyncEventRunner<MediaSource>(this, aName);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 void
 MediaSource::DurationChange(double aNewDuration, ErrorResult& aRv)
 {
   if (mDuration == aNewDuration) {
     return;
   }
--- a/content/media/mediasource/SourceBufferList.cpp
+++ b/content/media/mediasource/SourceBufferList.cpp
@@ -137,17 +137,17 @@ SourceBufferList::DispatchSimpleEvent(co
   DispatchTrustedEvent(NS_ConvertUTF8toUTF16(aName));
 }
 
 void
 SourceBufferList::QueueAsyncSimpleEvent(const char* aName)
 {
   MSE_DEBUG("%p Queuing event %s to SourceBufferList", this, aName);
   nsCOMPtr<nsIRunnable> event = new AsyncEventRunner<SourceBufferList>(this, aName);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 SourceBufferList::SourceBufferList(MediaSource* aMediaSource)
   : DOMEventTargetHelper(aMediaSource->GetParentObject())
   , mMediaSource(aMediaSource)
 {
   MOZ_ASSERT(aMediaSource);
 }
--- a/content/media/omx/AudioOffloadPlayer.cpp
+++ b/content/media/omx/AudioOffloadPlayer.cpp
@@ -337,17 +337,17 @@ status_t AudioOffloadPlayer::SeekTo(int6
   mPositionTimeMediaUs = -1;
   mSeekTimeUs = aTimeUs;
   mStartPosUs = aTimeUs;
   mDispatchSeekEvents = aDispatchSeekEvents;
 
   if (mDispatchSeekEvents) {
     nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
         &MediaDecoder::SeekingStarted);
-    NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
+    NS_DispatchToCurrentThread(nsEvent);
   }
 
   if (mPlaying) {
     mAudioSink->Pause();
     mAudioSink->Flush();
     mAudioSink->Start();
 
   } else {
@@ -357,17 +357,17 @@ status_t AudioOffloadPlayer::SeekTo(int6
       mAudioSink->Flush();
     }
 
     if (mDispatchSeekEvents) {
       mDispatchSeekEvents = false;
       AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Fake seek complete during pause"));
       nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
           &MediaDecoder::SeekingStopped);
-      NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
+      NS_DispatchToCurrentThread(nsEvent);
     }
   }
 
   return OK;
 }
 
 double AudioOffloadPlayer::GetMediaTimeSecs()
 {
@@ -410,31 +410,31 @@ int64_t AudioOffloadPlayer::GetOutputPla
   const int64_t renderedDuration = mStartPosUs + playedUs;
   return renderedDuration;
 }
 
 void AudioOffloadPlayer::NotifyAudioEOS()
 {
   nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
       &MediaDecoder::PlaybackEnded);
-  NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(nsEvent);
 }
 
 void AudioOffloadPlayer::NotifyPositionChanged()
 {
   nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
       &MediaOmxDecoder::PlaybackPositionChanged);
-  NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(nsEvent);
 }
 
 void AudioOffloadPlayer::NotifyAudioTearDown()
 {
   nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
       &MediaOmxDecoder::AudioOffloadTearDown);
-  NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(nsEvent);
 }
 
 // static
 size_t AudioOffloadPlayer::AudioSinkCallback(AudioSink* aAudioSink,
                                              void* aBuffer,
                                              size_t aSize,
                                              void* aCookie,
                                              AudioSink::cb_event_t aEvent)
@@ -531,17 +531,16 @@ size_t AudioOffloadPlayer::FillBuffer(vo
       }
 
       if(mInputBuffer->range_length() != 0) {
         CHECK(mInputBuffer->meta_data()->findInt64(
             kKeyTime, &mPositionTimeMediaUs));
       }
 
       if (refreshSeekTime) {
-
         if (mDispatchSeekEvents && !mSeekDuringPause) {
           mDispatchSeekEvents = false;
           AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("FillBuffer posting SEEK_COMPLETE"));
           nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
               &MediaDecoder::SeekingStopped);
           NS_DispatchToMainThread(nsEvent, NS_DISPATCH_NORMAL);
 
         } else if (mSeekDuringPause) {
--- a/content/media/plugins/MediaResourceServer.cpp
+++ b/content/media/plugins/MediaResourceServer.cpp
@@ -317,17 +317,17 @@ ServeResourceEvent::Shutdown()
 {
   // Cleanup resources and exit.
   mInput->Close();
   mOutput->Close();
 
   // To shutdown the current thread we need to first exit this event.
   // The Shutdown event below is posted to the main thread to do this.
   nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(NS_GetCurrentThread());
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 /*
   This is the listener attached to the server socket. When an HTTP
   request is made by the client the OnSocketAccepted method is
   called. This method will spawn a thread to process the request.
   The thread receives a single event which does the parsing of
   the HTTP request and forwarding the data from the MediaResource
--- a/content/media/webaudio/MediaBufferDecoder.cpp
+++ b/content/media/webaudio/MediaBufferDecoder.cpp
@@ -115,22 +115,21 @@ public:
 
 private:
   void ReportFailureOnMainThread(WebAudioDecodeJob::ErrorCode aErrorCode) {
     if (NS_IsMainThread()) {
       Cleanup();
       mDecodeJob.OnFailure(aErrorCode);
     } else {
       // Take extra care to cleanup on the main thread
-      NS_DispatchToMainThread(NS_NewRunnableMethod(this, &MediaDecodeTask::Cleanup),
-                              NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(NS_NewRunnableMethod(this, &MediaDecodeTask::Cleanup));
 
       nsCOMPtr<nsIRunnable> event =
         new ReportResultTask(mDecodeJob, &WebAudioDecodeJob::OnFailure, aErrorCode);
-      NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(event);
     }
   }
 
   void Decode();
   void AllocateBuffer();
   void CallbackTheResult();
 
   void Cleanup()
@@ -433,39 +432,39 @@ MediaBufferDecoder::AsyncDecodeMedia(con
   // Do not attempt to decode the media if we were not successful at sniffing
   // the content type.
   if (!*aContentType ||
       strcmp(aContentType, APPLICATION_OCTET_STREAM) == 0) {
     nsCOMPtr<nsIRunnable> event =
       new ReportResultTask(aDecodeJob,
                            &WebAudioDecodeJob::OnFailure,
                            WebAudioDecodeJob::UnknownContent);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
     return;
   }
 
   if (!EnsureThreadPoolInitialized()) {
     nsCOMPtr<nsIRunnable> event =
       new ReportResultTask(aDecodeJob,
                            &WebAudioDecodeJob::OnFailure,
                            WebAudioDecodeJob::UnknownError);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
     return;
   }
 
   MOZ_ASSERT(mThreadPool);
 
   nsRefPtr<MediaDecodeTask> task =
     new MediaDecodeTask(aContentType, aBuffer, aLength, aDecodeJob, mThreadPool);
   if (!task->CreateReader()) {
     nsCOMPtr<nsIRunnable> event =
       new ReportResultTask(aDecodeJob,
                            &WebAudioDecodeJob::OnFailure,
                            WebAudioDecodeJob::UnknownError);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   } else {
     mThreadPool->Dispatch(task, nsIThreadPool::DISPATCH_NORMAL);
   }
 }
 
 bool
 MediaBufferDecoder::EnsureThreadPoolInitialized()
 {
--- a/content/media/webrtc/LoadMonitor.cpp
+++ b/content/media/webrtc/LoadMonitor.cpp
@@ -153,17 +153,17 @@ void LoadMonitor::Shutdown()
   if (mLoadInfoThread) {
     mShutdownPending = true;
     mCondVar.Notify();
 
     mLoadInfoThread = nullptr;
 
     nsRefPtr<LoadMonitorRemoveObserver> remObsRunner = new LoadMonitorRemoveObserver(this);
     if (!NS_IsMainThread()) {
-      NS_DispatchToMainThread(remObsRunner, NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(remObsRunner);
     } else {
       remObsRunner->Run();
     }
   }
 }
 
 #ifdef XP_WIN
 static LPCTSTR TotalCounterPath = _T("\\Processor(_Total)\\% Processor Time");
@@ -595,17 +595,17 @@ LoadMonitor::Init(nsRefPtr<LoadMonitor> 
   nsresult rv = load_info->Init(mLoadUpdateInterval);
 
   if (NS_FAILED(rv)) {
     LOG(("LoadInfo::Init error"));
     return rv;
   }
 
   nsRefPtr<LoadMonitorAddObserver> addObsRunner = new LoadMonitorAddObserver(self);
-  NS_DispatchToMainThread(addObsRunner, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(addObsRunner);
 
   NS_NewNamedThread("Sys Load Info", getter_AddRefs(mLoadInfoThread));
 
   nsRefPtr<LoadInfoCollectRunner> runner =
     new LoadInfoCollectRunner(self, load_info);
   mLoadInfoThread->Dispatch(runner, NS_DISPATCH_NORMAL);
 
   return NS_OK;
--- a/dom/archivereader/ArchiveEvent.cpp
+++ b/dom/archivereader/ArchiveEvent.cpp
@@ -92,17 +92,17 @@ ArchiveReaderEvent::Run()
 }
 
 nsresult
 ArchiveReaderEvent::RunShare(nsresult aStatus)
 {
   mStatus = aStatus;
 
   nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 
   return NS_OK;
 }
 
 void
 ArchiveReaderEvent::ShareMainThread()
 {
   nsTArray<nsCOMPtr<nsIDOMFile> > fileList;
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -227,17 +227,17 @@ public:
 
     if (!PreDispatch(cx)) {
       return false;
     }
 
     AutoSyncLoopHolder syncLoop(mWorkerPrivate);
     mSyncLoopTarget = syncLoop.EventTarget();
 
-    if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(this))) {
       JS_ReportError(cx,
                      "Failed to dispatch to main thread for the Console API!");
       return false;
     }
 
     return syncLoop.Run();
   }
 
--- a/dom/camera/CameraPreviewMediaStream.cpp
+++ b/dom/camera/CameraPreviewMediaStream.cpp
@@ -108,17 +108,17 @@ CameraPreviewMediaStream::SetCurrentFram
   MutexAutoLock lock(mMutex);
 
   TimeStamp now = TimeStamp::Now();
   for (uint32_t i = 0; i < mVideoOutputs.Length(); ++i) {
     VideoFrameContainer* output = mVideoOutputs[i];
     output->SetCurrentFrame(aIntrinsicSize, aImage, now);
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 
   if (mFrameCallback) {
     mFrameCallback->OnNewFrame(aIntrinsicSize, aImage);
   }
 }
 
 void
@@ -126,13 +126,13 @@ CameraPreviewMediaStream::ClearCurrentFr
 {
   MutexAutoLock lock(mMutex);
 
   for (uint32_t i = 0; i < mVideoOutputs.Length(); ++i) {
     VideoFrameContainer* output = mVideoOutputs[i];
     output->ClearCurrentFrame();
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
-    NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(event);
   }
 }
 
 }
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -1065,17 +1065,17 @@ nsGonkCameraControl::StopRecordingImpl()
       rv = mParams.Set(CAMERA_PARAM_FLASHMODE, NS_LITERAL_STRING("auto"));
       if (NS_FAILED(rv)) {
         DOM_CAMERA_LOGE("Failed to set flash mode (0x%x)\n", rv);
       }
     }
   }
 
   // notify DeviceStorage that the new video file is closed and ready
-  return NS_DispatchToMainThread(new RecordingComplete(mVideoFile), NS_DISPATCH_NORMAL);
+  return NS_DispatchToMainThread(new RecordingComplete(mVideoFile));
 }
 
 nsresult
 nsGonkCameraControl::ResumeContinuousFocusImpl()
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
   RETURN_IF_NO_CAMERA_HW();
 
--- a/dom/filehandle/FileStreamWrappers.cpp
+++ b/dom/filehandle/FileStreamWrappers.cpp
@@ -93,17 +93,17 @@ FileStreamWrapper::~FileStreamWrapper()
   if (mFlags & NOTIFY_DESTROY) {
     if (NS_IsMainThread()) {
       mFileHelper->OnStreamDestroy();
     }
     else {
       nsCOMPtr<nsIRunnable> runnable =
         new DestroyRunnable(mFileHelper);
 
-      nsresult rv = NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+      nsresult rv = NS_DispatchToMainThread(runnable);
       if (NS_FAILED(rv)) {
         NS_WARNING("Failed to dispatch to the main thread!");
       }
     }
   }
 }
 
 NS_IMPL_ISUPPORTS0(FileStreamWrapper)
@@ -126,17 +126,17 @@ NS_IMPL_ISUPPORTS_INHERITED(FileInputStr
 NS_IMETHODIMP
 FileInputStreamWrapper::Close()
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   if (mFlags & NOTIFY_CLOSE) {
     nsCOMPtr<nsIRunnable> runnable = new CloseRunnable(mFileHelper);
 
-    if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
       NS_WARNING("Failed to dispatch to the main thread!");
     }
   }
 
   mOffset = 0;
   mLimit = 0;
 
   return NS_OK;
@@ -196,17 +196,17 @@ FileInputStreamWrapper::Read(char* aBuf,
   NS_ENSURE_SUCCESS(rv, rv);
 
   mOffset += *_retval;
 
   if (mFlags & NOTIFY_PROGRESS) {
     nsCOMPtr<nsIRunnable> runnable =
       new ProgressRunnable(mFileHelper, mOffset, mLimit);
 
-    rv = NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+    rv = NS_DispatchToMainThread(runnable);
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed to dispatch to the main thread!");
     }
   }
 
   return NS_OK;
 }
 
@@ -253,17 +253,17 @@ FileOutputStreamWrapper::Close()
     NS_ASSERTION(PR_GetCurrentThread() == mWriteThread,
                  "Unsetting thread locals on wrong thread!");
     mFileHelper->mFileHandle->UnsetThreadLocals();
   }
 
   if (mFlags & NOTIFY_CLOSE) {
     nsCOMPtr<nsIRunnable> runnable = new CloseRunnable(mFileHelper);
 
-    if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
       NS_WARNING("Failed to dispatch to the main thread!");
     }
   }
 
   mOffset = 0;
   mLimit = 0;
 
   return rv;
@@ -313,17 +313,17 @@ FileOutputStreamWrapper::Write(const cha
   NS_ENSURE_SUCCESS(rv, rv);
 
   mOffset += *_retval;
 
   if (mFlags & NOTIFY_PROGRESS) {
     nsCOMPtr<nsIRunnable> runnable =
       new ProgressRunnable(mFileHelper, mOffset, mLimit);
 
-    NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(runnable);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FileOutputStreamWrapper::Flush()
 {
--- a/dom/filehandle/LockedFile.cpp
+++ b/dom/filehandle/LockedFile.cpp
@@ -870,17 +870,17 @@ FinishHelper::Run()
 
     if (NS_FAILED(stream->Close())) {
       NS_WARNING("Failed to close stream!");
     }
 
     mStream = nullptr;
   }
 
-  return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
+  return NS_DispatchToMainThread(this);
 }
 
 nsresult
 ReadHelper::Init()
 {
   mStream = MemoryOutputStream::Create(mSize);
   NS_ENSURE_TRUE(mStream, NS_ERROR_FAILURE);
 
--- a/dom/indexedDB/AsyncConnectionHelper.cpp
+++ b/dom/indexedDB/AsyncConnectionHelper.cpp
@@ -355,17 +355,17 @@ AsyncConnectionHelper::Run()
   }
 
   IDB_PROFILER_MARK_IF(mRequest,
                        "IndexedDB Request %llu: Finished database work "
                        "(rv = %lu)",
                        "IDBRequest[%llu] DT Done", mRequest->GetSerialNumber(),
                        mResultCode);
 
-  return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
+  return NS_DispatchToMainThread(this);
 }
 
 NS_IMETHODIMP
 AsyncConnectionHelper::OnProgress(mozIStorageConnection* aConnection,
                                   bool* _retval)
 {
   if (mDatabase && mDatabase->IsInvalidated()) {
     // Someone is trying to delete the database file. Exit lightningfast!
--- a/dom/indexedDB/OpenDatabaseHelper.cpp
+++ b/dom/indexedDB/OpenDatabaseHelper.cpp
@@ -2303,17 +2303,17 @@ OpenDatabaseHelper::Run()
   NS_ASSERTION(mState == eDBWork, "Why are we here?");
   mResultCode = DoDatabaseWork();
   NS_ASSERTION(mState != eDBWork, "We should be doing something else now.");
 
   IDB_PROFILER_MARK("IndexedDB Request %llu: Finished database work (rv = %lu)",
                     "IDBRequest[%llu] DT Done", mRequest->GetSerialNumber(),
                     mResultCode);
 
-  return NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
+  return NS_DispatchToMainThread(this);
 }
 
 nsresult
 OpenDatabaseHelper::EnsureSuccessResult()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   PROFILER_MAIN_THREAD_LABEL("IndexedDB",
--- a/dom/indexedDB/TransactionThreadPool.cpp
+++ b/dom/indexedDB/TransactionThreadPool.cpp
@@ -614,18 +614,17 @@ TransactionThreadPool::TransactionQueue:
   } while (!shouldFinish);
 
   IDB_PROFILER_MARK("IndexedDB Transaction %llu: Finished database work",
                     "IDBTransaction[%llu] DT Done",
                     mTransaction->GetSerialNumber());
 
   nsCOMPtr<nsIRunnable> finishTransactionRunnable =
     new FinishTransactionRunnable(mTransaction, finishRunnable);
-  if (NS_FAILED(NS_DispatchToMainThread(finishTransactionRunnable,
-                                        NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(finishTransactionRunnable))) {
     NS_WARNING("Failed to dispatch finishTransactionRunnable!");
   }
 
   return NS_OK;
 }
 
 FinishTransactionRunnable::FinishTransactionRunnable(
                                          IDBTransaction* aTransaction,
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -599,17 +599,17 @@ private:
 
     // To force the stream open we call Available(). We don't actually care
     // how much data is available.
     uint64_t available;
     if (NS_FAILED(mStream->Available(&available))) {
       NS_WARNING("Available failed on this stream!");
     }
 
-    nsresult rv = NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL);
+    nsresult rv = NS_DispatchToMainThread(this);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
   }
 
   nsresult
   CloseStream()
   {
--- a/dom/ipc/FilePickerParent.cpp
+++ b/dom/ipc/FilePickerParent.cpp
@@ -90,17 +90,17 @@ FilePickerParent::FileSizeAndDateRunnabl
   // We're not on the main thread, so do the stat().
   for (unsigned i = 0; i < mDomfiles.Length(); i++) {
     uint64_t size, lastModified;
     mDomfiles[i]->GetSize(&size);
     mDomfiles[i]->GetMozLastModifiedDate(&lastModified);
   }
 
   // Dispatch ourselves back on the main thread.
-  if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(this))) {
     // It's hard to see how we can recover gracefully in this case. The child
     // process is waiting for an IPC, but that can only happen on the main
     // thread.
     MOZ_CRASH();
   }
   return NS_OK;
 }
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -163,17 +163,17 @@ private:
         NS_ENSURE_SUCCESS_VOID(rv);
 
         PRFileDesc* fd;
         rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
         NS_ENSURE_SUCCESS_VOID(rv);
 
         mFD = fd;
 
-        if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+        if (NS_FAILED(NS_DispatchToMainThread(this))) {
             NS_WARNING("Failed to dispatch to main thread!");
 
             CloseFile();
         }
     }
 
     void CloseFile()
     {
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -377,17 +377,17 @@ public:
             new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STARTING,
                                               mStream.forget(),
                                               mOnTracksAvailableCallback.forget(),
                                               mAudioSource != nullptr,
                                               mVideoSource != nullptr,
                                               mWindowID, mError.forget());
           // event must always be released on mainthread due to the JS callbacks
           // in the TracksAvailableCallback
-          NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+          NS_DispatchToMainThread(event);
         }
         break;
 
       case MEDIA_STOP:
         {
           NS_ASSERTION(!NS_IsMainThread(), "Never call on main thread");
           if (mAudioSource) {
             mAudioSource->Stop(source, kAudioTrack);
@@ -404,17 +404,17 @@ public:
           nsIRunnable *event =
             new GetUserMediaNotificationEvent(mListener,
                                               GetUserMediaNotificationEvent::STOPPING,
                                               mAudioSource != nullptr,
                                               mVideoSource != nullptr,
                                               mWindowID);
           // event must always be released on mainthread due to the JS callbacks
           // in the TracksAvailableCallback
-          NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+          NS_DispatchToMainThread(event);
         }
         break;
 
       default:
         MOZ_ASSERT(false,"invalid MediaManager operation");
         break;
     }
     return NS_OK;
--- a/dom/plugins/ipc/PluginHangUIParent.cpp
+++ b/dom/plugins/ipc/PluginHangUIParent.cpp
@@ -362,17 +362,17 @@ PluginHangUIParent::RecvUserResponse(con
     // Dialog was cancelled
     responseCode = 3;
   }
   int dontAskCode = (aResponse & HANGUI_USER_RESPONSE_DONT_SHOW_AGAIN) ? 1 : 0;
   nsCOMPtr<nsIRunnable> workItem = new nsPluginHangUITelemetry(responseCode,
                                                                dontAskCode,
                                                                LastShowDurationMs(),
                                                                mTimeoutPrefMs);
-  NS_DispatchToMainThread(workItem, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(workItem);
   return true;
 }
 
 nsresult
 PluginHangUIParent::GetHangUIOwnerWindowHandle(NativeWindowHandle& windowHandle)
 {
   windowHandle = nullptr;
 
--- a/dom/quota/QuotaManager.cpp
+++ b/dom/quota/QuotaManager.cpp
@@ -3546,17 +3546,17 @@ OriginClearRunnable::Run()
       if (mPersistenceType.IsNull()) {
         DeleteFiles(quotaManager, PERSISTENCE_TYPE_PERSISTENT);
         DeleteFiles(quotaManager, PERSISTENCE_TYPE_TEMPORARY);
       } else {
         DeleteFiles(quotaManager, mPersistenceType.Value());
       }
 
       // Now dispatch back to the main thread.
-      if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+      if (NS_FAILED(NS_DispatchToMainThread(this))) {
         NS_WARNING("Failed to dispatch to main thread!");
         return NS_ERROR_FAILURE;
       }
 
       return NS_OK;
     }
 
     case Complete: {
@@ -3790,17 +3790,17 @@ AsyncUsageRunnable::Run()
 
   nsresult rv = RunInternal();
 
   if (!NS_IsMainThread()) {
     if (NS_FAILED(rv)) {
       ResetUsage();
     }
 
-    if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(this))) {
       NS_WARNING("Failed to dispatch to main thread!");
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/smil/nsSMILTimedElement.cpp
+++ b/dom/smil/nsSMILTimedElement.cpp
@@ -2307,17 +2307,17 @@ nsSMILTimedElement::NotifyChangedInterva
 void
 nsSMILTimedElement::FireTimeEventAsync(uint32_t aMsg, int32_t aDetail)
 {
   if (!mAnimationElement)
     return;
 
   nsCOMPtr<nsIRunnable> event =
     new AsyncTimeEventRunner(mAnimationElement, aMsg, aDetail);
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 }
 
 const nsSMILInstanceTime*
 nsSMILTimedElement::GetEffectiveBeginInstance() const
 {
   switch (mElementState)
   {
   case STATE_STARTUP:
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -631,17 +631,17 @@ public:
   bool
   Dispatch(JSContext* aCx)
   {
     AutoSyncLoopHolder syncLoop(mWorkerPrivate);
 
     mSyncLoopTarget = syncLoop.EventTarget();
     MOZ_ASSERT(mSyncLoopTarget);
 
-    if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(this))) {
       JS_ReportError(aCx, "Failed to dispatch to main thread!");
       return false;
     }
 
     return syncLoop.Run();
   }
 
 private:
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -277,17 +277,17 @@ private:
 
     if (aStatus >= Terminating && !mCanceled) {
       mCanceled = true;
 
       nsCOMPtr<nsIRunnable> runnable =
         NS_NewRunnableMethod(this, &ScriptLoaderRunnable::CancelMainThread);
       NS_ASSERTION(runnable, "This should never fail!");
 
-      if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+      if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
         JS_ReportError(aCx, "Failed to cancel script loader!");
         return false;
       }
     }
 
     return true;
   }
 
@@ -810,17 +810,17 @@ LoadAllScripts(JSContext* aCx, WorkerPri
                              aLoadInfos, aIsWorkerScript);
 
   NS_ASSERTION(aLoadInfos.IsEmpty(), "Should have swapped!");
 
   if (!aWorkerPrivate->AddFeature(aCx, loader)) {
     return false;
   }
 
-  if (NS_FAILED(NS_DispatchToMainThread(loader, NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(loader))) {
     NS_ERROR("Failed to dispatch!");
 
     aWorkerPrivate->RemoveFeature(aCx, loader);
     return false;
   }
 
   return syncLoop.Run();
 }
@@ -863,17 +863,17 @@ ChannelFromScriptURLWorkerThread(JSConte
   aParent->AssertIsOnWorkerThread();
 
   AutoSyncLoopHolder syncLoop(aParent);
 
   nsRefPtr<ChannelGetterRunnable> getter =
     new ChannelGetterRunnable(aParent, syncLoop.EventTarget(), aScriptURL,
                               aChannel);
 
-  if (NS_FAILED(NS_DispatchToMainThread(getter, NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(getter))) {
     NS_ERROR("Failed to dispatch!");
     return NS_ERROR_FAILURE;
   }
 
   if (!syncLoop.Run()) {
     return NS_ERROR_FAILURE;
   }
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -767,17 +767,17 @@ private:
     nsTArray<nsCOMPtr<nsISupports>> doomed;
     mFinishedWorker->ForgetMainThreadObjects(doomed);
 
     nsTArray<nsCString> hostObjectURIs;
     mFinishedWorker->StealHostObjectURIs(hostObjectURIs);
 
     nsRefPtr<MainThreadReleaseRunnable> runnable =
       new MainThreadReleaseRunnable(doomed, hostObjectURIs);
-    if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
       NS_WARNING("Failed to dispatch, going to leak!");
     }
 
     RuntimeService* runtime = RuntimeService::GetService();
     NS_ASSERTION(runtime, "This should never be null!");
 
     runtime->UnregisterWorker(aCx, mFinishedWorker);
 
@@ -4289,17 +4289,17 @@ WorkerPrivate::ScheduleDeletion(WorkerRa
       new WorkerFinishedRunnable(parent, this);
     if (!runnable->Dispatch(nullptr)) {
       NS_WARNING("Failed to dispatch runnable!");
     }
   }
   else {
     nsRefPtr<TopLevelWorkerFinishedRunnable> runnable =
       new TopLevelWorkerFinishedRunnable(this);
-    if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
       NS_WARNING("Failed to dispatch runnable!");
     }
   }
 }
 
 bool
 WorkerPrivate::BlockAndCollectRuntimeStats(JS::RuntimeStats* aRtStats)
 {
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -525,17 +525,17 @@ public:
   bool
   Dispatch(JSContext* aCx)
   {
     mWorkerPrivate->AssertIsOnWorkerThread();
 
     AutoSyncLoopHolder syncLoop(mWorkerPrivate);
     mSyncLoopTarget = syncLoop.EventTarget();
 
-    if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+    if (NS_FAILED(NS_DispatchToMainThread(this))) {
       JS_ReportError(aCx, "Failed to dispatch to main thread!");
       return false;
     }
 
     return syncLoop.Run();
   }
 
 protected:
--- a/gfx/src/gfxCrashReporterUtils.cpp
+++ b/gfx/src/gfxCrashReporterUtils.cpp
@@ -101,17 +101,17 @@ private:
   char mStatusChar;
   const char *mFeature;
 };
 
 void
 ScopedGfxFeatureReporter::WriteAppNote(char statusChar)
 {
   nsCOMPtr<nsIRunnable> r = new AppNoteWritingRunnable(statusChar, mFeature);
-  NS_DispatchToMainThread(r.get(), NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(r);
 }
 
 } // end namespace mozilla
 
 #else
 
 namespace mozilla {
 void ScopedGfxFeatureReporter::WriteAppNote(char) {}
--- a/gfx/thebes/gfxFontInfoLoader.cpp
+++ b/gfx/thebes/gfxFontInfoLoader.cpp
@@ -73,17 +73,17 @@ NS_IMPL_ISUPPORTS(FontInfoLoadCompleteEv
 // runs on separate thread
 nsresult
 AsyncFontInfoLoader::Run()
 {
     // load platform-specific font info
     mFontInfo->Load();
 
     // post a completion event that transfer the data to the fontlist
-    NS_DispatchToMainThread(mCompleteEvent, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(mCompleteEvent);
     mFontInfo = nullptr;
 
     return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(AsyncFontInfoLoader, nsIRunnable);
 
 NS_IMPL_ISUPPORTS(gfxFontInfoLoader::ShutdownObserver, nsIObserver)
--- a/hal/gonk/GonkDiskSpaceWatcher.cpp
+++ b/hal/gonk/GonkDiskSpaceWatcher.cpp
@@ -201,30 +201,30 @@ GonkDiskSpaceWatcher::DoStop()
     mReadWatcher.StopWatchingFileDescriptor();
     fanotify_mark(mFd, FAN_MARK_FLUSH, 0, 0, kWatchedPath);
     close(mFd);
     mFd = -1;
   }
 
   // Dispatch the cleanup to the main thread.
   nsCOMPtr<nsIRunnable> runnable = new DiskSpaceCleaner();
-  NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(runnable);
 }
 
 // We are called off the main thread, so we proxy first to the main thread
 // before calling the xpcom object.
 void
 GonkDiskSpaceWatcher::NotifyUpdate()
 {
   mLastTimestamp = TimeStamp::Now();
   mLastFreeSpace = mFreeSpace;
 
   nsCOMPtr<nsIRunnable> runnable =
     new DiskSpaceNotifier(mIsDiskFull, mFreeSpace);
-  NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(runnable);
 }
 
 void
 GonkDiskSpaceWatcher::OnFileCanReadWithoutBlocking(int aFd)
 {
   struct fanotify_event_metadata* fem = nullptr;
   char buf[4096];
   struct statfs sfs;
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -357,17 +357,17 @@ public:
                                           request->srcFormat);
     } else {
       request->done = false;
     }
 
     // OK, we've got a new scaled image. Let's get the main thread to unlock and
     // redraw it.
     nsRefPtr<DrawRunner> runner = new DrawRunner(mScaleRequest.forget());
-    NS_DispatchToMainThread(runner, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(runner);
 
     return NS_OK;
   }
 
   bool IsOK() const { return !!mScaleRequest; }
 
 private:
   nsAutoPtr<ScaleRequest> mScaleRequest;
--- a/ipc/glue/BackgroundImpl.cpp
+++ b/ipc/glue/BackgroundImpl.cpp
@@ -1375,17 +1375,17 @@ ParentImpl::RequestMessageLoopRunnable::
   MOZ_ASSERT_IF(oldBackgroundThread,
                 PR_GetCurrentThread() != oldBackgroundThread);
 
   MOZ_ASSERT(!mMessageLoop);
 
   mMessageLoop = MessageLoop::current();
   MOZ_ASSERT(mMessageLoop);
 
-  if (NS_FAILED(NS_DispatchToMainThread(this, NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(this))) {
     NS_WARNING("Failed to dispatch RequestMessageLoopRunnable to main thread!");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(ParentImpl::ShutdownBackgroundThreadRunnable,
@@ -1629,17 +1629,17 @@ ChildImpl::GetOrCreateForCurrentThread(
     if (NS_WARN_IF(!OpenProtocolOnMainThread(NS_GetCurrentThread()))) {
       return false;
     }
 
     return true;
   }
 
   nsRefPtr<CreateActorRunnable> runnable = new CreateActorRunnable();
-  if (NS_FAILED(NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL))) {
+  if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
     CRASH_IN_CHILD_PROCESS("Failed to dispatch to main thread!");
     return false;
   }
 
   return true;
 }
 
 // static
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -149,17 +149,17 @@ MessagePump::ScheduleWork()
 {
   // Make sure the event loop wakes up.
   if (mThread) {
     mThread->Dispatch(mDoWorkEvent, NS_DISPATCH_NORMAL);
   }
   else {
     // Some things (like xpcshell) don't use the app shell and so Run hasn't
     // been called. We still need to wake up the main thread.
-    NS_DispatchToMainThread(mDoWorkEvent, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(mDoWorkEvent);
   }
   event_.Signal();
 }
 
 void
 MessagePump::ScheduleWorkForNestedLoop()
 {
   // This method is called when our MessageLoop has just allowed
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h
@@ -415,17 +415,17 @@ public:
 #endif // MOZILLA_INTERNAL_API
     {
     }
 
     ~PipelineListener()
     {
       // release conduit on mainthread.  Must use forget()!
       nsresult rv = NS_DispatchToMainThread(new
-        ConduitDeleteEvent(conduit_.forget()), NS_DISPATCH_NORMAL);
+        ConduitDeleteEvent(conduit_.forget()));
       MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
       if (NS_FAILED(rv)) {
         MOZ_CRASH();
       }
     }
 
     void SetActive(bool active) { active_ = active; }
     void SetEnabled(bool enabled) { enabled_ = enabled; }
@@ -572,17 +572,17 @@ class MediaPipelineReceiveAudio : public
    public:
     PipelineListener(SourceMediaStream * source, TrackID track_id,
                      const RefPtr<MediaSessionConduit>& conduit);
 
     ~PipelineListener()
     {
       // release conduit on mainthread.  Must use forget()!
       nsresult rv = NS_DispatchToMainThread(new
-        ConduitDeleteEvent(conduit_.forget()), NS_DISPATCH_NORMAL);
+        ConduitDeleteEvent(conduit_.forget()));
       MOZ_ASSERT(!NS_FAILED(rv),"Could not dispatch conduit shutdown to main");
       if (NS_FAILED(rv)) {
         MOZ_CRASH();
       }
     }
 
     // Implement MediaStreamListener
     virtual void NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
--- a/netwerk/base/src/Seer.cpp
+++ b/netwerk/base/src/Seer.cpp
@@ -783,17 +783,17 @@ Seer::EnsureInitStorage()
       NS_LITERAL_CSTRING("CREATE INDEX IF NOT EXISTS redirect_id_index "
                          "ON moz_redirects (id);"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   CommitTransaction();
   BeginTransaction();
 
   nsRefPtr<SeerCommitTimerInitEvent> event = new SeerCommitTimerInitEvent();
-  NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(event);
 
   return NS_OK;
 }
 
 class SeerThreadShutdownRunner : public nsRunnable
 {
 public:
   SeerThreadShutdownRunner(nsIThread *ioThread)
--- a/netwerk/base/src/Tickler.cpp
+++ b/netwerk/base/src/Tickler.cpp
@@ -140,18 +140,17 @@ void Tickler::MaybeStartTicklerUnlocked(
   MaybeStartTickler();
 }
 
 void Tickler::MaybeStartTickler()
 {
   mLock.AssertCurrentThreadOwns();
   if (!NS_IsMainThread()) {
     NS_DispatchToMainThread(
-      NS_NewRunnableMethod(this, &Tickler::MaybeStartTicklerUnlocked),
-      NS_DISPATCH_NORMAL);
+      NS_NewRunnableMethod(this, &Tickler::MaybeStartTicklerUnlocked));
     return;
   }
 
   if (!mPrefs)
     mPrefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (mPrefs) {
     int32_t val;
     bool boolVal;
--- a/netwerk/base/src/nsPACMan.cpp
+++ b/netwerk/base/src/nsPACMan.cpp
@@ -179,17 +179,17 @@ public:
 
     if (mSetupPAC) {
       mSetupPAC = false;
 
       mPACMan->mPAC.Init(mSetupPACURI,
                          mSetupPACData);
 
       nsRefPtr<PACLoadComplete> runnable = new PACLoadComplete(mPACMan);
-      NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(runnable);
       return NS_OK;
     }
 
     mPACMan->ProcessPendingQ();
     return NS_OK;
   }
 
 private:
@@ -221,31 +221,31 @@ PendingPACQuery::PendingPACQuery(nsPACMa
 void
 PendingPACQuery::Complete(nsresult status, const nsCString &pacString)
 {
   if (!mCallback)
     return;
   nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, status);
   runnable->SetPACString(pacString);
   if (mOnMainThreadOnly)
-    NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(runnable);
   else
     runnable->Run();
 }
 
 void
 PendingPACQuery::UseAlternatePACFile(const nsCString &pacURL)
 {
   if (!mCallback)
     return;
 
   nsRefPtr<ExecuteCallback> runnable = new ExecuteCallback(mCallback, NS_OK);
   runnable->SetPACURL(pacURL);
   if (mOnMainThreadOnly)
-    NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(runnable);
   else
     runnable->Run();
 }
 
 NS_IMETHODIMP
 PendingPACQuery::Run()
 {
   NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread");
@@ -267,17 +267,17 @@ nsPACMan::nsPACMan()
 nsPACMan::~nsPACMan()
 {
   if (mPACThread) {
     if (NS_IsMainThread()) {
       mPACThread->Shutdown();
     }
     else {
       nsRefPtr<ShutdownThread> runnable = new ShutdownThread(mPACThread);
-      NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
+      NS_DispatchToMainThread(runnable);
     }
   }
 
   NS_ASSERTION(mLoader == nullptr, "pac man not shutdown properly");
   NS_ASSERTION(mPendingQ.isEmpty(), "pac man not shutdown properly");
 }
 
 void
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1515,17 +1515,17 @@ void nsCacheService::FireClearNetworkCac
 
 NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
 {
     if (storagePolicy == nsICache::STORE_ANYWHERE) {
         // if not called on main thread, dispatch the notification to the main thread to notify observers
         if (!NS_IsMainThread()) { 
             nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this,
                                                                &nsCacheService::FireClearNetworkCacheStoredAnywhereNotification);
-            NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+            NS_DispatchToMainThread(event);
         } else {
             // else you're already on main thread - notify observers
             FireClearNetworkCacheStoredAnywhereNotification(); 
         }
     }
     return EvictEntriesForClient(nullptr, storagePolicy);
 }
 
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -1993,20 +1993,20 @@ nsFtpState::StopProcessing()
             nsCOMPtr<nsIRunnable> alertEvent;
             if (mUseUTF8) {
                 alertEvent = new nsFtpAsyncAlert(prompter,
                     NS_ConvertUTF8toUTF16(mResponseMsg));
             } else {
                 alertEvent = new nsFtpAsyncAlert(prompter,
                     NS_ConvertASCIItoUTF16(mResponseMsg));
             }
-            NS_DispatchToMainThread(alertEvent, NS_DISPATCH_NORMAL);
+            NS_DispatchToMainThread(alertEvent);
         }
     }
-    
+
     nsresult broadcastErrorCode = mControlStatus;
     if (NS_SUCCEEDED(broadcastErrorCode))
         broadcastErrorCode = mInternalError;
 
     mInternalError = broadcastErrorCode;
 
     KillControlConnection();
 
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -532,18 +532,17 @@ WebSocketChannelChild::SendBinaryStream(
   OptionalInputStreamParams *stream = new OptionalInputStreamParams();
   nsTArray<mozilla::ipc::FileDescriptor> fds;
   SerializeInputStream(aStream, *stream, fds);
 
   MOZ_ASSERT(fds.IsEmpty());
 
   if (!NS_IsMainThread()) {
     MOZ_RELEASE_ASSERT(NS_GetCurrentThread() == mTargetThread);
-    return NS_DispatchToMainThread(new BinaryStreamEvent(this, stream, aLength),
-                                   NS_DISPATCH_NORMAL);
+    return NS_DispatchToMainThread(new BinaryStreamEvent(this, stream, aLength));
   }
   return SendBinaryStream(stream, aLength);
 }
 
 nsresult
 WebSocketChannelChild::SendBinaryStream(OptionalInputStreamParams *aStream,
                                         uint32_t aLength)
 {
--- a/toolkit/components/osfile/NativeOSFileInternals.cpp
+++ b/toolkit/components/osfile/NativeOSFileInternals.cpp
@@ -518,17 +518,17 @@ public:
             already_AddRefed<AbstractResult>&& aDiscardedResult,
             int32_t aOSError = 0) {
     Resolve();
     nsRefPtr<ErrorEvent> event = new ErrorEvent(mOnSuccess.forget(),
                                                 mOnError.forget(),
                                                 aDiscardedResult,
                                                 aOperation,
                                                 aOSError);
-    nsresult rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    nsresult rv = NS_DispatchToMainThread(event);
     if (NS_FAILED(rv)) {
       // Last ditch attempt to release on the main thread - some of
       // the members of event are not thread-safe, so letting the
       // pointer go out of scope would cause a crash.
       nsCOMPtr<nsIThread> main = do_GetMainThread();
       NS_ProxyRelease(main, event);
     }
   }
@@ -536,17 +536,17 @@ public:
   /**
    * Succeed, asynchronously.
    */
   void Succeed(already_AddRefed<nsINativeOSFileResult>&& aResult) {
     Resolve();
     nsRefPtr<SuccessEvent> event = new SuccessEvent(mOnSuccess.forget(),
                                                     mOnError.forget(),
                                                     aResult);
-    nsresult rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
+    nsresult rv = NS_DispatchToMainThread(event);
     if (NS_FAILED(rv)) {
       // Last ditch attempt to release on the main thread - some of
       // the members of event are not thread-safe, so letting the
       // pointer go out of scope would cause a crash.
       nsCOMPtr<nsIThread> main = do_GetMainThread();
       NS_ProxyRelease(main, event);
     }
 
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -1064,17 +1064,17 @@ public:
   NS_IMETHOD Run() {
     LoadFailedLockCount(mTelemetry->mFailedLockCount);
     mTelemetry->mLastShutdownTime = 
       ReadLastShutdownDuration(mShutdownTimeFilename);
     mTelemetry->ReadLateWritesStacks(mProfileDir);
     nsCOMPtr<nsIRunnable> e =
       NS_NewRunnableMethod(this, &nsFetchTelemetryData::MainThread);
     NS_ENSURE_STATE(e);
-    NS_DispatchToMainThread(e, NS_DISPATCH_NORMAL);
+    NS_DispatchToMainThread(e);
     return NS_OK;
   }
 
 private:
   nsresult
   LoadFailedLockCount(uint32_t& failedLockCount)
   {
     failedLockCount = 0;
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -125,17 +125,17 @@ nsMemoryImpl::FlushMemory(const char16_t
   // Run the flushers immediately if we can; otherwise, proxy to the
   // UI thread an run 'em asynchronously.
   if (aImmediate) {
     rv = RunFlushers(aReason);
   } else {
     // Don't broadcast more than once every 1000ms to avoid being noisy
     if (PR_IntervalToMicroseconds(now - sLastFlushTime) > 1000) {
       sFlushEvent.mReason = aReason;
-      rv = NS_DispatchToMainThread(&sFlushEvent, NS_DISPATCH_NORMAL);
+      rv = NS_DispatchToMainThread(&sFlushEvent);
     }
   }
 
   sLastFlushTime = now;
   return rv;
 }
 
 nsresult