Browse Source

Backport bug 1430139

Ian Neal 5 months ago
parent
commit
bb303d2166

+ 8 - 8
mozilla-release/patches/1173851-1only-60a1.patch

@@ -3,7 +3,7 @@
 # Date 1518215808 28800
 #      Fri Feb 09 14:36:48 2018 -0800
 # Node ID 2762e7c17577355760587e9e23dcd01bedb82971
-# Parent  bbcb4e41f7e42c17c5d18dfc2eb504b1cba77cef
+# Parent  e7a31a553cdb550e28f5bd4b95cb0b7798453755
 Bug 1173851: rename DataChannel to RTCDataChannel r=jib,smaug
 
 MozReview-Commit-ID: L8OrIlxM7r1
@@ -55,7 +55,7 @@ diff --git a/dom/base/nsDOMDataChannel.h b/dom/base/nsDOMDataChannel.h
 diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
 --- a/dom/bindings/Bindings.conf
 +++ b/dom/bindings/Bindings.conf
-@@ -237,20 +237,16 @@ DOMInterfaces = {
+@@ -231,20 +231,16 @@ DOMInterfaces = {
  'CSSValue': {
      'concrete': False
  },
@@ -76,7 +76,7 @@ diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
  'DeviceAcceleration': {
      'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
  },
-@@ -766,16 +762,20 @@ DOMInterfaces = {
+@@ -755,16 +751,20 @@ DOMInterfaces = {
      'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text',
                             'clone', 'cloneUnfiltered' ],
  },
@@ -93,11 +93,11 @@ diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
      'nativeType': 'nsScreen',
  },
  
- 'ServiceWorker': {
-     'nativeType': 'mozilla::dom::workers::ServiceWorker',
-     'headerFile': 'mozilla/dom/workers/bindings/ServiceWorker.h',
+ 'ServiceWorkerGlobalScope': {
+     'headerFile': 'mozilla/dom/WorkerScope.h',
  },
-@@ -1732,17 +1732,16 @@ def addExternalIface(iface, nativeType=N
+ 
+@@ -1715,17 +1715,16 @@ def addExternalIface(iface, nativeType=N
          domInterface['headerFile'] = headerFile
      domInterface['notflattened'] = notflattened
      DOMInterfaces[iface] = domInterface
@@ -243,7 +243,7 @@ diff --git a/dom/webidl/RTCPeerConnection.webidl b/dom/webidl/RTCPeerConnection.
 diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
 --- a/dom/webidl/moz.build
 +++ b/dom/webidl/moz.build
-@@ -950,23 +950,23 @@ WEBIDL_FILES = [
+@@ -951,23 +951,23 @@ WEBIDL_FILES = [
      'XULCommandEvent.webidl',
      'XULDocument.webidl',
      'XULElement.webidl',

+ 83 - 83
mozilla-release/patches/1193394-1-60a1.patch

@@ -3,7 +3,7 @@
 # Date 1510887687 -28800
 #      Fri Nov 17 11:01:27 2017 +0800
 # Node ID 068c59c7c4ec46802b4a18e98adc227aed6d5da1
-# Parent  45dfe4b8b3e4dfdc1f5983ea9b1dc73593ccfda1
+# Parent  c0f0ba194403ffc348b4f7cb79714ae5d85167fd
 Bug 1193394 - Part 1: Microtasks and promises scheduling. r=bevis
 
 diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp
@@ -240,7 +240,7 @@ diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry
 diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
 --- a/dom/base/nsContentUtils.cpp
 +++ b/dom/base/nsContentUtils.cpp
-@@ -5893,20 +5893,20 @@ void
+@@ -5855,20 +5855,20 @@ void
  nsContentUtils::RunInStableState(already_AddRefed<nsIRunnable> aRunnable)
  {
    MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
@@ -263,7 +263,7 @@ diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
  {
    MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
    return CycleCollectedJSContext::Get()->IsInStableOrMetaStableState();
-@@ -6965,19 +6965,26 @@ nsContentUtils::IsSubDocumentTabbable(ns
+@@ -6927,19 +6927,26 @@ nsContentUtils::IsSubDocumentTabbable(ns
    if (!contentViewer) {
      return false;
    }
@@ -373,7 +373,7 @@ diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver
 diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
 --- a/dom/base/nsGlobalWindow.cpp
 +++ b/dom/base/nsGlobalWindow.cpp
-@@ -13025,22 +13025,16 @@ nsGlobalWindow::RunTimeoutHandler(Timeou
+@@ -13406,22 +13406,16 @@ nsGlobalWindow::RunTimeoutHandler(Timeou
    // Call() on a Function here since we're in a loop
    // where we're likely to be running timeouts whose OS timers
    // didn't fire in time and we don't want to not fire those timers
@@ -841,6 +841,79 @@ diff --git a/dom/script/ScriptSettings.h b/dom/script/ScriptSettings.h
  };
  
  /*
+diff --git a/dom/serviceworkers/ServiceWorkerPrivate.cpp b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+--- a/dom/serviceworkers/ServiceWorkerPrivate.cpp
++++ b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+@@ -327,17 +327,17 @@ public:
+   }
+ 
+   void
+   MaybeDone()
+   {
+     MOZ_ASSERT(mWorkerPrivate);
+     mWorkerPrivate->AssertIsOnWorkerThread();
+ 
+-    if (mPendingPromisesCount) {
++    if (mPendingPromisesCount || !mKeepAliveToken) {
+       return;
+     }
+     if (mCallback) {
+       mCallback->FinishedWithResult(mRejected ? Rejected : Resolved);
+     }
+ 
+     MaybeCleanup();
+   }
+@@ -359,16 +359,28 @@ private:
+     if (mWorkerHolderAdded) {
+       ReleaseWorker();
+     }
+ 
+     mKeepAliveToken = nullptr;
+     mSelfRef = nullptr;
+   }
+ 
++  class MaybeDoneRunner : public MicroTaskRunnable
++  {
++  public:
++    explicit MaybeDoneRunner(KeepAliveHandler* aHandler) : mHandler(aHandler) {}
++    virtual void Run(AutoSlowOperation& aAso) override
++    {
++      mHandler->MaybeDone();
++    }
++
++    RefPtr<KeepAliveHandler> mHandler;
++  };
++
+   void
+   RemovePromise(ExtendableEventResult aResult)
+   {
+     MOZ_ASSERT(mWorkerPrivate);
+     mWorkerPrivate->AssertIsOnWorkerThread();
+     MOZ_DIAGNOSTIC_ASSERT(mPendingPromisesCount > 0);
+ 
+     // Note: mSelfRef and mKeepAliveToken can be nullptr here
+@@ -382,20 +394,17 @@ private:
+     --mPendingPromisesCount;
+     if (mPendingPromisesCount) {
+       return;
+     }
+ 
+     CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+     MOZ_ASSERT(cx);
+ 
+-    RefPtr<nsIRunnable> r =
+-      NewRunnableMethod("dom::KeepAliveHandler::MaybeDone",
+-                        this,
+-                        &KeepAliveHandler::MaybeDone);
++    RefPtr<MaybeDoneRunner> r = new MaybeDoneRunner(this);
+     cx->DispatchToMicroTask(r.forget());
+   }
+ };
+ 
+ NS_IMPL_ISUPPORTS0(KeepAliveHandler)
+ 
+ class RegistrationUpdateRunnable : public Runnable
+ {
 diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
 --- a/dom/workers/RuntimeService.cpp
 +++ b/dom/workers/RuntimeService.cpp
@@ -926,83 +999,10 @@ diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
  private:
    WorkerPrivate* mWorkerPrivate;
  };
-diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/workers/ServiceWorkerPrivate.cpp
---- a/dom/workers/ServiceWorkerPrivate.cpp
-+++ b/dom/workers/ServiceWorkerPrivate.cpp
-@@ -321,17 +321,17 @@ public:
-   }
- 
-   void
-   MaybeDone()
-   {
-     MOZ_ASSERT(mWorkerPrivate);
-     mWorkerPrivate->AssertIsOnWorkerThread();
- 
--    if (mPendingPromisesCount) {
-+    if (mPendingPromisesCount || !mKeepAliveToken) {
-       return;
-     }
-     if (mCallback) {
-       mCallback->FinishedWithResult(mRejected ? Rejected : Resolved);
-     }
- 
-     MaybeCleanup();
-   }
-@@ -353,16 +353,28 @@ private:
-     if (mWorkerHolderAdded) {
-       ReleaseWorker();
-     }
- 
-     mKeepAliveToken = nullptr;
-     mSelfRef = nullptr;
-   }
- 
-+  class MaybeDoneRunner : public MicroTaskRunnable
-+  {
-+  public:
-+    explicit MaybeDoneRunner(KeepAliveHandler* aHandler) : mHandler(aHandler) {}
-+    virtual void Run(AutoSlowOperation& aAso) override
-+    {
-+      mHandler->MaybeDone();
-+    }
-+
-+    RefPtr<KeepAliveHandler> mHandler;
-+  };
-+
-   void
-   RemovePromise(ExtendableEventResult aResult)
-   {
-     MOZ_ASSERT(mWorkerPrivate);
-     mWorkerPrivate->AssertIsOnWorkerThread();
-     MOZ_DIAGNOSTIC_ASSERT(mPendingPromisesCount > 0);
- 
-     // Note: mSelfRef and mKeepAliveToken can be nullptr here
-@@ -376,20 +388,17 @@ private:
-     --mPendingPromisesCount;
-     if (mPendingPromisesCount) {
-       return;
-     }
- 
-     CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
-     MOZ_ASSERT(cx);
- 
--    RefPtr<nsIRunnable> r =
--      NewRunnableMethod("dom::workers::KeepAliveHandler::MaybeDone",
--                        this,
--                        &KeepAliveHandler::MaybeDone);
-+    RefPtr<MaybeDoneRunner> r = new MaybeDoneRunner(this);
-     cx->DispatchToMicroTask(r.forget());
-   }
- };
- 
- NS_IMPL_ISUPPORTS0(KeepAliveHandler)
- 
- class RegistrationUpdateRunnable : public Runnable
- {
 diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
 --- a/dom/workers/WorkerPrivate.cpp
 +++ b/dom/workers/WorkerPrivate.cpp
-@@ -5171,18 +5171,20 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
+@@ -5173,18 +5173,20 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
          mDebuggerQueue.Pop(runnable);
          debuggerRunnablesPending = !mDebuggerQueue.IsEmpty();
        }
@@ -1025,7 +1025,7 @@ diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
          // Now *might* be a good time to GC. Let the JS engine make the decision.
          JSAutoCompartment ac(aCx, globalScope->GetGlobalJSObject());
          JS_MaybeGC(aCx);
-@@ -6145,28 +6147,32 @@ WorkerPrivate::EnterDebuggerEventLoop()
+@@ -6258,28 +6260,32 @@ WorkerPrivate::EnterDebuggerEventLoop()
      if (!debuggerRunnablesPending) {
        SetGCTimerMode(IdleTimer);
      }
@@ -1061,7 +1061,7 @@ diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
        WorkerRunnable* runnable = nullptr;
  
        {
-@@ -6174,18 +6180,20 @@ WorkerPrivate::EnterDebuggerEventLoop()
+@@ -6287,18 +6293,20 @@ WorkerPrivate::EnterDebuggerEventLoop()
  
          mDebuggerQueue.Pop(runnable);
        }
@@ -1084,7 +1084,7 @@ diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
      }
    }
  }
-@@ -6590,18 +6598,18 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
+@@ -6703,18 +6711,18 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
      if (info->mIsInterval) {
        reason = "setInterval handler";
      } else {
@@ -1105,7 +1105,7 @@ diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
        const char* filename = nullptr;
        uint32_t lineNo = 0, dummyColumn = 0;
        info->mHandler->GetLocation(&filename, &lineNo, &dummyColumn);
-@@ -6626,20 +6634,16 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
+@@ -6739,20 +6747,16 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
          rv.SuppressException();
          retval = false;
          break;
@@ -1129,7 +1129,7 @@ diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
 diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
 --- a/js/xpconnect/src/XPCJSContext.cpp
 +++ b/js/xpconnect/src/XPCJSContext.cpp
-@@ -1224,31 +1224,16 @@ XPCJSContext::NewXPCJSContext(XPCJSConte
+@@ -1231,31 +1231,16 @@ XPCJSContext::NewXPCJSContext(XPCJSConte
      MOZ_CRASH("new XPCJSContext failed to initialize.");
  }
  

+ 11 - 11
mozilla-release/patches/1252998-01-61a1.patch

@@ -2,7 +2,7 @@
 # User Andrea Marchesini <amarchesini@mozilla.com>
 # Date 1524068350 -7200
 # Node ID 558fef850d425f13465fe7b8ec0fd249d1527981
-# Parent  0ba938d86ee9eda261242f3409fa8bcf094f3881
+# Parent  eab2041da3fc187d35c8715b4683d49d2526d484
 Bug 1252998 - StorageActivityService - part 1 - Introduce StorageActivityService to monitor origin activities, r=asuth
 
 diff --git a/dom/interfaces/storage/moz.build b/dom/interfaces/storage/moz.build
@@ -379,14 +379,14 @@ diff --git a/dom/storage/moz.build b/dom/storage/moz.build
 diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp
 --- a/ipc/glue/BackgroundParentImpl.cpp
 +++ b/ipc/glue/BackgroundParentImpl.cpp
-@@ -19,16 +19,17 @@
- #include "mozilla/dom/FileSystemBase.h"
+@@ -20,16 +20,17 @@
  #include "mozilla/dom/FileSystemRequestParent.h"
  #include "mozilla/dom/GamepadEventChannelParent.h"
  #include "mozilla/dom/GamepadTestChannelParent.h"
  #include "mozilla/dom/PGamepadEventChannelParent.h"
  #include "mozilla/dom/PGamepadTestChannelParent.h"
  #include "mozilla/dom/MessagePortParent.h"
+ #include "mozilla/dom/ServiceWorkerManagerParent.h"
  #include "mozilla/dom/ServiceWorkerRegistrar.h"
 +#include "mozilla/dom/StorageActivityService.h"
  #include "mozilla/dom/asmjscache/AsmJSCache.h"
@@ -397,7 +397,7 @@ diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.c
  #include "mozilla/dom/ipc/TemporaryIPCBlobParent.h"
  #include "mozilla/dom/quota/ActorsParent.h"
  #include "mozilla/dom/StorageIPC.h"
-@@ -983,16 +984,23 @@ BackgroundParentImpl::DeallocPClientMana
+@@ -981,16 +982,23 @@ BackgroundParentImpl::DeallocPClientMana
  
  mozilla::ipc::IPCResult
  BackgroundParentImpl::RecvPClientManagerConstructor(mozilla::dom::PClientManagerParent* aActor)
@@ -486,17 +486,16 @@ diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h
 diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
 --- a/layout/build/nsLayoutModule.cpp
 +++ b/layout/build/nsLayoutModule.cpp
-@@ -80,16 +80,17 @@
- #include "nsZipArchive.h"
+@@ -81,16 +81,17 @@
  #include "mozilla/Attributes.h"
  #include "mozilla/dom/DOMException.h"
  #include "mozilla/dom/DOMRequest.h"
  #include "mozilla/dom/LocalStorageManager.h"
  #include "mozilla/dom/network/UDPSocketChild.h"
  #include "mozilla/dom/quota/QuotaManagerService.h"
+ #include "mozilla/dom/ServiceWorkerManager.h"
  #include "mozilla/dom/SessionStorageManager.h"
 +#include "mozilla/dom/StorageActivityService.h"
- #include "mozilla/dom/workers/ServiceWorkerManager.h"
  #include "mozilla/dom/workers/WorkerDebuggerManager.h"
  #include "mozilla/dom/Notification.h"
  #include "mozilla/OSFileConstants.h"
@@ -504,7 +503,8 @@ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
  
  #ifdef MOZ_WEBSPEECH_TEST_BACKEND
  #include "mozilla/dom/FakeSpeechRecognitionService.h"
-@@ -211,16 +212,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(SessionSt
+ #endif
+@@ -210,16 +211,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(SessionSt
  NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
                                           DOMRequestService::FactoryCreate)
  NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManagerService,
@@ -523,7 +523,7 @@ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
  
  NS_GENERIC_FACTORY_CONSTRUCTOR(AudioChannelAgent)
  
-@@ -570,16 +573,17 @@ NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CI
+@@ -569,16 +572,17 @@ NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CI
  NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
  NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
  NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
@@ -541,7 +541,7 @@ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
  NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID);
  NS_DEFINE_NAMED_CID(NS_EDITORCOMMANDTABLE_CID);
  NS_DEFINE_NAMED_CID(NS_EDITINGCOMMANDTABLE_CID);
-@@ -817,16 +821,17 @@ static const mozilla::Module::CIDEntry k
+@@ -816,16 +820,17 @@ static const mozilla::Module::CIDEntry k
    { &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor },
    { &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, SessionStorageManagerConstructor },
    { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor },
@@ -559,7 +559,7 @@ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
    { &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor },
    { &kNS_EDITORCOMMANDTABLE_CID, false, nullptr, nsEditorCommandTableConstructor },
    { &kNS_EDITINGCOMMANDTABLE_CID, false, nullptr, nsEditingCommandTableConstructor },
-@@ -934,16 +939,17 @@ static const mozilla::Module::ContractID
+@@ -933,16 +938,17 @@ static const mozilla::Module::ContractID
    // Keeping the old ContractID for backward compatibility
    { "@mozilla.org/dom/storagemanager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
    { "@mozilla.org/dom/sessionStorage-manager;1", &kNS_DOMSESSIONSTORAGEMANAGER_CID },

+ 10 - 10
mozilla-release/patches/1252998-03-61a1.patch

@@ -2,19 +2,19 @@
 # User Andrea Marchesini <amarchesini@mozilla.com>
 # Date 1524068351 -7200
 # Node ID 903099bf9c40214362e91f6a375d900dc1a23e79
-# Parent  7d077f50e8deca1c307a8f77a8f71875467b324c
+# Parent  f02e8d9627d853f38075bb7c947329aa4b938b30
 Bug 1252998 - StorageActivityService - part 3 - ServiceWorkerManager must not cleanup data when purge-session-history notification is dispatched, r=asuth
 
-diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
---- a/dom/workers/ServiceWorkerManager.cpp
-+++ b/dom/workers/ServiceWorkerManager.cpp
-@@ -92,17 +92,16 @@
- 
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
+@@ -95,17 +95,16 @@
  using namespace mozilla;
  using namespace mozilla::dom;
  using namespace mozilla::ipc;
  
- BEGIN_WORKERS_NAMESPACE
+ namespace mozilla {
+ namespace dom {
  
  #define PURGE_DOMAIN_DATA "browser:purge-domain-data"
 -#define PURGE_SESSION_HISTORY "browser:purge-session-history"
@@ -26,7 +26,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
                "RequestMode enumeration value should match Necko CORS mode value.");
  static_assert(nsIHttpChannelInternal::CORS_MODE_CORS == static_cast<uint32_t>(RequestMode::Cors),
                "RequestMode enumeration value should match Necko CORS mode value.");
-@@ -282,18 +281,16 @@ ServiceWorkerManager::Init(ServiceWorker
+@@ -285,18 +284,16 @@ ServiceWorkerManager::Init(ServiceWorker
      MOZ_DIAGNOSTIC_ASSERT(aRegistrar);
  
      nsTArray<ServiceWorkerRegistrationData> data;
@@ -45,7 +45,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
    }
  
    PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
-@@ -337,17 +334,16 @@ ServiceWorkerManager::MaybeStartShutdown
+@@ -409,17 +406,16 @@ ServiceWorkerManager::MaybeStartShutdown
      it1.UserData()->mJobQueues.Clear();
    }
  
@@ -63,7 +63,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
    if (!mActor) {
      return;
    }
-@@ -3838,23 +3834,16 @@ ServiceWorkerManager::ShouldReportToWind
+@@ -3388,23 +3384,16 @@ ServiceWorkerManager::RemoveListener(nsI
    return NS_OK;
  }
  

+ 11 - 11
mozilla-release/patches/1252998-04-61a1.patch

@@ -2,7 +2,7 @@
 # User Andrea Marchesini <amarchesini@mozilla.com>
 # Date 1524068352 -7200
 # Node ID f60bc2fa25660c571283eb63c3475aff4566f2ac
-# Parent  8dd13dd29d68f9f3f29cc9461ec2a32245f9739e
+# Parent  313adff3650da9454622a05349bf71f80303b33a
 Bug 1252998 - StorageActivityService - part 4 - Introduce ServiceWorkerCleanUp.jsm to clean up ServiceWorker data, r=asuth
 
 diff --git a/browser/components/extensions/ext-browsingData.js b/browser/components/extensions/ext-browsingData.js
@@ -282,17 +282,17 @@ diff --git a/dom/interfaces/base/nsIServiceWorkerManager.idl b/dom/interfaces/ba
  
    // It calls softUpdate() for each child process.
    [implicit_jscontext] void propagateSoftUpdate(in jsval aOriginAttributes,
-diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
---- a/dom/workers/ServiceWorkerManager.cpp
-+++ b/dom/workers/ServiceWorkerManager.cpp
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
 @@ -94,17 +94,16 @@
- #endif
  
  using namespace mozilla;
  using namespace mozilla::dom;
  using namespace mozilla::ipc;
  
- BEGIN_WORKERS_NAMESPACE
+ namespace mozilla {
+ namespace dom {
  
 -#define PURGE_DOMAIN_DATA "browser:purge-domain-data"
  #define CLEAR_ORIGIN_DATA "clear-origin-attributes-data"
@@ -360,7 +360,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
  void
  ServiceWorkerManager::Remove(const nsACString& aHost)
  {
-   AssertIsOnMainThread();
+   MOZ_ASSERT(NS_IsMainThread());
  
    for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
      ServiceWorkerManager::RegistrationDataPerPrincipal* data = it1.UserData();
@@ -389,15 +389,15 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
      RemoveAllRegistrations(&pattern);
      return NS_OK;
    }
-diff --git a/dom/workers/test/serviceworkers/test_sanitize_domain.html b/dom/workers/test/serviceworkers/test_sanitize_domain.html
---- a/dom/workers/test/serviceworkers/test_sanitize_domain.html
-+++ b/dom/workers/test/serviceworkers/test_sanitize_domain.html
+diff --git a/dom/serviceworkers/test/test_sanitize_domain.html b/dom/serviceworkers/test/test_sanitize_domain.html
+--- a/dom/serviceworkers/test/test_sanitize_domain.html
++++ b/dom/serviceworkers/test/test_sanitize_domain.html
 @@ -33,17 +33,17 @@
        });
      }
  
      registerSW().then(function() {
-       return testFrame("http://example.com/tests/dom/workers/test/serviceworkers/sanitize/frame.html").then(function(body) {
+       return testFrame("http://example.com/tests/dom/serviceworkers/test/sanitize/frame.html").then(function(body) {
          is(body, "intercepted", "Expected serviceworker to intercept request");
        });
      }).then(function() {

+ 4 - 4
mozilla-release/patches/1252998-06-61a1.patch

@@ -2,12 +2,12 @@
 # User Andrea Marchesini <amarchesini@mozilla.com>
 # Date 1524068353 -7200
 # Node ID 185d6fcf4eee894e3a062b21bfddd899f5ef0ba7
-# Parent  2f8894155abb0e331b6b422da66c97e7d1d6e086
+# Parent  1e724d4ee4c4ec0abb18af174cdfa6238710bee9
 Bug 1252998 - StorageActivityService - part 6 - StorageActivityService in ServiceWorkerRegistrar, r=asuth
 
-diff --git a/dom/workers/ServiceWorkerRegistrar.cpp b/dom/workers/ServiceWorkerRegistrar.cpp
---- a/dom/workers/ServiceWorkerRegistrar.cpp
-+++ b/dom/workers/ServiceWorkerRegistrar.cpp
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrar.cpp b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistrar.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
 @@ -14,16 +14,17 @@
  #include "nsILineInputStream.h"
  #include "nsIObserverService.h"

+ 1603 - 0
mozilla-release/patches/1430139-1-60a1.patch

@@ -0,0 +1,1603 @@
+# HG changeset patch
+# User Ben Kelly <ben@wanderview.com>
+# Date 1517000937 28800
+# Node ID 5cbdc4e31b0f42029113f1f4bde8d8a6d31a6475
+# Parent  dbe58279d95a1616e0665f836cbdd0a15327b5ef
+Bug 1430139 P1 Move code, tests, and moz.build rules to dom/serviceworkers. r=asuth
+
+diff --git a/.eslintignore b/.eslintignore
+--- a/.eslintignore
++++ b/.eslintignore
+@@ -260,16 +260,17 @@ dom/secureelement/**
+ dom/security/test/contentverifier/**
+ dom/security/test/cors/**
+ dom/security/test/csp/**
+ dom/security/test/general/**
+ dom/security/test/hsts/**
+ dom/security/test/mixedcontentblocker/**
+ dom/security/test/sri/**
+ dom/security/test/unit/**
++dom/serviceworkers/**
+ dom/smil/**
+ dom/storage/**
+ dom/svg/**
+ dom/system/**
+ dom/tests/browser/**
+ dom/tests/html/**
+ dom/tests/js/**
+ dom/tests/mochitest/**
+diff --git a/dom/moz.build b/dom/moz.build
+--- a/dom/moz.build
++++ b/dom/moz.build
+@@ -101,16 +101,17 @@ DIRS += [
+     'console',
+     'performance',
+     'webbrowserpersist',
+     'xhr',
+     'worklet',
+     'script',
+     'payments',
+     'websocket',
++    'serviceworkers',
+ ]
+ 
+ TEST_DIRS += [
+     'tests',
+     'imptests',
+ ]
+ 
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'cocoa', 'windows'):
+diff --git a/dom/workers/IPCServiceWorkerDescriptor.ipdlh b/dom/serviceworkers/IPCServiceWorkerDescriptor.ipdlh
+rename from dom/workers/IPCServiceWorkerDescriptor.ipdlh
+rename to dom/serviceworkers/IPCServiceWorkerDescriptor.ipdlh
+diff --git a/dom/workers/PServiceWorkerManager.ipdl b/dom/serviceworkers/PServiceWorkerManager.ipdl
+rename from dom/workers/PServiceWorkerManager.ipdl
+rename to dom/serviceworkers/PServiceWorkerManager.ipdl
+diff --git a/dom/workers/PServiceWorkerUpdater.ipdl b/dom/serviceworkers/PServiceWorkerUpdater.ipdl
+rename from dom/workers/PServiceWorkerUpdater.ipdl
+rename to dom/serviceworkers/PServiceWorkerUpdater.ipdl
+diff --git a/dom/workers/ServiceWorker.cpp b/dom/serviceworkers/ServiceWorker.cpp
+rename from dom/workers/ServiceWorker.cpp
+rename to dom/serviceworkers/ServiceWorker.cpp
+diff --git a/dom/workers/ServiceWorker.h b/dom/serviceworkers/ServiceWorker.h
+rename from dom/workers/ServiceWorker.h
+rename to dom/serviceworkers/ServiceWorker.h
+diff --git a/dom/workers/ServiceWorkerCommon.h b/dom/serviceworkers/ServiceWorkerCommon.h
+rename from dom/workers/ServiceWorkerCommon.h
+rename to dom/serviceworkers/ServiceWorkerCommon.h
+diff --git a/dom/workers/ServiceWorkerContainer.cpp b/dom/serviceworkers/ServiceWorkerContainer.cpp
+rename from dom/workers/ServiceWorkerContainer.cpp
+rename to dom/serviceworkers/ServiceWorkerContainer.cpp
+diff --git a/dom/workers/ServiceWorkerContainer.h b/dom/serviceworkers/ServiceWorkerContainer.h
+rename from dom/workers/ServiceWorkerContainer.h
+rename to dom/serviceworkers/ServiceWorkerContainer.h
+diff --git a/dom/workers/ServiceWorkerDescriptor.cpp b/dom/serviceworkers/ServiceWorkerDescriptor.cpp
+rename from dom/workers/ServiceWorkerDescriptor.cpp
+rename to dom/serviceworkers/ServiceWorkerDescriptor.cpp
+diff --git a/dom/workers/ServiceWorkerDescriptor.h b/dom/serviceworkers/ServiceWorkerDescriptor.h
+rename from dom/workers/ServiceWorkerDescriptor.h
+rename to dom/serviceworkers/ServiceWorkerDescriptor.h
+diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+rename from dom/workers/ServiceWorkerEvents.cpp
+rename to dom/serviceworkers/ServiceWorkerEvents.cpp
+diff --git a/dom/workers/ServiceWorkerEvents.h b/dom/serviceworkers/ServiceWorkerEvents.h
+rename from dom/workers/ServiceWorkerEvents.h
+rename to dom/serviceworkers/ServiceWorkerEvents.h
+diff --git a/dom/workers/ServiceWorkerIPCUtils.h b/dom/serviceworkers/ServiceWorkerIPCUtils.h
+rename from dom/workers/ServiceWorkerIPCUtils.h
+rename to dom/serviceworkers/ServiceWorkerIPCUtils.h
+diff --git a/dom/workers/ServiceWorkerInfo.cpp b/dom/serviceworkers/ServiceWorkerInfo.cpp
+rename from dom/workers/ServiceWorkerInfo.cpp
+rename to dom/serviceworkers/ServiceWorkerInfo.cpp
+diff --git a/dom/workers/ServiceWorkerInfo.h b/dom/serviceworkers/ServiceWorkerInfo.h
+rename from dom/workers/ServiceWorkerInfo.h
+rename to dom/serviceworkers/ServiceWorkerInfo.h
+diff --git a/dom/workers/ServiceWorkerInterceptController.cpp b/dom/serviceworkers/ServiceWorkerInterceptController.cpp
+rename from dom/workers/ServiceWorkerInterceptController.cpp
+rename to dom/serviceworkers/ServiceWorkerInterceptController.cpp
+diff --git a/dom/workers/ServiceWorkerInterceptController.h b/dom/serviceworkers/ServiceWorkerInterceptController.h
+rename from dom/workers/ServiceWorkerInterceptController.h
+rename to dom/serviceworkers/ServiceWorkerInterceptController.h
+diff --git a/dom/workers/ServiceWorkerJob.cpp b/dom/serviceworkers/ServiceWorkerJob.cpp
+rename from dom/workers/ServiceWorkerJob.cpp
+rename to dom/serviceworkers/ServiceWorkerJob.cpp
+diff --git a/dom/workers/ServiceWorkerJob.h b/dom/serviceworkers/ServiceWorkerJob.h
+rename from dom/workers/ServiceWorkerJob.h
+rename to dom/serviceworkers/ServiceWorkerJob.h
+diff --git a/dom/workers/ServiceWorkerJobQueue.cpp b/dom/serviceworkers/ServiceWorkerJobQueue.cpp
+rename from dom/workers/ServiceWorkerJobQueue.cpp
+rename to dom/serviceworkers/ServiceWorkerJobQueue.cpp
+diff --git a/dom/workers/ServiceWorkerJobQueue.h b/dom/serviceworkers/ServiceWorkerJobQueue.h
+rename from dom/workers/ServiceWorkerJobQueue.h
+rename to dom/serviceworkers/ServiceWorkerJobQueue.h
+diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+rename from dom/workers/ServiceWorkerManager.cpp
+rename to dom/serviceworkers/ServiceWorkerManager.cpp
+diff --git a/dom/workers/ServiceWorkerManager.h b/dom/serviceworkers/ServiceWorkerManager.h
+rename from dom/workers/ServiceWorkerManager.h
+rename to dom/serviceworkers/ServiceWorkerManager.h
+diff --git a/dom/workers/ServiceWorkerManagerChild.cpp b/dom/serviceworkers/ServiceWorkerManagerChild.cpp
+rename from dom/workers/ServiceWorkerManagerChild.cpp
+rename to dom/serviceworkers/ServiceWorkerManagerChild.cpp
+diff --git a/dom/workers/ServiceWorkerManagerChild.h b/dom/serviceworkers/ServiceWorkerManagerChild.h
+rename from dom/workers/ServiceWorkerManagerChild.h
+rename to dom/serviceworkers/ServiceWorkerManagerChild.h
+diff --git a/dom/workers/ServiceWorkerManagerParent.cpp b/dom/serviceworkers/ServiceWorkerManagerParent.cpp
+rename from dom/workers/ServiceWorkerManagerParent.cpp
+rename to dom/serviceworkers/ServiceWorkerManagerParent.cpp
+diff --git a/dom/workers/ServiceWorkerManagerParent.h b/dom/serviceworkers/ServiceWorkerManagerParent.h
+rename from dom/workers/ServiceWorkerManagerParent.h
+rename to dom/serviceworkers/ServiceWorkerManagerParent.h
+diff --git a/dom/workers/ServiceWorkerManagerService.cpp b/dom/serviceworkers/ServiceWorkerManagerService.cpp
+rename from dom/workers/ServiceWorkerManagerService.cpp
+rename to dom/serviceworkers/ServiceWorkerManagerService.cpp
+diff --git a/dom/workers/ServiceWorkerManagerService.h b/dom/serviceworkers/ServiceWorkerManagerService.h
+rename from dom/workers/ServiceWorkerManagerService.h
+rename to dom/serviceworkers/ServiceWorkerManagerService.h
+diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+rename from dom/workers/ServiceWorkerPrivate.cpp
+rename to dom/serviceworkers/ServiceWorkerPrivate.cpp
+diff --git a/dom/workers/ServiceWorkerPrivate.h b/dom/serviceworkers/ServiceWorkerPrivate.h
+rename from dom/workers/ServiceWorkerPrivate.h
+rename to dom/serviceworkers/ServiceWorkerPrivate.h
+diff --git a/dom/workers/ServiceWorkerRegisterJob.cpp b/dom/serviceworkers/ServiceWorkerRegisterJob.cpp
+rename from dom/workers/ServiceWorkerRegisterJob.cpp
+rename to dom/serviceworkers/ServiceWorkerRegisterJob.cpp
+diff --git a/dom/workers/ServiceWorkerRegisterJob.h b/dom/serviceworkers/ServiceWorkerRegisterJob.h
+rename from dom/workers/ServiceWorkerRegisterJob.h
+rename to dom/serviceworkers/ServiceWorkerRegisterJob.h
+diff --git a/dom/workers/ServiceWorkerRegistrar.cpp b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+rename from dom/workers/ServiceWorkerRegistrar.cpp
+rename to dom/serviceworkers/ServiceWorkerRegistrar.cpp
+diff --git a/dom/workers/ServiceWorkerRegistrar.h b/dom/serviceworkers/ServiceWorkerRegistrar.h
+rename from dom/workers/ServiceWorkerRegistrar.h
+rename to dom/serviceworkers/ServiceWorkerRegistrar.h
+diff --git a/dom/workers/ServiceWorkerRegistrarTypes.ipdlh b/dom/serviceworkers/ServiceWorkerRegistrarTypes.ipdlh
+rename from dom/workers/ServiceWorkerRegistrarTypes.ipdlh
+rename to dom/serviceworkers/ServiceWorkerRegistrarTypes.ipdlh
+diff --git a/dom/workers/ServiceWorkerRegistration.cpp b/dom/serviceworkers/ServiceWorkerRegistration.cpp
+rename from dom/workers/ServiceWorkerRegistration.cpp
+rename to dom/serviceworkers/ServiceWorkerRegistration.cpp
+diff --git a/dom/workers/ServiceWorkerRegistration.h b/dom/serviceworkers/ServiceWorkerRegistration.h
+rename from dom/workers/ServiceWorkerRegistration.h
+rename to dom/serviceworkers/ServiceWorkerRegistration.h
+diff --git a/dom/workers/ServiceWorkerRegistrationInfo.cpp b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+rename from dom/workers/ServiceWorkerRegistrationInfo.cpp
+rename to dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+diff --git a/dom/workers/ServiceWorkerRegistrationInfo.h b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+rename from dom/workers/ServiceWorkerRegistrationInfo.h
+rename to dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+diff --git a/dom/workers/ServiceWorkerScriptCache.cpp b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+rename from dom/workers/ServiceWorkerScriptCache.cpp
+rename to dom/serviceworkers/ServiceWorkerScriptCache.cpp
+diff --git a/dom/workers/ServiceWorkerScriptCache.h b/dom/serviceworkers/ServiceWorkerScriptCache.h
+rename from dom/workers/ServiceWorkerScriptCache.h
+rename to dom/serviceworkers/ServiceWorkerScriptCache.h
+diff --git a/dom/workers/ServiceWorkerUnregisterJob.cpp b/dom/serviceworkers/ServiceWorkerUnregisterJob.cpp
+rename from dom/workers/ServiceWorkerUnregisterJob.cpp
+rename to dom/serviceworkers/ServiceWorkerUnregisterJob.cpp
+diff --git a/dom/workers/ServiceWorkerUnregisterJob.h b/dom/serviceworkers/ServiceWorkerUnregisterJob.h
+rename from dom/workers/ServiceWorkerUnregisterJob.h
+rename to dom/serviceworkers/ServiceWorkerUnregisterJob.h
+diff --git a/dom/workers/ServiceWorkerUpdateJob.cpp b/dom/serviceworkers/ServiceWorkerUpdateJob.cpp
+rename from dom/workers/ServiceWorkerUpdateJob.cpp
+rename to dom/serviceworkers/ServiceWorkerUpdateJob.cpp
+diff --git a/dom/workers/ServiceWorkerUpdateJob.h b/dom/serviceworkers/ServiceWorkerUpdateJob.h
+rename from dom/workers/ServiceWorkerUpdateJob.h
+rename to dom/serviceworkers/ServiceWorkerUpdateJob.h
+diff --git a/dom/workers/ServiceWorkerUpdaterChild.cpp b/dom/serviceworkers/ServiceWorkerUpdaterChild.cpp
+rename from dom/workers/ServiceWorkerUpdaterChild.cpp
+rename to dom/serviceworkers/ServiceWorkerUpdaterChild.cpp
+diff --git a/dom/workers/ServiceWorkerUpdaterChild.h b/dom/serviceworkers/ServiceWorkerUpdaterChild.h
+rename from dom/workers/ServiceWorkerUpdaterChild.h
+rename to dom/serviceworkers/ServiceWorkerUpdaterChild.h
+diff --git a/dom/workers/ServiceWorkerUpdaterParent.cpp b/dom/serviceworkers/ServiceWorkerUpdaterParent.cpp
+rename from dom/workers/ServiceWorkerUpdaterParent.cpp
+rename to dom/serviceworkers/ServiceWorkerUpdaterParent.cpp
+diff --git a/dom/workers/ServiceWorkerUpdaterParent.h b/dom/serviceworkers/ServiceWorkerUpdaterParent.h
+rename from dom/workers/ServiceWorkerUpdaterParent.h
+rename to dom/serviceworkers/ServiceWorkerUpdaterParent.h
+diff --git a/dom/workers/ServiceWorkerUtils.cpp b/dom/serviceworkers/ServiceWorkerUtils.cpp
+rename from dom/workers/ServiceWorkerUtils.cpp
+rename to dom/serviceworkers/ServiceWorkerUtils.cpp
+diff --git a/dom/workers/ServiceWorkerUtils.h b/dom/serviceworkers/ServiceWorkerUtils.h
+rename from dom/workers/ServiceWorkerUtils.h
+rename to dom/serviceworkers/ServiceWorkerUtils.h
+diff --git a/dom/serviceworkers/moz.build b/dom/serviceworkers/moz.build
+new file mode 100644
+--- /dev/null
++++ b/dom/serviceworkers/moz.build
+@@ -0,0 +1,88 @@
++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
++# vim: set filetype=python:
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++with Files("**"):
++    BUG_COMPONENT = ("Core", "DOM: Service Workers")
++
++# Public stuff.
++EXPORTS.mozilla.dom += [
++    'ServiceWorkerCommon.h',
++    'ServiceWorkerContainer.h',
++    'ServiceWorkerDescriptor.h',
++    'ServiceWorkerEvents.h',
++    'ServiceWorkerInterceptController.h',
++    'ServiceWorkerIPCUtils.h',
++    'ServiceWorkerRegistrar.h',
++    'ServiceWorkerRegistration.h',
++    'ServiceWorkerUtils.h',
++]
++
++EXPORTS.mozilla.dom.workers += [
++    'ServiceWorkerInfo.h',
++    'ServiceWorkerManager.h',
++    'ServiceWorkerManagerChild.h',
++    'ServiceWorkerManagerParent.h',
++    'ServiceWorkerRegistrationInfo.h',
++]
++
++# Stuff needed for the bindings, not really public though.
++EXPORTS.mozilla.dom.workers.bindings += [
++    'ServiceWorker.h',
++]
++
++UNIFIED_SOURCES += [
++    'ServiceWorker.cpp',
++    'ServiceWorkerContainer.cpp',
++    'ServiceWorkerDescriptor.cpp',
++    'ServiceWorkerEvents.cpp',
++    'ServiceWorkerInfo.cpp',
++    'ServiceWorkerInterceptController.cpp',
++    'ServiceWorkerJob.cpp',
++    'ServiceWorkerJobQueue.cpp',
++    'ServiceWorkerManager.cpp',
++    'ServiceWorkerManagerChild.cpp',
++    'ServiceWorkerManagerParent.cpp',
++    'ServiceWorkerManagerService.cpp',
++    'ServiceWorkerPrivate.cpp',
++    'ServiceWorkerRegisterJob.cpp',
++    'ServiceWorkerRegistrar.cpp',
++    'ServiceWorkerRegistration.cpp',
++    'ServiceWorkerRegistrationInfo.cpp',
++    'ServiceWorkerScriptCache.cpp',
++    'ServiceWorkerUnregisterJob.cpp',
++    'ServiceWorkerUpdateJob.cpp',
++    'ServiceWorkerUpdaterChild.cpp',
++    'ServiceWorkerUpdaterParent.cpp',
++    'ServiceWorkerUtils.cpp',
++]
++
++IPDL_SOURCES += [
++    'IPCServiceWorkerDescriptor.ipdlh',
++    'PServiceWorkerManager.ipdl',
++    'PServiceWorkerUpdater.ipdl',
++    'ServiceWorkerRegistrarTypes.ipdlh',
++]
++
++LOCAL_INCLUDES += [
++    '/dom/workers',
++]
++
++include('/ipc/chromium/chromium-config.mozbuild')
++
++FINAL_LIBRARY = 'xul'
++
++MOCHITEST_MANIFESTS += [
++    'test/mochitest.ini',
++]
++
++MOCHITEST_CHROME_MANIFESTS += [
++    'test/chrome.ini',
++]
++
++BROWSER_CHROME_MANIFESTS += [
++    'test/browser.ini',
++    'test/isolated/multi-e10s-update/browser.ini',
++]
+diff --git a/dom/workers/test/serviceworkers/activate_event_error_worker.js b/dom/serviceworkers/test/activate_event_error_worker.js
+rename from dom/workers/test/serviceworkers/activate_event_error_worker.js
+rename to dom/serviceworkers/test/activate_event_error_worker.js
+diff --git a/dom/workers/test/serviceworkers/async_waituntil_worker.js b/dom/serviceworkers/test/async_waituntil_worker.js
+rename from dom/workers/test/serviceworkers/async_waituntil_worker.js
+rename to dom/serviceworkers/test/async_waituntil_worker.js
+diff --git a/dom/workers/test/serviceworkers/blocking_install_event_worker.js b/dom/serviceworkers/test/blocking_install_event_worker.js
+rename from dom/workers/test/serviceworkers/blocking_install_event_worker.js
+rename to dom/serviceworkers/test/blocking_install_event_worker.js
+diff --git a/dom/workers/test/serviceworkers/browser.ini b/dom/serviceworkers/test/browser.ini
+rename from dom/workers/test/serviceworkers/browser.ini
+rename to dom/serviceworkers/test/browser.ini
+diff --git a/dom/workers/test/serviceworkers/browser_base_force_refresh.html b/dom/serviceworkers/test/browser_base_force_refresh.html
+rename from dom/workers/test/serviceworkers/browser_base_force_refresh.html
+rename to dom/serviceworkers/test/browser_base_force_refresh.html
+diff --git a/dom/workers/test/serviceworkers/browser_cached_force_refresh.html b/dom/serviceworkers/test/browser_cached_force_refresh.html
+rename from dom/workers/test/serviceworkers/browser_cached_force_refresh.html
+rename to dom/serviceworkers/test/browser_cached_force_refresh.html
+diff --git a/dom/workers/test/serviceworkers/browser_devtools_serviceworker_interception.js b/dom/serviceworkers/test/browser_devtools_serviceworker_interception.js
+rename from dom/workers/test/serviceworkers/browser_devtools_serviceworker_interception.js
+rename to dom/serviceworkers/test/browser_devtools_serviceworker_interception.js
+diff --git a/dom/workers/test/serviceworkers/browser_download.js b/dom/serviceworkers/test/browser_download.js
+rename from dom/workers/test/serviceworkers/browser_download.js
+rename to dom/serviceworkers/test/browser_download.js
+diff --git a/dom/workers/test/serviceworkers/browser_download_canceled.js b/dom/serviceworkers/test/browser_download_canceled.js
+rename from dom/workers/test/serviceworkers/browser_download_canceled.js
+rename to dom/serviceworkers/test/browser_download_canceled.js
+diff --git a/dom/workers/test/serviceworkers/browser_force_refresh.js b/dom/serviceworkers/test/browser_force_refresh.js
+rename from dom/workers/test/serviceworkers/browser_force_refresh.js
+rename to dom/serviceworkers/test/browser_force_refresh.js
+diff --git a/dom/workers/test/serviceworkers/browser_storage_permission.js b/dom/serviceworkers/test/browser_storage_permission.js
+rename from dom/workers/test/serviceworkers/browser_storage_permission.js
+rename to dom/serviceworkers/test/browser_storage_permission.js
+diff --git a/dom/workers/test/serviceworkers/browser_unregister_with_containers.js b/dom/serviceworkers/test/browser_unregister_with_containers.js
+rename from dom/workers/test/serviceworkers/browser_unregister_with_containers.js
+rename to dom/serviceworkers/test/browser_unregister_with_containers.js
+diff --git a/dom/workers/test/serviceworkers/browser_userContextId_openWindow.js b/dom/serviceworkers/test/browser_userContextId_openWindow.js
+rename from dom/workers/test/serviceworkers/browser_userContextId_openWindow.js
+rename to dom/serviceworkers/test/browser_userContextId_openWindow.js
+diff --git a/dom/workers/test/serviceworkers/bug1151916_driver.html b/dom/serviceworkers/test/bug1151916_driver.html
+rename from dom/workers/test/serviceworkers/bug1151916_driver.html
+rename to dom/serviceworkers/test/bug1151916_driver.html
+diff --git a/dom/workers/test/serviceworkers/bug1151916_worker.js b/dom/serviceworkers/test/bug1151916_worker.js
+rename from dom/workers/test/serviceworkers/bug1151916_worker.js
+rename to dom/serviceworkers/test/bug1151916_worker.js
+diff --git a/dom/workers/test/serviceworkers/bug1240436_worker.js b/dom/serviceworkers/test/bug1240436_worker.js
+rename from dom/workers/test/serviceworkers/bug1240436_worker.js
+rename to dom/serviceworkers/test/bug1240436_worker.js
+diff --git a/dom/workers/test/serviceworkers/bug1290951_worker_imported.sjs b/dom/serviceworkers/test/bug1290951_worker_imported.sjs
+rename from dom/workers/test/serviceworkers/bug1290951_worker_imported.sjs
+rename to dom/serviceworkers/test/bug1290951_worker_imported.sjs
+diff --git a/dom/workers/test/serviceworkers/bug1290951_worker_main.sjs b/dom/serviceworkers/test/bug1290951_worker_main.sjs
+rename from dom/workers/test/serviceworkers/bug1290951_worker_main.sjs
+rename to dom/serviceworkers/test/bug1290951_worker_main.sjs
+diff --git a/dom/workers/test/serviceworkers/chrome.ini b/dom/serviceworkers/test/chrome.ini
+rename from dom/workers/test/serviceworkers/chrome.ini
+rename to dom/serviceworkers/test/chrome.ini
+diff --git a/dom/workers/test/serviceworkers/chrome_helpers.js b/dom/serviceworkers/test/chrome_helpers.js
+rename from dom/workers/test/serviceworkers/chrome_helpers.js
+rename to dom/serviceworkers/test/chrome_helpers.js
+diff --git a/dom/workers/test/serviceworkers/claim_clients/client.html b/dom/serviceworkers/test/claim_clients/client.html
+rename from dom/workers/test/serviceworkers/claim_clients/client.html
+rename to dom/serviceworkers/test/claim_clients/client.html
+diff --git a/dom/workers/test/serviceworkers/claim_oninstall_worker.js b/dom/serviceworkers/test/claim_oninstall_worker.js
+rename from dom/workers/test/serviceworkers/claim_oninstall_worker.js
+rename to dom/serviceworkers/test/claim_oninstall_worker.js
+diff --git a/dom/workers/test/serviceworkers/claim_worker_1.js b/dom/serviceworkers/test/claim_worker_1.js
+rename from dom/workers/test/serviceworkers/claim_worker_1.js
+rename to dom/serviceworkers/test/claim_worker_1.js
+diff --git a/dom/workers/test/serviceworkers/claim_worker_2.js b/dom/serviceworkers/test/claim_worker_2.js
+rename from dom/workers/test/serviceworkers/claim_worker_2.js
+rename to dom/serviceworkers/test/claim_worker_2.js
+diff --git a/dom/workers/test/serviceworkers/close_test.js b/dom/serviceworkers/test/close_test.js
+rename from dom/workers/test/serviceworkers/close_test.js
+rename to dom/serviceworkers/test/close_test.js
+diff --git a/dom/workers/test/serviceworkers/controller/index.html b/dom/serviceworkers/test/controller/index.html
+rename from dom/workers/test/serviceworkers/controller/index.html
+rename to dom/serviceworkers/test/controller/index.html
+diff --git a/dom/workers/test/serviceworkers/create_another_sharedWorker.html b/dom/serviceworkers/test/create_another_sharedWorker.html
+rename from dom/workers/test/serviceworkers/create_another_sharedWorker.html
+rename to dom/serviceworkers/test/create_another_sharedWorker.html
+diff --git a/dom/workers/test/serviceworkers/download/window.html b/dom/serviceworkers/test/download/window.html
+rename from dom/workers/test/serviceworkers/download/window.html
+rename to dom/serviceworkers/test/download/window.html
+diff --git a/dom/workers/test/serviceworkers/download/worker.js b/dom/serviceworkers/test/download/worker.js
+rename from dom/workers/test/serviceworkers/download/worker.js
+rename to dom/serviceworkers/test/download/worker.js
+diff --git a/dom/workers/test/serviceworkers/download_canceled/page_download_canceled.html b/dom/serviceworkers/test/download_canceled/page_download_canceled.html
+rename from dom/workers/test/serviceworkers/download_canceled/page_download_canceled.html
+rename to dom/serviceworkers/test/download_canceled/page_download_canceled.html
+diff --git a/dom/workers/test/serviceworkers/download_canceled/server-stream-download.sjs b/dom/serviceworkers/test/download_canceled/server-stream-download.sjs
+rename from dom/workers/test/serviceworkers/download_canceled/server-stream-download.sjs
+rename to dom/serviceworkers/test/download_canceled/server-stream-download.sjs
+diff --git a/dom/workers/test/serviceworkers/download_canceled/sw_download_canceled.js b/dom/serviceworkers/test/download_canceled/sw_download_canceled.js
+rename from dom/workers/test/serviceworkers/download_canceled/sw_download_canceled.js
+rename to dom/serviceworkers/test/download_canceled/sw_download_canceled.js
+diff --git a/dom/workers/test/serviceworkers/empty.html b/dom/serviceworkers/test/empty.html
+rename from dom/workers/test/serviceworkers/empty.html
+rename to dom/serviceworkers/test/empty.html
+diff --git a/dom/workers/test/serviceworkers/empty.js b/dom/serviceworkers/test/empty.js
+rename from dom/workers/test/serviceworkers/empty.js
+rename to dom/serviceworkers/test/empty.js
+diff --git a/dom/workers/test/serviceworkers/error_reporting_helpers.js b/dom/serviceworkers/test/error_reporting_helpers.js
+rename from dom/workers/test/serviceworkers/error_reporting_helpers.js
+rename to dom/serviceworkers/test/error_reporting_helpers.js
+diff --git a/dom/workers/test/serviceworkers/eval_worker.js b/dom/serviceworkers/test/eval_worker.js
+rename from dom/workers/test/serviceworkers/eval_worker.js
+rename to dom/serviceworkers/test/eval_worker.js
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource.resource b/dom/serviceworkers/test/eventsource/eventsource.resource
+rename from dom/workers/test/serviceworkers/eventsource/eventsource.resource
+rename to dom/serviceworkers/test/eventsource/eventsource.resource
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource.resource^headers^ b/dom/serviceworkers/test/eventsource/eventsource.resource^headers^
+rename from dom/workers/test/serviceworkers/eventsource/eventsource.resource^headers^
+rename to dom/serviceworkers/test/eventsource/eventsource.resource^headers^
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_cors_response.html b/dom/serviceworkers/test/eventsource/eventsource_cors_response.html
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_cors_response.html
+rename to dom/serviceworkers/test/eventsource/eventsource_cors_response.html
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_cors_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_cors_response_intercept_worker.js
+rename to dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_mixed_content_cors_response.html b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_mixed_content_cors_response.html
+rename to dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
+rename to dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_opaque_response.html b/dom/serviceworkers/test/eventsource/eventsource_opaque_response.html
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_opaque_response.html
+rename to dom/serviceworkers/test/eventsource/eventsource_opaque_response.html
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_opaque_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_opaque_response_intercept_worker.js
+rename to dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_register_worker.html b/dom/serviceworkers/test/eventsource/eventsource_register_worker.html
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_register_worker.html
+rename to dom/serviceworkers/test/eventsource/eventsource_register_worker.html
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_synthetic_response.html b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_synthetic_response.html
+rename to dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_synthetic_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_synthetic_response_intercept_worker.js
+rename to dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js
+diff --git a/dom/workers/test/serviceworkers/eventsource/eventsource_worker_helper.js b/dom/serviceworkers/test/eventsource/eventsource_worker_helper.js
+rename from dom/workers/test/serviceworkers/eventsource/eventsource_worker_helper.js
+rename to dom/serviceworkers/test/eventsource/eventsource_worker_helper.js
+diff --git a/dom/workers/test/serviceworkers/fetch.js b/dom/serviceworkers/test/fetch.js
+rename from dom/workers/test/serviceworkers/fetch.js
+rename to dom/serviceworkers/test/fetch.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/beacon.sjs b/dom/serviceworkers/test/fetch/context/beacon.sjs
+rename from dom/workers/test/serviceworkers/fetch/context/beacon.sjs
+rename to dom/serviceworkers/test/fetch/context/beacon.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/context/context_test.js b/dom/serviceworkers/test/fetch/context/context_test.js
+rename from dom/workers/test/serviceworkers/fetch/context/context_test.js
+rename to dom/serviceworkers/test/fetch/context/context_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/csp-violate.sjs b/dom/serviceworkers/test/fetch/context/csp-violate.sjs
+rename from dom/workers/test/serviceworkers/fetch/context/csp-violate.sjs
+rename to dom/serviceworkers/test/fetch/context/csp-violate.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/context/index.html b/dom/serviceworkers/test/fetch/context/index.html
+rename from dom/workers/test/serviceworkers/fetch/context/index.html
+rename to dom/serviceworkers/test/fetch/context/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/context/parentsharedworker.js b/dom/serviceworkers/test/fetch/context/parentsharedworker.js
+rename from dom/workers/test/serviceworkers/fetch/context/parentsharedworker.js
+rename to dom/serviceworkers/test/fetch/context/parentsharedworker.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/parentworker.js b/dom/serviceworkers/test/fetch/context/parentworker.js
+rename from dom/workers/test/serviceworkers/fetch/context/parentworker.js
+rename to dom/serviceworkers/test/fetch/context/parentworker.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/ping.html b/dom/serviceworkers/test/fetch/context/ping.html
+rename from dom/workers/test/serviceworkers/fetch/context/ping.html
+rename to dom/serviceworkers/test/fetch/context/ping.html
+diff --git a/dom/workers/test/serviceworkers/fetch/context/realaudio.ogg b/dom/serviceworkers/test/fetch/context/realaudio.ogg
+rename from dom/workers/test/serviceworkers/fetch/context/realaudio.ogg
+rename to dom/serviceworkers/test/fetch/context/realaudio.ogg
+diff --git a/dom/workers/test/serviceworkers/fetch/context/realimg.jpg b/dom/serviceworkers/test/fetch/context/realimg.jpg
+rename from dom/workers/test/serviceworkers/fetch/context/realimg.jpg
+rename to dom/serviceworkers/test/fetch/context/realimg.jpg
+diff --git a/dom/workers/test/serviceworkers/fetch/context/register.html b/dom/serviceworkers/test/fetch/context/register.html
+rename from dom/workers/test/serviceworkers/fetch/context/register.html
+rename to dom/serviceworkers/test/fetch/context/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/context/sharedworker.js b/dom/serviceworkers/test/fetch/context/sharedworker.js
+rename from dom/workers/test/serviceworkers/fetch/context/sharedworker.js
+rename to dom/serviceworkers/test/fetch/context/sharedworker.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/unregister.html b/dom/serviceworkers/test/fetch/context/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/context/unregister.html
+rename to dom/serviceworkers/test/fetch/context/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/context/worker.js b/dom/serviceworkers/test/fetch/context/worker.js
+rename from dom/workers/test/serviceworkers/fetch/context/worker.js
+rename to dom/serviceworkers/test/fetch/context/worker.js
+diff --git a/dom/workers/test/serviceworkers/fetch/context/xml.xml b/dom/serviceworkers/test/fetch/context/xml.xml
+rename from dom/workers/test/serviceworkers/fetch/context/xml.xml
+rename to dom/serviceworkers/test/fetch/context/xml.xml
+diff --git a/dom/workers/test/serviceworkers/fetch/cookie/cookie_test.js b/dom/serviceworkers/test/fetch/cookie/cookie_test.js
+rename from dom/workers/test/serviceworkers/fetch/cookie/cookie_test.js
+rename to dom/serviceworkers/test/fetch/cookie/cookie_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/cookie/register.html b/dom/serviceworkers/test/fetch/cookie/register.html
+rename from dom/workers/test/serviceworkers/fetch/cookie/register.html
+rename to dom/serviceworkers/test/fetch/cookie/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/cookie/unregister.html b/dom/serviceworkers/test/fetch/cookie/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/cookie/unregister.html
+rename to dom/serviceworkers/test/fetch/cookie/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/deliver-gzip.sjs b/dom/serviceworkers/test/fetch/deliver-gzip.sjs
+rename from dom/workers/test/serviceworkers/fetch/deliver-gzip.sjs
+rename to dom/serviceworkers/test/fetch/deliver-gzip.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/fetch_tests.js b/dom/serviceworkers/test/fetch/fetch_tests.js
+rename from dom/workers/test/serviceworkers/fetch/fetch_tests.js
+rename to dom/serviceworkers/test/fetch/fetch_tests.js
+diff --git a/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js b/dom/serviceworkers/test/fetch/fetch_worker_script.js
+rename from dom/workers/test/serviceworkers/fetch/fetch_worker_script.js
+rename to dom/serviceworkers/test/fetch/fetch_worker_script.js
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/embedder.html b/dom/serviceworkers/test/fetch/hsts/embedder.html
+rename from dom/workers/test/serviceworkers/fetch/hsts/embedder.html
+rename to dom/serviceworkers/test/fetch/hsts/embedder.html
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/hsts_test.js b/dom/serviceworkers/test/fetch/hsts/hsts_test.js
+rename from dom/workers/test/serviceworkers/fetch/hsts/hsts_test.js
+rename to dom/serviceworkers/test/fetch/hsts/hsts_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/image-20px.png b/dom/serviceworkers/test/fetch/hsts/image-20px.png
+rename from dom/workers/test/serviceworkers/fetch/hsts/image-20px.png
+rename to dom/serviceworkers/test/fetch/hsts/image-20px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/image-40px.png b/dom/serviceworkers/test/fetch/hsts/image-40px.png
+rename from dom/workers/test/serviceworkers/fetch/hsts/image-40px.png
+rename to dom/serviceworkers/test/fetch/hsts/image-40px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/image.html b/dom/serviceworkers/test/fetch/hsts/image.html
+rename from dom/workers/test/serviceworkers/fetch/hsts/image.html
+rename to dom/serviceworkers/test/fetch/hsts/image.html
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/realindex.html b/dom/serviceworkers/test/fetch/hsts/realindex.html
+rename from dom/workers/test/serviceworkers/fetch/hsts/realindex.html
+rename to dom/serviceworkers/test/fetch/hsts/realindex.html
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/register.html b/dom/serviceworkers/test/fetch/hsts/register.html
+rename from dom/workers/test/serviceworkers/fetch/hsts/register.html
+rename to dom/serviceworkers/test/fetch/hsts/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/register.html^headers^ b/dom/serviceworkers/test/fetch/hsts/register.html^headers^
+rename from dom/workers/test/serviceworkers/fetch/hsts/register.html^headers^
+rename to dom/serviceworkers/test/fetch/hsts/register.html^headers^
+diff --git a/dom/workers/test/serviceworkers/fetch/hsts/unregister.html b/dom/serviceworkers/test/fetch/hsts/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/hsts/unregister.html
+rename to dom/serviceworkers/test/fetch/hsts/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/clonedresponse/https_test.js b/dom/serviceworkers/test/fetch/https/clonedresponse/https_test.js
+rename from dom/workers/test/serviceworkers/fetch/https/clonedresponse/https_test.js
+rename to dom/serviceworkers/test/fetch/https/clonedresponse/https_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/https/clonedresponse/index.html b/dom/serviceworkers/test/fetch/https/clonedresponse/index.html
+rename from dom/workers/test/serviceworkers/fetch/https/clonedresponse/index.html
+rename to dom/serviceworkers/test/fetch/https/clonedresponse/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/clonedresponse/register.html b/dom/serviceworkers/test/fetch/https/clonedresponse/register.html
+rename from dom/workers/test/serviceworkers/fetch/https/clonedresponse/register.html
+rename to dom/serviceworkers/test/fetch/https/clonedresponse/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/clonedresponse/unregister.html b/dom/serviceworkers/test/fetch/https/clonedresponse/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/https/clonedresponse/unregister.html
+rename to dom/serviceworkers/test/fetch/https/clonedresponse/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/https_test.js b/dom/serviceworkers/test/fetch/https/https_test.js
+rename from dom/workers/test/serviceworkers/fetch/https/https_test.js
+rename to dom/serviceworkers/test/fetch/https/https_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/https/index.html b/dom/serviceworkers/test/fetch/https/index.html
+rename from dom/workers/test/serviceworkers/fetch/https/index.html
+rename to dom/serviceworkers/test/fetch/https/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/register.html b/dom/serviceworkers/test/fetch/https/register.html
+rename from dom/workers/test/serviceworkers/fetch/https/register.html
+rename to dom/serviceworkers/test/fetch/https/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/https/unregister.html b/dom/serviceworkers/test/fetch/https/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/https/unregister.html
+rename to dom/serviceworkers/test/fetch/https/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/image-20px.png b/dom/serviceworkers/test/fetch/imagecache-maxage/image-20px.png
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/image-20px.png
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/image-20px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/image-40px.png b/dom/serviceworkers/test/fetch/imagecache-maxage/image-40px.png
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/image-40px.png
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/image-40px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/index.html b/dom/serviceworkers/test/fetch/imagecache-maxage/index.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/index.html
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/maxage_test.js b/dom/serviceworkers/test/fetch/imagecache-maxage/maxage_test.js
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/maxage_test.js
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/maxage_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/register.html b/dom/serviceworkers/test/fetch/imagecache-maxage/register.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/register.html
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache-maxage/unregister.html b/dom/serviceworkers/test/fetch/imagecache-maxage/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache-maxage/unregister.html
+rename to dom/serviceworkers/test/fetch/imagecache-maxage/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/image-20px.png b/dom/serviceworkers/test/fetch/imagecache/image-20px.png
+rename from dom/workers/test/serviceworkers/fetch/imagecache/image-20px.png
+rename to dom/serviceworkers/test/fetch/imagecache/image-20px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/image-40px.png b/dom/serviceworkers/test/fetch/imagecache/image-40px.png
+rename from dom/workers/test/serviceworkers/fetch/imagecache/image-40px.png
+rename to dom/serviceworkers/test/fetch/imagecache/image-40px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/imagecache_test.js b/dom/serviceworkers/test/fetch/imagecache/imagecache_test.js
+rename from dom/workers/test/serviceworkers/fetch/imagecache/imagecache_test.js
+rename to dom/serviceworkers/test/fetch/imagecache/imagecache_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/index.html b/dom/serviceworkers/test/fetch/imagecache/index.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache/index.html
+rename to dom/serviceworkers/test/fetch/imagecache/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/postmortem.html b/dom/serviceworkers/test/fetch/imagecache/postmortem.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache/postmortem.html
+rename to dom/serviceworkers/test/fetch/imagecache/postmortem.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/register.html b/dom/serviceworkers/test/fetch/imagecache/register.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache/register.html
+rename to dom/serviceworkers/test/fetch/imagecache/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/imagecache/unregister.html b/dom/serviceworkers/test/fetch/imagecache/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/imagecache/unregister.html
+rename to dom/serviceworkers/test/fetch/imagecache/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/https_test.js b/dom/serviceworkers/test/fetch/importscript-mixedcontent/https_test.js
+rename from dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/https_test.js
+rename to dom/serviceworkers/test/fetch/importscript-mixedcontent/https_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/register.html b/dom/serviceworkers/test/fetch/importscript-mixedcontent/register.html
+rename from dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/register.html
+rename to dom/serviceworkers/test/fetch/importscript-mixedcontent/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/unregister.html b/dom/serviceworkers/test/fetch/importscript-mixedcontent/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/unregister.html
+rename to dom/serviceworkers/test/fetch/importscript-mixedcontent/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/index.html b/dom/serviceworkers/test/fetch/index.html
+rename from dom/workers/test/serviceworkers/fetch/index.html
+rename to dom/serviceworkers/test/fetch/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/interrupt.sjs b/dom/serviceworkers/test/fetch/interrupt.sjs
+rename from dom/workers/test/serviceworkers/fetch/interrupt.sjs
+rename to dom/serviceworkers/test/fetch/interrupt.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/index-https.sjs b/dom/serviceworkers/test/fetch/origin/https/index-https.sjs
+rename from dom/workers/test/serviceworkers/fetch/origin/https/index-https.sjs
+rename to dom/serviceworkers/test/fetch/origin/https/index-https.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/origin_test.js b/dom/serviceworkers/test/fetch/origin/https/origin_test.js
+rename from dom/workers/test/serviceworkers/fetch/origin/https/origin_test.js
+rename to dom/serviceworkers/test/fetch/origin/https/origin_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/realindex.html b/dom/serviceworkers/test/fetch/origin/https/realindex.html
+rename from dom/workers/test/serviceworkers/fetch/origin/https/realindex.html
+rename to dom/serviceworkers/test/fetch/origin/https/realindex.html
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/realindex.html^headers^ b/dom/serviceworkers/test/fetch/origin/https/realindex.html^headers^
+rename from dom/workers/test/serviceworkers/fetch/origin/https/realindex.html^headers^
+rename to dom/serviceworkers/test/fetch/origin/https/realindex.html^headers^
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/register.html b/dom/serviceworkers/test/fetch/origin/https/register.html
+rename from dom/workers/test/serviceworkers/fetch/origin/https/register.html
+rename to dom/serviceworkers/test/fetch/origin/https/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/https/unregister.html b/dom/serviceworkers/test/fetch/origin/https/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/origin/https/unregister.html
+rename to dom/serviceworkers/test/fetch/origin/https/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/index-to-https.sjs b/dom/serviceworkers/test/fetch/origin/index-to-https.sjs
+rename from dom/workers/test/serviceworkers/fetch/origin/index-to-https.sjs
+rename to dom/serviceworkers/test/fetch/origin/index-to-https.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/index.sjs b/dom/serviceworkers/test/fetch/origin/index.sjs
+rename from dom/workers/test/serviceworkers/fetch/origin/index.sjs
+rename to dom/serviceworkers/test/fetch/origin/index.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/origin_test.js b/dom/serviceworkers/test/fetch/origin/origin_test.js
+rename from dom/workers/test/serviceworkers/fetch/origin/origin_test.js
+rename to dom/serviceworkers/test/fetch/origin/origin_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/realindex.html b/dom/serviceworkers/test/fetch/origin/realindex.html
+rename from dom/workers/test/serviceworkers/fetch/origin/realindex.html
+rename to dom/serviceworkers/test/fetch/origin/realindex.html
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/realindex.html^headers^ b/dom/serviceworkers/test/fetch/origin/realindex.html^headers^
+rename from dom/workers/test/serviceworkers/fetch/origin/realindex.html^headers^
+rename to dom/serviceworkers/test/fetch/origin/realindex.html^headers^
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/register.html b/dom/serviceworkers/test/fetch/origin/register.html
+rename from dom/workers/test/serviceworkers/fetch/origin/register.html
+rename to dom/serviceworkers/test/fetch/origin/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/origin/unregister.html b/dom/serviceworkers/test/fetch/origin/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/origin/unregister.html
+rename to dom/serviceworkers/test/fetch/origin/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/plugin/plugins.html b/dom/serviceworkers/test/fetch/plugin/plugins.html
+rename from dom/workers/test/serviceworkers/fetch/plugin/plugins.html
+rename to dom/serviceworkers/test/fetch/plugin/plugins.html
+diff --git a/dom/workers/test/serviceworkers/fetch/plugin/worker.js b/dom/serviceworkers/test/fetch/plugin/worker.js
+rename from dom/workers/test/serviceworkers/fetch/plugin/worker.js
+rename to dom/serviceworkers/test/fetch/plugin/worker.js
+diff --git a/dom/workers/test/serviceworkers/fetch/real-file.txt b/dom/serviceworkers/test/fetch/real-file.txt
+rename from dom/workers/test/serviceworkers/fetch/real-file.txt
+rename to dom/serviceworkers/test/fetch/real-file.txt
+diff --git a/dom/workers/test/serviceworkers/fetch/redirect.sjs b/dom/serviceworkers/test/fetch/redirect.sjs
+rename from dom/workers/test/serviceworkers/fetch/redirect.sjs
+rename to dom/serviceworkers/test/fetch/redirect.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/index.html b/dom/serviceworkers/test/fetch/requesturl/index.html
+rename from dom/workers/test/serviceworkers/fetch/requesturl/index.html
+rename to dom/serviceworkers/test/fetch/requesturl/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/redirect.sjs b/dom/serviceworkers/test/fetch/requesturl/redirect.sjs
+rename from dom/workers/test/serviceworkers/fetch/requesturl/redirect.sjs
+rename to dom/serviceworkers/test/fetch/requesturl/redirect.sjs
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/redirector.html b/dom/serviceworkers/test/fetch/requesturl/redirector.html
+rename from dom/workers/test/serviceworkers/fetch/requesturl/redirector.html
+rename to dom/serviceworkers/test/fetch/requesturl/redirector.html
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/register.html b/dom/serviceworkers/test/fetch/requesturl/register.html
+rename from dom/workers/test/serviceworkers/fetch/requesturl/register.html
+rename to dom/serviceworkers/test/fetch/requesturl/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/requesturl_test.js b/dom/serviceworkers/test/fetch/requesturl/requesturl_test.js
+rename from dom/workers/test/serviceworkers/fetch/requesturl/requesturl_test.js
+rename to dom/serviceworkers/test/fetch/requesturl/requesturl_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/secret.html b/dom/serviceworkers/test/fetch/requesturl/secret.html
+rename from dom/workers/test/serviceworkers/fetch/requesturl/secret.html
+rename to dom/serviceworkers/test/fetch/requesturl/secret.html
+diff --git a/dom/workers/test/serviceworkers/fetch/requesturl/unregister.html b/dom/serviceworkers/test/fetch/requesturl/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/requesturl/unregister.html
+rename to dom/serviceworkers/test/fetch/requesturl/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/sandbox/index.html b/dom/serviceworkers/test/fetch/sandbox/index.html
+rename from dom/workers/test/serviceworkers/fetch/sandbox/index.html
+rename to dom/serviceworkers/test/fetch/sandbox/index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/sandbox/intercepted_index.html b/dom/serviceworkers/test/fetch/sandbox/intercepted_index.html
+rename from dom/workers/test/serviceworkers/fetch/sandbox/intercepted_index.html
+rename to dom/serviceworkers/test/fetch/sandbox/intercepted_index.html
+diff --git a/dom/workers/test/serviceworkers/fetch/sandbox/register.html b/dom/serviceworkers/test/fetch/sandbox/register.html
+rename from dom/workers/test/serviceworkers/fetch/sandbox/register.html
+rename to dom/serviceworkers/test/fetch/sandbox/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/sandbox/sandbox_test.js b/dom/serviceworkers/test/fetch/sandbox/sandbox_test.js
+rename from dom/workers/test/serviceworkers/fetch/sandbox/sandbox_test.js
+rename to dom/serviceworkers/test/fetch/sandbox/sandbox_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch/sandbox/unregister.html b/dom/serviceworkers/test/fetch/sandbox/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/sandbox/unregister.html
+rename to dom/serviceworkers/test/fetch/sandbox/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/embedder.html b/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/embedder.html
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/embedder.html^headers^ b/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html^headers^
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/embedder.html^headers^
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html^headers^
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/image-20px.png b/dom/serviceworkers/test/fetch/upgrade-insecure/image-20px.png
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/image-20px.png
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/image-20px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/image-40px.png b/dom/serviceworkers/test/fetch/upgrade-insecure/image-40px.png
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/image-40px.png
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/image-40px.png
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/image.html b/dom/serviceworkers/test/fetch/upgrade-insecure/image.html
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/image.html
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/image.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/realindex.html b/dom/serviceworkers/test/fetch/upgrade-insecure/realindex.html
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/realindex.html
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/realindex.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/register.html b/dom/serviceworkers/test/fetch/upgrade-insecure/register.html
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/register.html
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/register.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/unregister.html b/dom/serviceworkers/test/fetch/upgrade-insecure/unregister.html
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/unregister.html
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/unregister.html
+diff --git a/dom/workers/test/serviceworkers/fetch/upgrade-insecure/upgrade-insecure_test.js b/dom/serviceworkers/test/fetch/upgrade-insecure/upgrade-insecure_test.js
+rename from dom/workers/test/serviceworkers/fetch/upgrade-insecure/upgrade-insecure_test.js
+rename to dom/serviceworkers/test/fetch/upgrade-insecure/upgrade-insecure_test.js
+diff --git a/dom/workers/test/serviceworkers/fetch_event_worker.js b/dom/serviceworkers/test/fetch_event_worker.js
+rename from dom/workers/test/serviceworkers/fetch_event_worker.js
+rename to dom/serviceworkers/test/fetch_event_worker.js
+diff --git a/dom/workers/test/serviceworkers/file_blob_response_worker.js b/dom/serviceworkers/test/file_blob_response_worker.js
+rename from dom/workers/test/serviceworkers/file_blob_response_worker.js
+rename to dom/serviceworkers/test/file_blob_response_worker.js
+diff --git a/dom/workers/test/serviceworkers/file_js_cache.html b/dom/serviceworkers/test/file_js_cache.html
+rename from dom/workers/test/serviceworkers/file_js_cache.html
+rename to dom/serviceworkers/test/file_js_cache.html
+diff --git a/dom/workers/test/serviceworkers/file_js_cache.js b/dom/serviceworkers/test/file_js_cache.js
+rename from dom/workers/test/serviceworkers/file_js_cache.js
+rename to dom/serviceworkers/test/file_js_cache.js
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_cleanup.js b/dom/serviceworkers/test/file_js_cache_cleanup.js
+rename from dom/workers/test/serviceworkers/file_js_cache_cleanup.js
+rename to dom/serviceworkers/test/file_js_cache_cleanup.js
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_save_after_load.html b/dom/serviceworkers/test/file_js_cache_save_after_load.html
+rename from dom/workers/test/serviceworkers/file_js_cache_save_after_load.html
+rename to dom/serviceworkers/test/file_js_cache_save_after_load.html
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_save_after_load.js b/dom/serviceworkers/test/file_js_cache_save_after_load.js
+rename from dom/workers/test/serviceworkers/file_js_cache_save_after_load.js
+rename to dom/serviceworkers/test/file_js_cache_save_after_load.js
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_syntax_error.html b/dom/serviceworkers/test/file_js_cache_syntax_error.html
+rename from dom/workers/test/serviceworkers/file_js_cache_syntax_error.html
+rename to dom/serviceworkers/test/file_js_cache_syntax_error.html
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_syntax_error.js b/dom/serviceworkers/test/file_js_cache_syntax_error.js
+rename from dom/workers/test/serviceworkers/file_js_cache_syntax_error.js
+rename to dom/serviceworkers/test/file_js_cache_syntax_error.js
+diff --git a/dom/workers/test/serviceworkers/file_js_cache_with_sri.html b/dom/serviceworkers/test/file_js_cache_with_sri.html
+rename from dom/workers/test/serviceworkers/file_js_cache_with_sri.html
+rename to dom/serviceworkers/test/file_js_cache_with_sri.html
+diff --git a/dom/workers/test/serviceworkers/file_userContextId_openWindow.js b/dom/serviceworkers/test/file_userContextId_openWindow.js
+rename from dom/workers/test/serviceworkers/file_userContextId_openWindow.js
+rename to dom/serviceworkers/test/file_userContextId_openWindow.js
+diff --git a/dom/workers/test/serviceworkers/force_refresh_browser_worker.js b/dom/serviceworkers/test/force_refresh_browser_worker.js
+rename from dom/workers/test/serviceworkers/force_refresh_browser_worker.js
+rename to dom/serviceworkers/test/force_refresh_browser_worker.js
+diff --git a/dom/workers/test/serviceworkers/force_refresh_worker.js b/dom/serviceworkers/test/force_refresh_worker.js
+rename from dom/workers/test/serviceworkers/force_refresh_worker.js
+rename to dom/serviceworkers/test/force_refresh_worker.js
+diff --git a/dom/workers/test/serviceworkers/gzip_redirect_worker.js b/dom/serviceworkers/test/gzip_redirect_worker.js
+rename from dom/workers/test/serviceworkers/gzip_redirect_worker.js
+rename to dom/serviceworkers/test/gzip_redirect_worker.js
+diff --git a/dom/workers/test/serviceworkers/header_checker.sjs b/dom/serviceworkers/test/header_checker.sjs
+rename from dom/workers/test/serviceworkers/header_checker.sjs
+rename to dom/serviceworkers/test/header_checker.sjs
+diff --git a/dom/workers/test/serviceworkers/hello.html b/dom/serviceworkers/test/hello.html
+rename from dom/workers/test/serviceworkers/hello.html
+rename to dom/serviceworkers/test/hello.html
+diff --git a/dom/workers/test/serviceworkers/importscript.sjs b/dom/serviceworkers/test/importscript.sjs
+rename from dom/workers/test/serviceworkers/importscript.sjs
+rename to dom/serviceworkers/test/importscript.sjs
+diff --git a/dom/workers/test/serviceworkers/importscript_worker.js b/dom/serviceworkers/test/importscript_worker.js
+rename from dom/workers/test/serviceworkers/importscript_worker.js
+rename to dom/serviceworkers/test/importscript_worker.js
+diff --git a/dom/workers/test/serviceworkers/install_event_error_worker.js b/dom/serviceworkers/test/install_event_error_worker.js
+rename from dom/workers/test/serviceworkers/install_event_error_worker.js
+rename to dom/serviceworkers/test/install_event_error_worker.js
+diff --git a/dom/workers/test/serviceworkers/install_event_worker.js b/dom/serviceworkers/test/install_event_worker.js
+rename from dom/workers/test/serviceworkers/install_event_worker.js
+rename to dom/serviceworkers/test/install_event_worker.js
+diff --git a/dom/workers/test/serviceworkers/isolated/README.md b/dom/serviceworkers/test/isolated/README.md
+rename from dom/workers/test/serviceworkers/isolated/README.md
+rename to dom/serviceworkers/test/isolated/README.md
+diff --git a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser.ini b/dom/serviceworkers/test/isolated/multi-e10s-update/browser.ini
+rename from dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser.ini
+rename to dom/serviceworkers/test/isolated/multi-e10s-update/browser.ini
+diff --git a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js b/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+rename from dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js
+rename to dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+diff --git a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/file_multie10s_update.html b/dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
+rename from dom/workers/test/serviceworkers/isolated/multi-e10s-update/file_multie10s_update.html
+rename to dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
+diff --git a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/server_multie10s_update.sjs b/dom/serviceworkers/test/isolated/multi-e10s-update/server_multie10s_update.sjs
+rename from dom/workers/test/serviceworkers/isolated/multi-e10s-update/server_multie10s_update.sjs
+rename to dom/serviceworkers/test/isolated/multi-e10s-update/server_multie10s_update.sjs
+diff --git a/dom/workers/test/serviceworkers/lazy_worker.js b/dom/serviceworkers/test/lazy_worker.js
+rename from dom/workers/test/serviceworkers/lazy_worker.js
+rename to dom/serviceworkers/test/lazy_worker.js
+diff --git a/dom/workers/test/serviceworkers/lorem_script.js b/dom/serviceworkers/test/lorem_script.js
+rename from dom/workers/test/serviceworkers/lorem_script.js
+rename to dom/serviceworkers/test/lorem_script.js
+diff --git a/dom/workers/test/serviceworkers/match_all_advanced_worker.js b/dom/serviceworkers/test/match_all_advanced_worker.js
+rename from dom/workers/test/serviceworkers/match_all_advanced_worker.js
+rename to dom/serviceworkers/test/match_all_advanced_worker.js
+diff --git a/dom/workers/test/serviceworkers/match_all_client/match_all_client_id.html b/dom/serviceworkers/test/match_all_client/match_all_client_id.html
+rename from dom/workers/test/serviceworkers/match_all_client/match_all_client_id.html
+rename to dom/serviceworkers/test/match_all_client/match_all_client_id.html
+diff --git a/dom/workers/test/serviceworkers/match_all_client_id_worker.js b/dom/serviceworkers/test/match_all_client_id_worker.js
+rename from dom/workers/test/serviceworkers/match_all_client_id_worker.js
+rename to dom/serviceworkers/test/match_all_client_id_worker.js
+diff --git a/dom/workers/test/serviceworkers/match_all_clients/match_all_controlled.html b/dom/serviceworkers/test/match_all_clients/match_all_controlled.html
+rename from dom/workers/test/serviceworkers/match_all_clients/match_all_controlled.html
+rename to dom/serviceworkers/test/match_all_clients/match_all_controlled.html
+diff --git a/dom/workers/test/serviceworkers/match_all_properties_worker.js b/dom/serviceworkers/test/match_all_properties_worker.js
+rename from dom/workers/test/serviceworkers/match_all_properties_worker.js
+rename to dom/serviceworkers/test/match_all_properties_worker.js
+diff --git a/dom/workers/test/serviceworkers/match_all_worker.js b/dom/serviceworkers/test/match_all_worker.js
+rename from dom/workers/test/serviceworkers/match_all_worker.js
+rename to dom/serviceworkers/test/match_all_worker.js
+diff --git a/dom/workers/test/serviceworkers/message_posting_worker.js b/dom/serviceworkers/test/message_posting_worker.js
+rename from dom/workers/test/serviceworkers/message_posting_worker.js
+rename to dom/serviceworkers/test/message_posting_worker.js
+diff --git a/dom/workers/test/serviceworkers/message_receiver.html b/dom/serviceworkers/test/message_receiver.html
+rename from dom/workers/test/serviceworkers/message_receiver.html
+rename to dom/serviceworkers/test/message_receiver.html
+diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/serviceworkers/test/mochitest.ini
+rename from dom/workers/test/serviceworkers/mochitest.ini
+rename to dom/serviceworkers/test/mochitest.ini
+diff --git a/dom/workers/test/serviceworkers/nofetch_handler_worker.js b/dom/serviceworkers/test/nofetch_handler_worker.js
+rename from dom/workers/test/serviceworkers/nofetch_handler_worker.js
+rename to dom/serviceworkers/test/nofetch_handler_worker.js
+diff --git a/dom/workers/test/serviceworkers/notification/listener.html b/dom/serviceworkers/test/notification/listener.html
+rename from dom/workers/test/serviceworkers/notification/listener.html
+rename to dom/serviceworkers/test/notification/listener.html
+diff --git a/dom/workers/test/serviceworkers/notification/register.html b/dom/serviceworkers/test/notification/register.html
+rename from dom/workers/test/serviceworkers/notification/register.html
+rename to dom/serviceworkers/test/notification/register.html
+diff --git a/dom/workers/test/serviceworkers/notification/unregister.html b/dom/serviceworkers/test/notification/unregister.html
+rename from dom/workers/test/serviceworkers/notification/unregister.html
+rename to dom/serviceworkers/test/notification/unregister.html
+diff --git a/dom/workers/test/serviceworkers/notification_alt/register.html b/dom/serviceworkers/test/notification_alt/register.html
+rename from dom/workers/test/serviceworkers/notification_alt/register.html
+rename to dom/serviceworkers/test/notification_alt/register.html
+diff --git a/dom/workers/test/serviceworkers/notification_alt/unregister.html b/dom/serviceworkers/test/notification_alt/unregister.html
+rename from dom/workers/test/serviceworkers/notification_alt/unregister.html
+rename to dom/serviceworkers/test/notification_alt/unregister.html
+diff --git a/dom/workers/test/serviceworkers/notification_constructor_error.js b/dom/serviceworkers/test/notification_constructor_error.js
+rename from dom/workers/test/serviceworkers/notification_constructor_error.js
+rename to dom/serviceworkers/test/notification_constructor_error.js
+diff --git a/dom/workers/test/serviceworkers/notification_get_sw.js b/dom/serviceworkers/test/notification_get_sw.js
+rename from dom/workers/test/serviceworkers/notification_get_sw.js
+rename to dom/serviceworkers/test/notification_get_sw.js
+diff --git a/dom/workers/test/serviceworkers/notificationclick-otherwindow.html b/dom/serviceworkers/test/notificationclick-otherwindow.html
+rename from dom/workers/test/serviceworkers/notificationclick-otherwindow.html
+rename to dom/serviceworkers/test/notificationclick-otherwindow.html
+diff --git a/dom/workers/test/serviceworkers/notificationclick.html b/dom/serviceworkers/test/notificationclick.html
+rename from dom/workers/test/serviceworkers/notificationclick.html
+rename to dom/serviceworkers/test/notificationclick.html
+diff --git a/dom/workers/test/serviceworkers/notificationclick.js b/dom/serviceworkers/test/notificationclick.js
+rename from dom/workers/test/serviceworkers/notificationclick.js
+rename to dom/serviceworkers/test/notificationclick.js
+diff --git a/dom/workers/test/serviceworkers/notificationclick_focus.html b/dom/serviceworkers/test/notificationclick_focus.html
+rename from dom/workers/test/serviceworkers/notificationclick_focus.html
+rename to dom/serviceworkers/test/notificationclick_focus.html
+diff --git a/dom/workers/test/serviceworkers/notificationclick_focus.js b/dom/serviceworkers/test/notificationclick_focus.js
+rename from dom/workers/test/serviceworkers/notificationclick_focus.js
+rename to dom/serviceworkers/test/notificationclick_focus.js
+diff --git a/dom/workers/test/serviceworkers/notificationclose.html b/dom/serviceworkers/test/notificationclose.html
+rename from dom/workers/test/serviceworkers/notificationclose.html
+rename to dom/serviceworkers/test/notificationclose.html
+diff --git a/dom/workers/test/serviceworkers/notificationclose.js b/dom/serviceworkers/test/notificationclose.js
+rename from dom/workers/test/serviceworkers/notificationclose.js
+rename to dom/serviceworkers/test/notificationclose.js
+diff --git a/dom/workers/test/serviceworkers/notify_loaded.js b/dom/serviceworkers/test/notify_loaded.js
+rename from dom/workers/test/serviceworkers/notify_loaded.js
+rename to dom/serviceworkers/test/notify_loaded.js
+diff --git a/dom/workers/test/serviceworkers/opaque_intercept_worker.js b/dom/serviceworkers/test/opaque_intercept_worker.js
+rename from dom/workers/test/serviceworkers/opaque_intercept_worker.js
+rename to dom/serviceworkers/test/opaque_intercept_worker.js
+diff --git a/dom/workers/test/serviceworkers/openWindow_worker.js b/dom/serviceworkers/test/openWindow_worker.js
+rename from dom/workers/test/serviceworkers/openWindow_worker.js
+rename to dom/serviceworkers/test/openWindow_worker.js
+diff --git a/dom/workers/test/serviceworkers/open_window/client.html b/dom/serviceworkers/test/open_window/client.html
+rename from dom/workers/test/serviceworkers/open_window/client.html
+rename to dom/serviceworkers/test/open_window/client.html
+diff --git a/dom/workers/test/serviceworkers/parse_error_worker.js b/dom/serviceworkers/test/parse_error_worker.js
+rename from dom/workers/test/serviceworkers/parse_error_worker.js
+rename to dom/serviceworkers/test/parse_error_worker.js
+diff --git a/dom/workers/test/serviceworkers/redirect.sjs b/dom/serviceworkers/test/redirect.sjs
+rename from dom/workers/test/serviceworkers/redirect.sjs
+rename to dom/serviceworkers/test/redirect.sjs
+diff --git a/dom/workers/test/serviceworkers/redirect_post.sjs b/dom/serviceworkers/test/redirect_post.sjs
+rename from dom/workers/test/serviceworkers/redirect_post.sjs
+rename to dom/serviceworkers/test/redirect_post.sjs
+diff --git a/dom/workers/test/serviceworkers/redirect_serviceworker.sjs b/dom/serviceworkers/test/redirect_serviceworker.sjs
+rename from dom/workers/test/serviceworkers/redirect_serviceworker.sjs
+rename to dom/serviceworkers/test/redirect_serviceworker.sjs
+diff --git a/dom/workers/test/serviceworkers/register_https.html b/dom/serviceworkers/test/register_https.html
+rename from dom/workers/test/serviceworkers/register_https.html
+rename to dom/serviceworkers/test/register_https.html
+diff --git a/dom/workers/test/serviceworkers/sanitize/example_check_and_unregister.html b/dom/serviceworkers/test/sanitize/example_check_and_unregister.html
+rename from dom/workers/test/serviceworkers/sanitize/example_check_and_unregister.html
+rename to dom/serviceworkers/test/sanitize/example_check_and_unregister.html
+diff --git a/dom/workers/test/serviceworkers/sanitize/frame.html b/dom/serviceworkers/test/sanitize/frame.html
+rename from dom/workers/test/serviceworkers/sanitize/frame.html
+rename to dom/serviceworkers/test/sanitize/frame.html
+diff --git a/dom/workers/test/serviceworkers/sanitize/register.html b/dom/serviceworkers/test/sanitize/register.html
+rename from dom/workers/test/serviceworkers/sanitize/register.html
+rename to dom/serviceworkers/test/sanitize/register.html
+diff --git a/dom/workers/test/serviceworkers/sanitize_worker.js b/dom/serviceworkers/test/sanitize_worker.js
+rename from dom/workers/test/serviceworkers/sanitize_worker.js
+rename to dom/serviceworkers/test/sanitize_worker.js
+diff --git a/dom/workers/test/serviceworkers/scope/scope_worker.js b/dom/serviceworkers/test/scope/scope_worker.js
+rename from dom/workers/test/serviceworkers/scope/scope_worker.js
+rename to dom/serviceworkers/test/scope/scope_worker.js
+diff --git a/dom/workers/test/serviceworkers/script_file_upload.js b/dom/serviceworkers/test/script_file_upload.js
+rename from dom/workers/test/serviceworkers/script_file_upload.js
+rename to dom/serviceworkers/test/script_file_upload.js
+diff --git a/dom/workers/test/serviceworkers/server_file_upload.sjs b/dom/serviceworkers/test/server_file_upload.sjs
+rename from dom/workers/test/serviceworkers/server_file_upload.sjs
+rename to dom/serviceworkers/test/server_file_upload.sjs
+diff --git a/dom/workers/test/serviceworkers/service_worker.js b/dom/serviceworkers/test/service_worker.js
+rename from dom/workers/test/serviceworkers/service_worker.js
+rename to dom/serviceworkers/test/service_worker.js
+diff --git a/dom/workers/test/serviceworkers/service_worker_client.html b/dom/serviceworkers/test/service_worker_client.html
+rename from dom/workers/test/serviceworkers/service_worker_client.html
+rename to dom/serviceworkers/test/service_worker_client.html
+diff --git a/dom/workers/test/serviceworkers/serviceworker.html b/dom/serviceworkers/test/serviceworker.html
+rename from dom/workers/test/serviceworkers/serviceworker.html
+rename to dom/serviceworkers/test/serviceworker.html
+diff --git a/dom/workers/test/serviceworkers/serviceworker_not_sharedworker.js b/dom/serviceworkers/test/serviceworker_not_sharedworker.js
+rename from dom/workers/test/serviceworkers/serviceworker_not_sharedworker.js
+rename to dom/serviceworkers/test/serviceworker_not_sharedworker.js
+diff --git a/dom/workers/test/serviceworkers/serviceworker_wrapper.js b/dom/serviceworkers/test/serviceworker_wrapper.js
+rename from dom/workers/test/serviceworkers/serviceworker_wrapper.js
+rename to dom/serviceworkers/test/serviceworker_wrapper.js
+diff --git a/dom/workers/test/serviceworkers/serviceworkerinfo_iframe.html b/dom/serviceworkers/test/serviceworkerinfo_iframe.html
+rename from dom/workers/test/serviceworkers/serviceworkerinfo_iframe.html
+rename to dom/serviceworkers/test/serviceworkerinfo_iframe.html
+diff --git a/dom/workers/test/serviceworkers/serviceworkermanager_iframe.html b/dom/serviceworkers/test/serviceworkermanager_iframe.html
+rename from dom/workers/test/serviceworkers/serviceworkermanager_iframe.html
+rename to dom/serviceworkers/test/serviceworkermanager_iframe.html
+diff --git a/dom/workers/test/serviceworkers/serviceworkerregistrationinfo_iframe.html b/dom/serviceworkers/test/serviceworkerregistrationinfo_iframe.html
+rename from dom/workers/test/serviceworkers/serviceworkerregistrationinfo_iframe.html
+rename to dom/serviceworkers/test/serviceworkerregistrationinfo_iframe.html
+diff --git a/dom/workers/test/serviceworkers/sharedWorker_fetch.js b/dom/serviceworkers/test/sharedWorker_fetch.js
+rename from dom/workers/test/serviceworkers/sharedWorker_fetch.js
+rename to dom/serviceworkers/test/sharedWorker_fetch.js
+diff --git a/dom/workers/test/serviceworkers/simpleregister/index.html b/dom/serviceworkers/test/simpleregister/index.html
+rename from dom/workers/test/serviceworkers/simpleregister/index.html
+rename to dom/serviceworkers/test/simpleregister/index.html
+diff --git a/dom/workers/test/serviceworkers/simpleregister/ready.html b/dom/serviceworkers/test/simpleregister/ready.html
+rename from dom/workers/test/serviceworkers/simpleregister/ready.html
+rename to dom/serviceworkers/test/simpleregister/ready.html
+diff --git a/dom/workers/test/serviceworkers/skip_waiting_installed_worker.js b/dom/serviceworkers/test/skip_waiting_installed_worker.js
+rename from dom/workers/test/serviceworkers/skip_waiting_installed_worker.js
+rename to dom/serviceworkers/test/skip_waiting_installed_worker.js
+diff --git a/dom/workers/test/serviceworkers/skip_waiting_scope/index.html b/dom/serviceworkers/test/skip_waiting_scope/index.html
+rename from dom/workers/test/serviceworkers/skip_waiting_scope/index.html
+rename to dom/serviceworkers/test/skip_waiting_scope/index.html
+diff --git a/dom/workers/test/serviceworkers/source_message_posting_worker.js b/dom/serviceworkers/test/source_message_posting_worker.js
+rename from dom/workers/test/serviceworkers/source_message_posting_worker.js
+rename to dom/serviceworkers/test/source_message_posting_worker.js
+diff --git a/dom/workers/test/serviceworkers/strict_mode_warning.js b/dom/serviceworkers/test/strict_mode_warning.js
+rename from dom/workers/test/serviceworkers/strict_mode_warning.js
+rename to dom/serviceworkers/test/strict_mode_warning.js
+diff --git a/dom/workers/test/serviceworkers/sw_bad_mime_type.js b/dom/serviceworkers/test/sw_bad_mime_type.js
+rename from dom/workers/test/serviceworkers/sw_bad_mime_type.js
+rename to dom/serviceworkers/test/sw_bad_mime_type.js
+diff --git a/dom/workers/test/serviceworkers/sw_bad_mime_type.js^headers^ b/dom/serviceworkers/test/sw_bad_mime_type.js^headers^
+rename from dom/workers/test/serviceworkers/sw_bad_mime_type.js^headers^
+rename to dom/serviceworkers/test/sw_bad_mime_type.js^headers^
+diff --git a/dom/workers/test/serviceworkers/sw_clients/file_blob_upload_frame.html b/dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html
+rename from dom/workers/test/serviceworkers/sw_clients/file_blob_upload_frame.html
+rename to dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/navigator.html b/dom/serviceworkers/test/sw_clients/navigator.html
+rename from dom/workers/test/serviceworkers/sw_clients/navigator.html
+rename to dom/serviceworkers/test/sw_clients/navigator.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher.html b/dom/serviceworkers/test/sw_clients/refresher.html
+rename from dom/workers/test/serviceworkers/sw_clients/refresher.html
+rename to dom/serviceworkers/test/sw_clients/refresher.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher_cached.html b/dom/serviceworkers/test/sw_clients/refresher_cached.html
+rename from dom/workers/test/serviceworkers/sw_clients/refresher_cached.html
+rename to dom/serviceworkers/test/sw_clients/refresher_cached.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher_cached_compressed.html b/dom/serviceworkers/test/sw_clients/refresher_cached_compressed.html
+rename from dom/workers/test/serviceworkers/sw_clients/refresher_cached_compressed.html
+rename to dom/serviceworkers/test/sw_clients/refresher_cached_compressed.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher_cached_compressed.html^headers^ b/dom/serviceworkers/test/sw_clients/refresher_cached_compressed.html^headers^
+rename from dom/workers/test/serviceworkers/sw_clients/refresher_cached_compressed.html^headers^
+rename to dom/serviceworkers/test/sw_clients/refresher_cached_compressed.html^headers^
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher_compressed.html b/dom/serviceworkers/test/sw_clients/refresher_compressed.html
+rename from dom/workers/test/serviceworkers/sw_clients/refresher_compressed.html
+rename to dom/serviceworkers/test/sw_clients/refresher_compressed.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/refresher_compressed.html^headers^ b/dom/serviceworkers/test/sw_clients/refresher_compressed.html^headers^
+rename from dom/workers/test/serviceworkers/sw_clients/refresher_compressed.html^headers^
+rename to dom/serviceworkers/test/sw_clients/refresher_compressed.html^headers^
+diff --git a/dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html b/dom/serviceworkers/test/sw_clients/service_worker_controlled.html
+rename from dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html
+rename to dom/serviceworkers/test/sw_clients/service_worker_controlled.html
+diff --git a/dom/workers/test/serviceworkers/sw_clients/simple.html b/dom/serviceworkers/test/sw_clients/simple.html
+rename from dom/workers/test/serviceworkers/sw_clients/simple.html
+rename to dom/serviceworkers/test/sw_clients/simple.html
+diff --git a/dom/workers/test/serviceworkers/sw_file_upload.js b/dom/serviceworkers/test/sw_file_upload.js
+rename from dom/workers/test/serviceworkers/sw_file_upload.js
+rename to dom/serviceworkers/test/sw_file_upload.js
+diff --git a/dom/workers/test/serviceworkers/sw_storage_not_allow.js b/dom/serviceworkers/test/sw_storage_not_allow.js
+rename from dom/workers/test/serviceworkers/sw_storage_not_allow.js
+rename to dom/serviceworkers/test/sw_storage_not_allow.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_different.js b/dom/serviceworkers/test/swa/worker_scope_different.js
+rename from dom/workers/test/serviceworkers/swa/worker_scope_different.js
+rename to dom/serviceworkers/test/swa/worker_scope_different.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_different.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_different.js^headers^
+rename from dom/workers/test/serviceworkers/swa/worker_scope_different.js^headers^
+rename to dom/serviceworkers/test/swa/worker_scope_different.js^headers^
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_different2.js b/dom/serviceworkers/test/swa/worker_scope_different2.js
+rename from dom/workers/test/serviceworkers/swa/worker_scope_different2.js
+rename to dom/serviceworkers/test/swa/worker_scope_different2.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_different2.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_different2.js^headers^
+rename from dom/workers/test/serviceworkers/swa/worker_scope_different2.js^headers^
+rename to dom/serviceworkers/test/swa/worker_scope_different2.js^headers^
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_precise.js b/dom/serviceworkers/test/swa/worker_scope_precise.js
+rename from dom/workers/test/serviceworkers/swa/worker_scope_precise.js
+rename to dom/serviceworkers/test/swa/worker_scope_precise.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_precise.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_precise.js^headers^
+rename from dom/workers/test/serviceworkers/swa/worker_scope_precise.js^headers^
+rename to dom/serviceworkers/test/swa/worker_scope_precise.js^headers^
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_too_deep.js b/dom/serviceworkers/test/swa/worker_scope_too_deep.js
+rename from dom/workers/test/serviceworkers/swa/worker_scope_too_deep.js
+rename to dom/serviceworkers/test/swa/worker_scope_too_deep.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_too_deep.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^
+rename from dom/workers/test/serviceworkers/swa/worker_scope_too_deep.js^headers^
+rename to dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_too_narrow.js b/dom/serviceworkers/test/swa/worker_scope_too_narrow.js
+rename from dom/workers/test/serviceworkers/swa/worker_scope_too_narrow.js
+rename to dom/serviceworkers/test/swa/worker_scope_too_narrow.js
+diff --git a/dom/workers/test/serviceworkers/swa/worker_scope_too_narrow.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^
+rename from dom/workers/test/serviceworkers/swa/worker_scope_too_narrow.js^headers^
+rename to dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^
+diff --git a/dom/workers/test/serviceworkers/test_async_waituntil.html b/dom/serviceworkers/test/test_async_waituntil.html
+rename from dom/workers/test/serviceworkers/test_async_waituntil.html
+rename to dom/serviceworkers/test/test_async_waituntil.html
+diff --git a/dom/workers/test/serviceworkers/test_bad_script_cache.html b/dom/serviceworkers/test/test_bad_script_cache.html
+rename from dom/workers/test/serviceworkers/test_bad_script_cache.html
+rename to dom/serviceworkers/test/test_bad_script_cache.html
+diff --git a/dom/workers/test/serviceworkers/test_bug1151916.html b/dom/serviceworkers/test/test_bug1151916.html
+rename from dom/workers/test/serviceworkers/test_bug1151916.html
+rename to dom/serviceworkers/test/test_bug1151916.html
+diff --git a/dom/workers/test/serviceworkers/test_bug1240436.html b/dom/serviceworkers/test/test_bug1240436.html
+rename from dom/workers/test/serviceworkers/test_bug1240436.html
+rename to dom/serviceworkers/test/test_bug1240436.html
+diff --git a/dom/workers/test/serviceworkers/test_bug1408734.html b/dom/serviceworkers/test/test_bug1408734.html
+rename from dom/workers/test/serviceworkers/test_bug1408734.html
+rename to dom/serviceworkers/test/test_bug1408734.html
+diff --git a/dom/workers/test/serviceworkers/test_claim.html b/dom/serviceworkers/test/test_claim.html
+rename from dom/workers/test/serviceworkers/test_claim.html
+rename to dom/serviceworkers/test/test_claim.html
+diff --git a/dom/workers/test/serviceworkers/test_claim_oninstall.html b/dom/serviceworkers/test/test_claim_oninstall.html
+rename from dom/workers/test/serviceworkers/test_claim_oninstall.html
+rename to dom/serviceworkers/test/test_claim_oninstall.html
+diff --git a/dom/workers/test/serviceworkers/test_client_focus.html b/dom/serviceworkers/test/test_client_focus.html
+rename from dom/workers/test/serviceworkers/test_client_focus.html
+rename to dom/serviceworkers/test/test_client_focus.html
+diff --git a/dom/workers/test/serviceworkers/test_controller.html b/dom/serviceworkers/test/test_controller.html
+rename from dom/workers/test/serviceworkers/test_controller.html
+rename to dom/serviceworkers/test/test_controller.html
+diff --git a/dom/workers/test/serviceworkers/test_cookie_fetch.html b/dom/serviceworkers/test/test_cookie_fetch.html
+rename from dom/workers/test/serviceworkers/test_cookie_fetch.html
+rename to dom/serviceworkers/test/test_cookie_fetch.html
+diff --git a/dom/workers/test/serviceworkers/test_cross_origin_url_after_redirect.html b/dom/serviceworkers/test/test_cross_origin_url_after_redirect.html
+rename from dom/workers/test/serviceworkers/test_cross_origin_url_after_redirect.html
+rename to dom/serviceworkers/test/test_cross_origin_url_after_redirect.html
+diff --git a/dom/workers/test/serviceworkers/test_csp_upgrade-insecure_intercept.html b/dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html
+rename from dom/workers/test/serviceworkers/test_csp_upgrade-insecure_intercept.html
+rename to dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html
+diff --git a/dom/workers/test/serviceworkers/test_devtools_bypass_serviceworker.html b/dom/serviceworkers/test/test_devtools_bypass_serviceworker.html
+rename from dom/workers/test/serviceworkers/test_devtools_bypass_serviceworker.html
+rename to dom/serviceworkers/test/test_devtools_bypass_serviceworker.html
+diff --git a/dom/workers/test/serviceworkers/test_devtools_track_serviceworker_time.html b/dom/serviceworkers/test/test_devtools_track_serviceworker_time.html
+rename from dom/workers/test/serviceworkers/test_devtools_track_serviceworker_time.html
+rename to dom/serviceworkers/test/test_devtools_track_serviceworker_time.html
+diff --git a/dom/workers/test/serviceworkers/test_empty_serviceworker.html b/dom/serviceworkers/test/test_empty_serviceworker.html
+rename from dom/workers/test/serviceworkers/test_empty_serviceworker.html
+rename to dom/serviceworkers/test/test_empty_serviceworker.html
+diff --git a/dom/workers/test/serviceworkers/test_error_reporting.html b/dom/serviceworkers/test/test_error_reporting.html
+rename from dom/workers/test/serviceworkers/test_error_reporting.html
+rename to dom/serviceworkers/test/test_error_reporting.html
+diff --git a/dom/workers/test/serviceworkers/test_escapedSlashes.html b/dom/serviceworkers/test/test_escapedSlashes.html
+rename from dom/workers/test/serviceworkers/test_escapedSlashes.html
+rename to dom/serviceworkers/test/test_escapedSlashes.html
+diff --git a/dom/workers/test/serviceworkers/test_eval_allowed.html b/dom/serviceworkers/test/test_eval_allowed.html
+rename from dom/workers/test/serviceworkers/test_eval_allowed.html
+rename to dom/serviceworkers/test/test_eval_allowed.html
+diff --git a/dom/workers/test/serviceworkers/test_eval_allowed.html^headers^ b/dom/serviceworkers/test/test_eval_allowed.html^headers^
+rename from dom/workers/test/serviceworkers/test_eval_allowed.html^headers^
+rename to dom/serviceworkers/test/test_eval_allowed.html^headers^
+diff --git a/dom/workers/test/serviceworkers/test_eventsource_intercept.html b/dom/serviceworkers/test/test_eventsource_intercept.html
+rename from dom/workers/test/serviceworkers/test_eventsource_intercept.html
+rename to dom/serviceworkers/test/test_eventsource_intercept.html
+diff --git a/dom/workers/test/serviceworkers/test_fetch_event.html b/dom/serviceworkers/test/test_fetch_event.html
+rename from dom/workers/test/serviceworkers/test_fetch_event.html
+rename to dom/serviceworkers/test/test_fetch_event.html
+diff --git a/dom/workers/test/serviceworkers/test_fetch_event_with_thirdpartypref.html b/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html
+rename from dom/workers/test/serviceworkers/test_fetch_event_with_thirdpartypref.html
+rename to dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html
+diff --git a/dom/workers/test/serviceworkers/test_fetch_integrity.html b/dom/serviceworkers/test/test_fetch_integrity.html
+rename from dom/workers/test/serviceworkers/test_fetch_integrity.html
+rename to dom/serviceworkers/test/test_fetch_integrity.html
+diff --git a/dom/workers/test/serviceworkers/test_file_blob_response.html b/dom/serviceworkers/test/test_file_blob_response.html
+rename from dom/workers/test/serviceworkers/test_file_blob_response.html
+rename to dom/serviceworkers/test/test_file_blob_response.html
+diff --git a/dom/workers/test/serviceworkers/test_file_blob_upload.html b/dom/serviceworkers/test/test_file_blob_upload.html
+rename from dom/workers/test/serviceworkers/test_file_blob_upload.html
+rename to dom/serviceworkers/test/test_file_blob_upload.html
+diff --git a/dom/workers/test/serviceworkers/test_file_upload.html b/dom/serviceworkers/test/test_file_upload.html
+rename from dom/workers/test/serviceworkers/test_file_upload.html
+rename to dom/serviceworkers/test/test_file_upload.html
+diff --git a/dom/workers/test/serviceworkers/test_force_refresh.html b/dom/serviceworkers/test/test_force_refresh.html
+rename from dom/workers/test/serviceworkers/test_force_refresh.html
+rename to dom/serviceworkers/test/test_force_refresh.html
+diff --git a/dom/workers/test/serviceworkers/test_gzip_redirect.html b/dom/serviceworkers/test/test_gzip_redirect.html
+rename from dom/workers/test/serviceworkers/test_gzip_redirect.html
+rename to dom/serviceworkers/test/test_gzip_redirect.html
+diff --git a/dom/workers/test/serviceworkers/test_hsts_upgrade_intercept.html b/dom/serviceworkers/test/test_hsts_upgrade_intercept.html
+rename from dom/workers/test/serviceworkers/test_hsts_upgrade_intercept.html
+rename to dom/serviceworkers/test/test_hsts_upgrade_intercept.html
+diff --git a/dom/workers/test/serviceworkers/test_https_fetch.html b/dom/serviceworkers/test/test_https_fetch.html
+rename from dom/workers/test/serviceworkers/test_https_fetch.html
+rename to dom/serviceworkers/test/test_https_fetch.html
+diff --git a/dom/workers/test/serviceworkers/test_https_fetch_cloned_response.html b/dom/serviceworkers/test/test_https_fetch_cloned_response.html
+rename from dom/workers/test/serviceworkers/test_https_fetch_cloned_response.html
+rename to dom/serviceworkers/test/test_https_fetch_cloned_response.html
+diff --git a/dom/workers/test/serviceworkers/test_https_origin_after_redirect.html b/dom/serviceworkers/test/test_https_origin_after_redirect.html
+rename from dom/workers/test/serviceworkers/test_https_origin_after_redirect.html
+rename to dom/serviceworkers/test/test_https_origin_after_redirect.html
+diff --git a/dom/workers/test/serviceworkers/test_https_origin_after_redirect_cached.html b/dom/serviceworkers/test/test_https_origin_after_redirect_cached.html
+rename from dom/workers/test/serviceworkers/test_https_origin_after_redirect_cached.html
+rename to dom/serviceworkers/test/test_https_origin_after_redirect_cached.html
+diff --git a/dom/workers/test/serviceworkers/test_https_synth_fetch_from_cached_sw.html b/dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html
+rename from dom/workers/test/serviceworkers/test_https_synth_fetch_from_cached_sw.html
+rename to dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html
+diff --git a/dom/workers/test/serviceworkers/test_imagecache.html b/dom/serviceworkers/test/test_imagecache.html
+rename from dom/workers/test/serviceworkers/test_imagecache.html
+rename to dom/serviceworkers/test/test_imagecache.html
+diff --git a/dom/workers/test/serviceworkers/test_imagecache_max_age.html b/dom/serviceworkers/test/test_imagecache_max_age.html
+rename from dom/workers/test/serviceworkers/test_imagecache_max_age.html
+rename to dom/serviceworkers/test/test_imagecache_max_age.html
+diff --git a/dom/workers/test/serviceworkers/test_importscript.html b/dom/serviceworkers/test/test_importscript.html
+rename from dom/workers/test/serviceworkers/test_importscript.html
+rename to dom/serviceworkers/test/test_importscript.html
+diff --git a/dom/workers/test/serviceworkers/test_importscript_mixedcontent.html b/dom/serviceworkers/test/test_importscript_mixedcontent.html
+rename from dom/workers/test/serviceworkers/test_importscript_mixedcontent.html
+rename to dom/serviceworkers/test/test_importscript_mixedcontent.html
+diff --git a/dom/workers/test/serviceworkers/test_install_event.html b/dom/serviceworkers/test/test_install_event.html
+rename from dom/workers/test/serviceworkers/test_install_event.html
+rename to dom/serviceworkers/test/test_install_event.html
+diff --git a/dom/workers/test/serviceworkers/test_install_event_gc.html b/dom/serviceworkers/test/test_install_event_gc.html
+rename from dom/workers/test/serviceworkers/test_install_event_gc.html
+rename to dom/serviceworkers/test/test_install_event_gc.html
+diff --git a/dom/workers/test/serviceworkers/test_installation_simple.html b/dom/serviceworkers/test/test_installation_simple.html
+rename from dom/workers/test/serviceworkers/test_installation_simple.html
+rename to dom/serviceworkers/test/test_installation_simple.html
+diff --git a/dom/workers/test/serviceworkers/test_match_all.html b/dom/serviceworkers/test/test_match_all.html
+rename from dom/workers/test/serviceworkers/test_match_all.html
+rename to dom/serviceworkers/test/test_match_all.html
+diff --git a/dom/workers/test/serviceworkers/test_match_all_advanced.html b/dom/serviceworkers/test/test_match_all_advanced.html
+rename from dom/workers/test/serviceworkers/test_match_all_advanced.html
+rename to dom/serviceworkers/test/test_match_all_advanced.html
+diff --git a/dom/workers/test/serviceworkers/test_match_all_client_id.html b/dom/serviceworkers/test/test_match_all_client_id.html
+rename from dom/workers/test/serviceworkers/test_match_all_client_id.html
+rename to dom/serviceworkers/test/test_match_all_client_id.html
+diff --git a/dom/workers/test/serviceworkers/test_match_all_client_properties.html b/dom/serviceworkers/test/test_match_all_client_properties.html
+rename from dom/workers/test/serviceworkers/test_match_all_client_properties.html
+rename to dom/serviceworkers/test/test_match_all_client_properties.html
+diff --git a/dom/workers/test/serviceworkers/test_navigator.html b/dom/serviceworkers/test/test_navigator.html
+rename from dom/workers/test/serviceworkers/test_navigator.html
+rename to dom/serviceworkers/test/test_navigator.html
+diff --git a/dom/workers/test/serviceworkers/test_nofetch_handler.html b/dom/serviceworkers/test/test_nofetch_handler.html
+rename from dom/workers/test/serviceworkers/test_nofetch_handler.html
+rename to dom/serviceworkers/test/test_nofetch_handler.html
+diff --git a/dom/workers/test/serviceworkers/test_not_intercept_plugin.html b/dom/serviceworkers/test/test_not_intercept_plugin.html
+rename from dom/workers/test/serviceworkers/test_not_intercept_plugin.html
+rename to dom/serviceworkers/test/test_not_intercept_plugin.html
+diff --git a/dom/workers/test/serviceworkers/test_notification_constructor_error.html b/dom/serviceworkers/test/test_notification_constructor_error.html
+rename from dom/workers/test/serviceworkers/test_notification_constructor_error.html
+rename to dom/serviceworkers/test/test_notification_constructor_error.html
+diff --git a/dom/workers/test/serviceworkers/test_notification_get.html b/dom/serviceworkers/test/test_notification_get.html
+rename from dom/workers/test/serviceworkers/test_notification_get.html
+rename to dom/serviceworkers/test/test_notification_get.html
+diff --git a/dom/workers/test/serviceworkers/test_notificationclick-otherwindow.html b/dom/serviceworkers/test/test_notificationclick-otherwindow.html
+rename from dom/workers/test/serviceworkers/test_notificationclick-otherwindow.html
+rename to dom/serviceworkers/test/test_notificationclick-otherwindow.html
+diff --git a/dom/workers/test/serviceworkers/test_notificationclick.html b/dom/serviceworkers/test/test_notificationclick.html
+rename from dom/workers/test/serviceworkers/test_notificationclick.html
+rename to dom/serviceworkers/test/test_notificationclick.html
+diff --git a/dom/workers/test/serviceworkers/test_notificationclick_focus.html b/dom/serviceworkers/test/test_notificationclick_focus.html
+rename from dom/workers/test/serviceworkers/test_notificationclick_focus.html
+rename to dom/serviceworkers/test/test_notificationclick_focus.html
+diff --git a/dom/workers/test/serviceworkers/test_notificationclose.html b/dom/serviceworkers/test/test_notificationclose.html
+rename from dom/workers/test/serviceworkers/test_notificationclose.html
+rename to dom/serviceworkers/test/test_notificationclose.html
+diff --git a/dom/workers/test/serviceworkers/test_opaque_intercept.html b/dom/serviceworkers/test/test_opaque_intercept.html
+rename from dom/workers/test/serviceworkers/test_opaque_intercept.html
+rename to dom/serviceworkers/test/test_opaque_intercept.html
+diff --git a/dom/workers/test/serviceworkers/test_openWindow.html b/dom/serviceworkers/test/test_openWindow.html
+rename from dom/workers/test/serviceworkers/test_openWindow.html
+rename to dom/serviceworkers/test/test_openWindow.html
+diff --git a/dom/workers/test/serviceworkers/test_origin_after_redirect.html b/dom/serviceworkers/test/test_origin_after_redirect.html
+rename from dom/workers/test/serviceworkers/test_origin_after_redirect.html
+rename to dom/serviceworkers/test/test_origin_after_redirect.html
+diff --git a/dom/workers/test/serviceworkers/test_origin_after_redirect_cached.html b/dom/serviceworkers/test/test_origin_after_redirect_cached.html
+rename from dom/workers/test/serviceworkers/test_origin_after_redirect_cached.html
+rename to dom/serviceworkers/test/test_origin_after_redirect_cached.html
+diff --git a/dom/workers/test/serviceworkers/test_origin_after_redirect_to_https.html b/dom/serviceworkers/test/test_origin_after_redirect_to_https.html
+rename from dom/workers/test/serviceworkers/test_origin_after_redirect_to_https.html
+rename to dom/serviceworkers/test/test_origin_after_redirect_to_https.html
+diff --git a/dom/workers/test/serviceworkers/test_origin_after_redirect_to_https_cached.html b/dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html
+rename from dom/workers/test/serviceworkers/test_origin_after_redirect_to_https_cached.html
+rename to dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html
+diff --git a/dom/workers/test/serviceworkers/test_post_message.html b/dom/serviceworkers/test/test_post_message.html
+rename from dom/workers/test/serviceworkers/test_post_message.html
+rename to dom/serviceworkers/test/test_post_message.html
+diff --git a/dom/workers/test/serviceworkers/test_post_message_advanced.html b/dom/serviceworkers/test/test_post_message_advanced.html
+rename from dom/workers/test/serviceworkers/test_post_message_advanced.html
+rename to dom/serviceworkers/test/test_post_message_advanced.html
+diff --git a/dom/workers/test/serviceworkers/test_post_message_source.html b/dom/serviceworkers/test/test_post_message_source.html
+rename from dom/workers/test/serviceworkers/test_post_message_source.html
+rename to dom/serviceworkers/test/test_post_message_source.html
+diff --git a/dom/workers/test/serviceworkers/test_privateBrowsing.html b/dom/serviceworkers/test/test_privateBrowsing.html
+rename from dom/workers/test/serviceworkers/test_privateBrowsing.html
+rename to dom/serviceworkers/test/test_privateBrowsing.html
+diff --git a/dom/workers/test/serviceworkers/test_register_base.html b/dom/serviceworkers/test/test_register_base.html
+rename from dom/workers/test/serviceworkers/test_register_base.html
+rename to dom/serviceworkers/test/test_register_base.html
+diff --git a/dom/workers/test/serviceworkers/test_register_https_in_http.html b/dom/serviceworkers/test/test_register_https_in_http.html
+rename from dom/workers/test/serviceworkers/test_register_https_in_http.html
+rename to dom/serviceworkers/test/test_register_https_in_http.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context.js b/dom/serviceworkers/test/test_request_context.js
+rename from dom/workers/test/serviceworkers/test_request_context.js
+rename to dom/serviceworkers/test/test_request_context.js
+diff --git a/dom/workers/test/serviceworkers/test_request_context_audio.html b/dom/serviceworkers/test/test_request_context_audio.html
+rename from dom/workers/test/serviceworkers/test_request_context_audio.html
+rename to dom/serviceworkers/test/test_request_context_audio.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_beacon.html b/dom/serviceworkers/test/test_request_context_beacon.html
+rename from dom/workers/test/serviceworkers/test_request_context_beacon.html
+rename to dom/serviceworkers/test/test_request_context_beacon.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_cache.html b/dom/serviceworkers/test/test_request_context_cache.html
+rename from dom/workers/test/serviceworkers/test_request_context_cache.html
+rename to dom/serviceworkers/test/test_request_context_cache.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_cspreport.html b/dom/serviceworkers/test/test_request_context_cspreport.html
+rename from dom/workers/test/serviceworkers/test_request_context_cspreport.html
+rename to dom/serviceworkers/test/test_request_context_cspreport.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_embed.html b/dom/serviceworkers/test/test_request_context_embed.html
+rename from dom/workers/test/serviceworkers/test_request_context_embed.html
+rename to dom/serviceworkers/test/test_request_context_embed.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_fetch.html b/dom/serviceworkers/test/test_request_context_fetch.html
+rename from dom/workers/test/serviceworkers/test_request_context_fetch.html
+rename to dom/serviceworkers/test/test_request_context_fetch.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_font.html b/dom/serviceworkers/test/test_request_context_font.html
+rename from dom/workers/test/serviceworkers/test_request_context_font.html
+rename to dom/serviceworkers/test/test_request_context_font.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_frame.html b/dom/serviceworkers/test/test_request_context_frame.html
+rename from dom/workers/test/serviceworkers/test_request_context_frame.html
+rename to dom/serviceworkers/test/test_request_context_frame.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_iframe.html b/dom/serviceworkers/test/test_request_context_iframe.html
+rename from dom/workers/test/serviceworkers/test_request_context_iframe.html
+rename to dom/serviceworkers/test/test_request_context_iframe.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_image.html b/dom/serviceworkers/test/test_request_context_image.html
+rename from dom/workers/test/serviceworkers/test_request_context_image.html
+rename to dom/serviceworkers/test/test_request_context_image.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_imagesrcset.html b/dom/serviceworkers/test/test_request_context_imagesrcset.html
+rename from dom/workers/test/serviceworkers/test_request_context_imagesrcset.html
+rename to dom/serviceworkers/test/test_request_context_imagesrcset.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_internal.html b/dom/serviceworkers/test/test_request_context_internal.html
+rename from dom/workers/test/serviceworkers/test_request_context_internal.html
+rename to dom/serviceworkers/test/test_request_context_internal.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_nestedworker.html b/dom/serviceworkers/test/test_request_context_nestedworker.html
+rename from dom/workers/test/serviceworkers/test_request_context_nestedworker.html
+rename to dom/serviceworkers/test/test_request_context_nestedworker.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_nestedworkerinsharedworker.html b/dom/serviceworkers/test/test_request_context_nestedworkerinsharedworker.html
+rename from dom/workers/test/serviceworkers/test_request_context_nestedworkerinsharedworker.html
+rename to dom/serviceworkers/test/test_request_context_nestedworkerinsharedworker.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_object.html b/dom/serviceworkers/test/test_request_context_object.html
+rename from dom/workers/test/serviceworkers/test_request_context_object.html
+rename to dom/serviceworkers/test/test_request_context_object.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_picture.html b/dom/serviceworkers/test/test_request_context_picture.html
+rename from dom/workers/test/serviceworkers/test_request_context_picture.html
+rename to dom/serviceworkers/test/test_request_context_picture.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_ping.html b/dom/serviceworkers/test/test_request_context_ping.html
+rename from dom/workers/test/serviceworkers/test_request_context_ping.html
+rename to dom/serviceworkers/test/test_request_context_ping.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_plugin.html b/dom/serviceworkers/test/test_request_context_plugin.html
+rename from dom/workers/test/serviceworkers/test_request_context_plugin.html
+rename to dom/serviceworkers/test/test_request_context_plugin.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_script.html b/dom/serviceworkers/test/test_request_context_script.html
+rename from dom/workers/test/serviceworkers/test_request_context_script.html
+rename to dom/serviceworkers/test/test_request_context_script.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_sharedworker.html b/dom/serviceworkers/test/test_request_context_sharedworker.html
+rename from dom/workers/test/serviceworkers/test_request_context_sharedworker.html
+rename to dom/serviceworkers/test/test_request_context_sharedworker.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_style.html b/dom/serviceworkers/test/test_request_context_style.html
+rename from dom/workers/test/serviceworkers/test_request_context_style.html
+rename to dom/serviceworkers/test/test_request_context_style.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_track.html b/dom/serviceworkers/test/test_request_context_track.html
+rename from dom/workers/test/serviceworkers/test_request_context_track.html
+rename to dom/serviceworkers/test/test_request_context_track.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_video.html b/dom/serviceworkers/test/test_request_context_video.html
+rename from dom/workers/test/serviceworkers/test_request_context_video.html
+rename to dom/serviceworkers/test/test_request_context_video.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_worker.html b/dom/serviceworkers/test/test_request_context_worker.html
+rename from dom/workers/test/serviceworkers/test_request_context_worker.html
+rename to dom/serviceworkers/test/test_request_context_worker.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_xhr.html b/dom/serviceworkers/test/test_request_context_xhr.html
+rename from dom/workers/test/serviceworkers/test_request_context_xhr.html
+rename to dom/serviceworkers/test/test_request_context_xhr.html
+diff --git a/dom/workers/test/serviceworkers/test_request_context_xslt.html b/dom/serviceworkers/test/test_request_context_xslt.html
+rename from dom/workers/test/serviceworkers/test_request_context_xslt.html
+rename to dom/serviceworkers/test/test_request_context_xslt.html
+diff --git a/dom/workers/test/serviceworkers/test_sandbox_intercept.html b/dom/serviceworkers/test/test_sandbox_intercept.html
+rename from dom/workers/test/serviceworkers/test_sandbox_intercept.html
+rename to dom/serviceworkers/test/test_sandbox_intercept.html
+diff --git a/dom/workers/test/serviceworkers/test_sanitize.html b/dom/serviceworkers/test/test_sanitize.html
+rename from dom/workers/test/serviceworkers/test_sanitize.html
+rename to dom/serviceworkers/test/test_sanitize.html
+diff --git a/dom/workers/test/serviceworkers/test_sanitize_domain.html b/dom/serviceworkers/test/test_sanitize_domain.html
+rename from dom/workers/test/serviceworkers/test_sanitize_domain.html
+rename to dom/serviceworkers/test/test_sanitize_domain.html
+diff --git a/dom/workers/test/serviceworkers/test_scopes.html b/dom/serviceworkers/test/test_scopes.html
+rename from dom/workers/test/serviceworkers/test_scopes.html
+rename to dom/serviceworkers/test/test_scopes.html
+diff --git a/dom/workers/test/serviceworkers/test_script_loader_intercepted_js_cache.html b/dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html
+rename from dom/workers/test/serviceworkers/test_script_loader_intercepted_js_cache.html
+rename to dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html
+diff --git a/dom/workers/test/serviceworkers/test_service_worker_allowed.html b/dom/serviceworkers/test/test_service_worker_allowed.html
+rename from dom/workers/test/serviceworkers/test_service_worker_allowed.html
+rename to dom/serviceworkers/test/test_service_worker_allowed.html
+diff --git a/dom/workers/test/serviceworkers/test_serviceworker.html b/dom/serviceworkers/test/test_serviceworker.html
+rename from dom/workers/test/serviceworkers/test_serviceworker.html
+rename to dom/serviceworkers/test/test_serviceworker.html
+diff --git a/dom/workers/test/serviceworkers/test_serviceworker_header.html b/dom/serviceworkers/test/test_serviceworker_header.html
+rename from dom/workers/test/serviceworkers/test_serviceworker_header.html
+rename to dom/serviceworkers/test/test_serviceworker_header.html
+diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.html b/dom/serviceworkers/test/test_serviceworker_interfaces.html
+rename from dom/workers/test/serviceworkers/test_serviceworker_interfaces.html
+rename to dom/serviceworkers/test/test_serviceworker_interfaces.html
+diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js b/dom/serviceworkers/test/test_serviceworker_interfaces.js
+rename from dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
+rename to dom/serviceworkers/test/test_serviceworker_interfaces.js
+diff --git a/dom/workers/test/serviceworkers/test_serviceworker_not_sharedworker.html b/dom/serviceworkers/test/test_serviceworker_not_sharedworker.html
+rename from dom/workers/test/serviceworkers/test_serviceworker_not_sharedworker.html
+rename to dom/serviceworkers/test/test_serviceworker_not_sharedworker.html
+diff --git a/dom/workers/test/serviceworkers/test_serviceworkerinfo.xul b/dom/serviceworkers/test/test_serviceworkerinfo.xul
+rename from dom/workers/test/serviceworkers/test_serviceworkerinfo.xul
+rename to dom/serviceworkers/test/test_serviceworkerinfo.xul
+diff --git a/dom/workers/test/serviceworkers/test_serviceworkermanager.xul b/dom/serviceworkers/test/test_serviceworkermanager.xul
+rename from dom/workers/test/serviceworkers/test_serviceworkermanager.xul
+rename to dom/serviceworkers/test/test_serviceworkermanager.xul
+diff --git a/dom/workers/test/serviceworkers/test_serviceworkerregistrationinfo.xul b/dom/serviceworkers/test/test_serviceworkerregistrationinfo.xul
+rename from dom/workers/test/serviceworkers/test_serviceworkerregistrationinfo.xul
+rename to dom/serviceworkers/test/test_serviceworkerregistrationinfo.xul
+diff --git a/dom/workers/test/serviceworkers/test_skip_waiting.html b/dom/serviceworkers/test/test_skip_waiting.html
+rename from dom/workers/test/serviceworkers/test_skip_waiting.html
+rename to dom/serviceworkers/test/test_skip_waiting.html
+diff --git a/dom/workers/test/serviceworkers/test_strict_mode_warning.html b/dom/serviceworkers/test/test_strict_mode_warning.html
+rename from dom/workers/test/serviceworkers/test_strict_mode_warning.html
+rename to dom/serviceworkers/test/test_strict_mode_warning.html
+diff --git a/dom/workers/test/serviceworkers/test_third_party_iframes.html b/dom/serviceworkers/test/test_third_party_iframes.html
+rename from dom/workers/test/serviceworkers/test_third_party_iframes.html
+rename to dom/serviceworkers/test/test_third_party_iframes.html
+diff --git a/dom/workers/test/serviceworkers/test_unregister.html b/dom/serviceworkers/test/test_unregister.html
+rename from dom/workers/test/serviceworkers/test_unregister.html
+rename to dom/serviceworkers/test/test_unregister.html
+diff --git a/dom/workers/test/serviceworkers/test_unresolved_fetch_interception.html b/dom/serviceworkers/test/test_unresolved_fetch_interception.html
+rename from dom/workers/test/serviceworkers/test_unresolved_fetch_interception.html
+rename to dom/serviceworkers/test/test_unresolved_fetch_interception.html
+diff --git a/dom/workers/test/serviceworkers/test_update_missing_imported_script.html b/dom/serviceworkers/test/test_update_missing_imported_script.html
+rename from dom/workers/test/serviceworkers/test_update_missing_imported_script.html
+rename to dom/serviceworkers/test/test_update_missing_imported_script.html
+diff --git a/dom/workers/test/serviceworkers/test_workerUnregister.html b/dom/serviceworkers/test/test_workerUnregister.html
+rename from dom/workers/test/serviceworkers/test_workerUnregister.html
+rename to dom/serviceworkers/test/test_workerUnregister.html
+diff --git a/dom/workers/test/serviceworkers/test_workerUpdate.html b/dom/serviceworkers/test/test_workerUpdate.html
+rename from dom/workers/test/serviceworkers/test_workerUpdate.html
+rename to dom/serviceworkers/test/test_workerUpdate.html
+diff --git a/dom/workers/test/serviceworkers/test_worker_reference_gc_timeout.html b/dom/serviceworkers/test/test_worker_reference_gc_timeout.html
+rename from dom/workers/test/serviceworkers/test_worker_reference_gc_timeout.html
+rename to dom/serviceworkers/test/test_worker_reference_gc_timeout.html
+diff --git a/dom/workers/test/serviceworkers/test_workerupdatefoundevent.html b/dom/serviceworkers/test/test_workerupdatefoundevent.html
+rename from dom/workers/test/serviceworkers/test_workerupdatefoundevent.html
+rename to dom/serviceworkers/test/test_workerupdatefoundevent.html
+diff --git a/dom/workers/test/serviceworkers/test_xslt.html b/dom/serviceworkers/test/test_xslt.html
+rename from dom/workers/test/serviceworkers/test_xslt.html
+rename to dom/serviceworkers/test/test_xslt.html
+diff --git a/dom/workers/test/serviceworkers/thirdparty/iframe1.html b/dom/serviceworkers/test/thirdparty/iframe1.html
+rename from dom/workers/test/serviceworkers/thirdparty/iframe1.html
+rename to dom/serviceworkers/test/thirdparty/iframe1.html
+diff --git a/dom/workers/test/serviceworkers/thirdparty/iframe2.html b/dom/serviceworkers/test/thirdparty/iframe2.html
+rename from dom/workers/test/serviceworkers/thirdparty/iframe2.html
+rename to dom/serviceworkers/test/thirdparty/iframe2.html
+diff --git a/dom/workers/test/serviceworkers/thirdparty/register.html b/dom/serviceworkers/test/thirdparty/register.html
+rename from dom/workers/test/serviceworkers/thirdparty/register.html
+rename to dom/serviceworkers/test/thirdparty/register.html
+diff --git a/dom/workers/test/serviceworkers/thirdparty/sw.js b/dom/serviceworkers/test/thirdparty/sw.js
+rename from dom/workers/test/serviceworkers/thirdparty/sw.js
+rename to dom/serviceworkers/test/thirdparty/sw.js
+diff --git a/dom/workers/test/serviceworkers/thirdparty/unregister.html b/dom/serviceworkers/test/thirdparty/unregister.html
+rename from dom/workers/test/serviceworkers/thirdparty/unregister.html
+rename to dom/serviceworkers/test/thirdparty/unregister.html
+diff --git a/dom/workers/test/serviceworkers/thirdparty/worker.js b/dom/serviceworkers/test/thirdparty/worker.js
+rename from dom/workers/test/serviceworkers/thirdparty/worker.js
+rename to dom/serviceworkers/test/thirdparty/worker.js
+diff --git a/dom/workers/test/serviceworkers/unregister/index.html b/dom/serviceworkers/test/unregister/index.html
+rename from dom/workers/test/serviceworkers/unregister/index.html
+rename to dom/serviceworkers/test/unregister/index.html
+diff --git a/dom/workers/test/serviceworkers/unregister/unregister.html b/dom/serviceworkers/test/unregister/unregister.html
+rename from dom/workers/test/serviceworkers/unregister/unregister.html
+rename to dom/serviceworkers/test/unregister/unregister.html
+diff --git a/dom/workers/test/serviceworkers/unresolved_fetch_worker.js b/dom/serviceworkers/test/unresolved_fetch_worker.js
+rename from dom/workers/test/serviceworkers/unresolved_fetch_worker.js
+rename to dom/serviceworkers/test/unresolved_fetch_worker.js
+diff --git a/dom/workers/test/serviceworkers/update_worker.sjs b/dom/serviceworkers/test/update_worker.sjs
+rename from dom/workers/test/serviceworkers/update_worker.sjs
+rename to dom/serviceworkers/test/update_worker.sjs
+diff --git a/dom/workers/test/serviceworkers/updatefoundevent.html b/dom/serviceworkers/test/updatefoundevent.html
+rename from dom/workers/test/serviceworkers/updatefoundevent.html
+rename to dom/serviceworkers/test/updatefoundevent.html
+diff --git a/dom/workers/test/serviceworkers/utils.js b/dom/serviceworkers/test/utils.js
+rename from dom/workers/test/serviceworkers/utils.js
+rename to dom/serviceworkers/test/utils.js
+diff --git a/dom/workers/test/serviceworkers/worker.js b/dom/serviceworkers/test/worker.js
+rename from dom/workers/test/serviceworkers/worker.js
+rename to dom/serviceworkers/test/worker.js
+diff --git a/dom/workers/test/serviceworkers/worker2.js b/dom/serviceworkers/test/worker2.js
+rename from dom/workers/test/serviceworkers/worker2.js
+rename to dom/serviceworkers/test/worker2.js
+diff --git a/dom/workers/test/serviceworkers/worker3.js b/dom/serviceworkers/test/worker3.js
+rename from dom/workers/test/serviceworkers/worker3.js
+rename to dom/serviceworkers/test/worker3.js
+diff --git a/dom/workers/test/serviceworkers/workerUpdate/update.html b/dom/serviceworkers/test/workerUpdate/update.html
+rename from dom/workers/test/serviceworkers/workerUpdate/update.html
+rename to dom/serviceworkers/test/workerUpdate/update.html
+diff --git a/dom/workers/test/serviceworkers/worker_unregister.js b/dom/serviceworkers/test/worker_unregister.js
+rename from dom/workers/test/serviceworkers/worker_unregister.js
+rename to dom/serviceworkers/test/worker_unregister.js
+diff --git a/dom/workers/test/serviceworkers/worker_update.js b/dom/serviceworkers/test/worker_update.js
+rename from dom/workers/test/serviceworkers/worker_update.js
+rename to dom/serviceworkers/test/worker_update.js
+diff --git a/dom/workers/test/serviceworkers/worker_updatefoundevent.js b/dom/serviceworkers/test/worker_updatefoundevent.js
+rename from dom/workers/test/serviceworkers/worker_updatefoundevent.js
+rename to dom/serviceworkers/test/worker_updatefoundevent.js
+diff --git a/dom/workers/test/serviceworkers/worker_updatefoundevent2.js b/dom/serviceworkers/test/worker_updatefoundevent2.js
+rename from dom/workers/test/serviceworkers/worker_updatefoundevent2.js
+rename to dom/serviceworkers/test/worker_updatefoundevent2.js
+diff --git a/dom/workers/test/serviceworkers/xslt/test.xml b/dom/serviceworkers/test/xslt/test.xml
+rename from dom/workers/test/serviceworkers/xslt/test.xml
+rename to dom/serviceworkers/test/xslt/test.xml
+diff --git a/dom/workers/test/serviceworkers/xslt/xslt.sjs b/dom/serviceworkers/test/xslt/xslt.sjs
+rename from dom/workers/test/serviceworkers/xslt/xslt.sjs
+rename to dom/serviceworkers/test/xslt/xslt.sjs
+diff --git a/dom/workers/test/serviceworkers/xslt_worker.js b/dom/serviceworkers/test/xslt_worker.js
+rename from dom/workers/test/serviceworkers/xslt_worker.js
+rename to dom/serviceworkers/test/xslt_worker.js
+diff --git a/dom/workers/moz.build b/dom/workers/moz.build
+--- a/dom/workers/moz.build
++++ b/dom/workers/moz.build
+@@ -5,44 +5,31 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ with Files("**"):
+     BUG_COMPONENT = ("Core", "DOM: Workers")
+ 
+ # Public stuff.
+ EXPORTS.mozilla.dom += [
+     'FileReaderSync.h',
+-    'ServiceWorkerCommon.h',
+-    'ServiceWorkerContainer.h',
+-    'ServiceWorkerDescriptor.h',
+-    'ServiceWorkerEvents.h',
+-    'ServiceWorkerInterceptController.h',
+-    'ServiceWorkerIPCUtils.h',
+-    'ServiceWorkerRegistrar.h',
+-    'ServiceWorkerRegistration.h',
+-    'ServiceWorkerUtils.h',
+     'WorkerLocation.h',
+     'WorkerNavigator.h',
+     'WorkerPrivate.h',
+     'WorkerRunnable.h',
+     'WorkerScope.h',
+ ]
+ 
+ EXPORTS.mozilla.dom.workers += [
+     'RuntimeService.h',
+-    'ServiceWorkerInfo.h',
+-    'ServiceWorkerManager.h',
+-    'ServiceWorkerRegistrationInfo.h',
+     'WorkerDebuggerManager.h',
+     'Workers.h',
+ ]
+ 
+ # Stuff needed for the bindings, not really public though.
+ EXPORTS.mozilla.dom.workers.bindings += [
+-    'ServiceWorker.h',
+     'SharedWorker.h',
+     'WorkerHolder.h',
+     'WorkerHolderToken.h',
+ ]
+ 
+ XPIDL_MODULE = 'dom_workers'
+ 
+ XPIDL_SOURCES += [
+@@ -52,89 +39,50 @@ XPIDL_SOURCES += [
+ 
+ UNIFIED_SOURCES += [
+     'ChromeWorkerScope.cpp',
+     'FileReaderSync.cpp',
+     'Principal.cpp',
+     'RegisterBindings.cpp',
+     'RuntimeService.cpp',
+     'ScriptLoader.cpp',
+-    'ServiceWorker.cpp',
+-    'ServiceWorkerContainer.cpp',
+-    'ServiceWorkerDescriptor.cpp',
+-    'ServiceWorkerEvents.cpp',
+-    'ServiceWorkerInfo.cpp',
+-    'ServiceWorkerInterceptController.cpp',
+-    'ServiceWorkerJob.cpp',
+-    'ServiceWorkerJobQueue.cpp',
+-    'ServiceWorkerManager.cpp',
+-    'ServiceWorkerManagerChild.cpp',
+-    'ServiceWorkerManagerParent.cpp',
+-    'ServiceWorkerManagerService.cpp',
+-    'ServiceWorkerPrivate.cpp',
+-    'ServiceWorkerRegisterJob.cpp',
+-    'ServiceWorkerRegistrar.cpp',
+-    'ServiceWorkerRegistration.cpp',
+-    'ServiceWorkerRegistrationInfo.cpp',
+-    'ServiceWorkerScriptCache.cpp',
+-    'ServiceWorkerUnregisterJob.cpp',
+-    'ServiceWorkerUpdateJob.cpp',
+-    'ServiceWorkerUpdaterChild.cpp',
+-    'ServiceWorkerUpdaterParent.cpp',
+-    'ServiceWorkerUtils.cpp',
+     'SharedWorker.cpp',
+     'WorkerDebuggerManager.cpp',
+     'WorkerHolder.cpp',
+     'WorkerHolderToken.cpp',
+     'WorkerLocation.cpp',
+     'WorkerNavigator.cpp',
+     'WorkerPrivate.cpp',
+     'WorkerRunnable.cpp',
+     'WorkerScope.cpp',
+     'WorkerThread.cpp',
+ ]
+ 
+-IPDL_SOURCES += [
+-    'IPCServiceWorkerDescriptor.ipdlh',
+-    'PServiceWorkerManager.ipdl',
+-    'PServiceWorkerUpdater.ipdl',
+-    'ServiceWorkerRegistrarTypes.ipdlh',
+-]
+-
+ LOCAL_INCLUDES += [
+     '../base',
+     '../system',
+     '/dom/base',
+     '/dom/bindings',
+     '/xpcom/build',
+     '/xpcom/threads',
+ ]
+ 
+-include('/ipc/chromium/chromium-config.mozbuild')
+-
+ FINAL_LIBRARY = 'xul'
+ 
+ TEST_DIRS += [
+     'test/extensions/bootstrap',
+     'test/extensions/traditional',
+ ]
+ 
+ MOCHITEST_MANIFESTS += [
+     'test/mochitest.ini',
+-    'test/serviceworkers/mochitest.ini',
+ ]
+ 
+ MOCHITEST_CHROME_MANIFESTS += [
+     'test/chrome.ini',
+-    'test/serviceworkers/chrome.ini'
+-]
+-
+-BROWSER_CHROME_MANIFESTS += [
+-    'test/serviceworkers/browser.ini',
+-    'test/serviceworkers/isolated/multi-e10s-update/browser.ini',
+ ]
+ 
+ XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
+ 
+ BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
+ 
+ TEST_DIRS += ['test/gtest']
+ 

+ 394 - 0
mozilla-release/patches/1430139-2-60a1.patch

@@ -0,0 +1,394 @@
+# HG changeset patch
+# User Ben Kelly <ben@wanderview.com>
+# Date 1517000938 28800
+# Node ID cd4560fcb5548c0594d56193f5effc1de9ba7d2d
+# Parent  0ea321939830d964ccde608e3731dc628eff44e9
+Bug 1430139 P2 Make the tree compile again after moving the code to dom/serviceworkers. r=asuth
+
+diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp
+--- a/dom/notification/Notification.cpp
++++ b/dom/notification/Notification.cpp
+@@ -46,17 +46,17 @@
+ #include "nsIXPConnect.h"
+ #include "nsNetUtil.h"
+ #include "nsProxyRelease.h"
+ #include "nsServiceManagerUtils.h"
+ #include "nsStructuredCloneContainer.h"
+ #include "nsThreadUtils.h"
+ #include "nsToolkitCompsCID.h"
+ #include "nsXULAppAPI.h"
+-#include "ServiceWorkerManager.h"
++#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "WorkerPrivate.h"
+ #include "WorkerRunnable.h"
+ #include "WorkerScope.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ using namespace workers;
+diff --git a/dom/push/PushNotifier.cpp b/dom/push/PushNotifier.cpp
+--- a/dom/push/PushNotifier.cpp
++++ b/dom/push/PushNotifier.cpp
+@@ -7,17 +7,17 @@
+ #include "PushNotifier.h"
+ 
+ #include "nsContentUtils.h"
+ #include "nsCOMPtr.h"
+ #include "nsICategoryManager.h"
+ #include "nsIXULRuntime.h"
+ #include "nsNetUtil.h"
+ #include "nsXPCOM.h"
+-#include "ServiceWorkerManager.h"
++#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ 
+ #include "mozilla/Services.h"
+ #include "mozilla/Unused.h"
+ 
+ #include "mozilla/dom/BodyUtil.h"
+ #include "mozilla/dom/ContentChild.h"
+ #include "mozilla/dom/ContentParent.h"
+ 
+diff --git a/dom/serviceworkers/ServiceWorkerContainer.cpp b/dom/serviceworkers/ServiceWorkerContainer.cpp
+--- a/dom/serviceworkers/ServiceWorkerContainer.cpp
++++ b/dom/serviceworkers/ServiceWorkerContainer.cpp
+@@ -23,16 +23,20 @@
+ #include "mozilla/dom/ServiceWorkerContainerBinding.h"
+ #include "mozilla/dom/workers/bindings/ServiceWorker.h"
+ 
+ #include "ServiceWorker.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
++using mozilla::dom::workers::ServiceWorkerInfo;
++using mozilla::dom::workers::ServiceWorkerManager;
++using mozilla::dom::workers::ServiceWorkerRegistrationInfo;
++
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerContainer)
+ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
+ 
+ NS_IMPL_ADDREF_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
+ NS_IMPL_RELEASE_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
+ 
+ NS_IMPL_CYCLE_COLLECTION_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper,
+                                    mControllerWorker, mReadyPromise)
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -23,16 +23,17 @@
+ #include "nsNetCID.h"
+ #include "nsNetUtil.h"
+ #include "nsSerializationHelper.h"
+ #include "nsQueryObject.h"
+ #include "ServiceWorkerManager.h"
+ 
+ #include "mozilla/ErrorResult.h"
+ #include "mozilla/LoadInfo.h"
++#include "mozilla/Move.h"
+ #include "mozilla/Preferences.h"
+ #include "mozilla/dom/BodyUtil.h"
+ #include "mozilla/dom/Client.h"
+ #include "mozilla/dom/FetchEventBinding.h"
+ #include "mozilla/dom/MessagePort.h"
+ #include "mozilla/dom/PromiseNativeHandler.h"
+ #include "mozilla/dom/PushEventBinding.h"
+ #include "mozilla/dom/PushMessageDataBinding.h"
+@@ -43,16 +44,17 @@
+ #include "mozilla/dom/WorkerScope.h"
+ #include "mozilla/dom/workers/bindings/ServiceWorker.h"
+ 
+ #include "js/Conversions.h"
+ #include "js/TypeDecls.h"
+ #include "WorkerPrivate.h"
+ #include "xpcpublic.h"
+ 
++using namespace mozilla;
+ using namespace mozilla::dom;
+ using namespace mozilla::dom::workers;
+ 
+ namespace {
+ 
+ void
+ AsyncLog(nsIInterceptedChannel *aInterceptedChannel,
+          const nsACString& aRespondWithScriptSpec,
+diff --git a/dom/serviceworkers/ServiceWorkerInfo.cpp b/dom/serviceworkers/ServiceWorkerInfo.cpp
+--- a/dom/serviceworkers/ServiceWorkerInfo.cpp
++++ b/dom/serviceworkers/ServiceWorkerInfo.cpp
+@@ -5,16 +5,18 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerInfo.h"
+ 
+ #include "ServiceWorkerScriptCache.h"
+ 
+ BEGIN_WORKERS_NAMESPACE
+ 
++using mozilla::ipc::PrincipalInfo;
++
+ static_assert(nsIServiceWorkerInfo::STATE_PARSED == static_cast<uint16_t>(ServiceWorkerState::Parsed),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ static_assert(nsIServiceWorkerInfo::STATE_INSTALLING == static_cast<uint16_t>(ServiceWorkerState::Installing),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ static_assert(nsIServiceWorkerInfo::STATE_INSTALLED == static_cast<uint16_t>(ServiceWorkerState::Installed),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ static_assert(nsIServiceWorkerInfo::STATE_ACTIVATING == static_cast<uint16_t>(ServiceWorkerState::Activating),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
+@@ -57,17 +57,16 @@
+ #include "mozilla/ipc/PBackgroundSharedTypes.h"
+ #include "mozilla/dom/ScriptLoader.h"
+ #include "mozilla/Unused.h"
+ #include "mozilla/EnumSet.h"
+ 
+ #include "nsContentPolicyUtils.h"
+ #include "nsContentSecurityManager.h"
+ #include "nsContentUtils.h"
+-#include "nsGlobalWindow.h"
+ #include "nsNetUtil.h"
+ #include "nsProxyRelease.h"
+ #include "nsQueryObject.h"
+ #include "nsTArray.h"
+ 
+ #include "RuntimeService.h"
+ #include "ServiceWorker.h"
+ #include "ServiceWorkerContainer.h"
+diff --git a/dom/serviceworkers/ServiceWorkerPrivate.h b/dom/serviceworkers/ServiceWorkerPrivate.h
+--- a/dom/serviceworkers/ServiceWorkerPrivate.h
++++ b/dom/serviceworkers/ServiceWorkerPrivate.h
+@@ -3,17 +3,16 @@
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #ifndef mozilla_dom_workers_serviceworkerprivate_h
+ #define mozilla_dom_workers_serviceworkerprivate_h
+ 
+ #include "nsCOMPtr.h"
+-
+ #include "WorkerPrivate.h"
+ 
+ #define NOTIFICATION_CLICK_EVENT_NAME "notificationclick"
+ #define NOTIFICATION_CLOSE_EVENT_NAME "notificationclose"
+ 
+ class nsIInterceptedChannel;
+ 
+ namespace mozilla {
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+@@ -1,16 +1,19 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerRegistrationInfo.h"
+ 
++#include "ServiceWorkerManager.h"
++#include "ServiceWorkerPrivate.h"
++
+ BEGIN_WORKERS_NAMESPACE
+ 
+ namespace {
+ 
+ class ContinueActivateRunnable final : public LifeCycleEventCallback
+ {
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> mRegistration;
+   bool mSuccess;
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrationInfo.h b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
++++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+@@ -3,17 +3,19 @@
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #ifndef mozilla_dom_workers_serviceworkerregistrationinfo_h
+ #define mozilla_dom_workers_serviceworkerregistrationinfo_h
+ 
+ #include "mozilla/dom/workers/ServiceWorkerInfo.h"
++#include "mozilla/dom/ServiceWorkerCommon.h"
+ #include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
++#include "nsProxyRelease.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ namespace workers {
+ 
+ class ServiceWorkerRegistrationInfo final
+   : public nsIServiceWorkerRegistrationInfo
+ {
+diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
+--- a/dom/workers/RuntimeService.cpp
++++ b/dom/workers/RuntimeService.cpp
+@@ -20,17 +20,17 @@
+ #include "nsIStreamTransportService.h"
+ #include "nsISupportsPriority.h"
+ #include "nsITimer.h"
+ #include "nsIURI.h"
+ #include "nsIXULRuntime.h"
+ #include "nsPIDOMWindow.h"
+ 
+ #include <algorithm>
+-#include "BackgroundChild.h"
++#include "mozilla/ipc/BackgroundChild.h"
+ #include "GeckoProfiler.h"
+ #include "jsfriendapi.h"
+ #include "mozilla/AbstractThread.h"
+ #include "mozilla/ArrayUtils.h"
+ #include "mozilla/AsyncEventDispatcher.h"
+ #include "mozilla/Atomics.h"
+ #include "mozilla/CycleCollectedJSContext.h"
+ #include "mozilla/CycleCollectedJSRuntime.h"
+diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
+--- a/dom/workers/WorkerPrivate.cpp
++++ b/dom/workers/WorkerPrivate.cpp
+@@ -106,18 +106,18 @@
+ #ifdef DEBUG
+ #include "nsThreadManager.h"
+ #endif
+ 
+ #include "Navigator.h"
+ #include "Principal.h"
+ #include "RuntimeService.h"
+ #include "ScriptLoader.h"
+-#include "ServiceWorkerEvents.h"
+-#include "ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerEvents.h"
++#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "SharedWorker.h"
+ #include "WorkerDebuggerManager.h"
+ #include "WorkerHolder.h"
+ #include "WorkerNavigator.h"
+ #include "WorkerRunnable.h"
+ #include "WorkerScope.h"
+ #include "WorkerThread.h"
+ 
+diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp
+--- a/dom/workers/WorkerScope.cpp
++++ b/dom/workers/WorkerScope.cpp
+@@ -41,18 +41,18 @@
+ #endif
+ 
+ #include "Crypto.h"
+ #include "Principal.h"
+ #include "RuntimeService.h"
+ #include "ScriptLoader.h"
+ #include "WorkerPrivate.h"
+ #include "WorkerRunnable.h"
+-#include "ServiceWorkerManager.h"
+-#include "ServiceWorkerRegistration.h"
++#include "mozilla/dom/ServiceWorkerRegistration.h"
++#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ 
+ #ifdef XP_WIN
+ #undef PostMessage
+ #endif
+ 
+ extern already_AddRefed<nsIScriptTimeoutHandler>
+ NS_CreateJSTimeoutHandler(JSContext* aCx,
+                           mozilla::dom::workers::WorkerPrivate* aWorkerPrivate,
+diff --git a/dom/workers/moz.build b/dom/workers/moz.build
+--- a/dom/workers/moz.build
++++ b/dom/workers/moz.build
+@@ -60,16 +60,18 @@ LOCAL_INCLUDES += [
+     '../base',
+     '../system',
+     '/dom/base',
+     '/dom/bindings',
+     '/xpcom/build',
+     '/xpcom/threads',
+ ]
+ 
++include('/ipc/chromium/chromium-config.mozbuild')
++
+ FINAL_LIBRARY = 'xul'
+ 
+ TEST_DIRS += [
+     'test/extensions/bootstrap',
+     'test/extensions/traditional',
+ ]
+ 
+ MOCHITEST_MANIFESTS += [
+diff --git a/ipc/glue/BackgroundChildImpl.cpp b/ipc/glue/BackgroundChildImpl.cpp
+--- a/ipc/glue/BackgroundChildImpl.cpp
++++ b/ipc/glue/BackgroundChildImpl.cpp
+@@ -3,17 +3,16 @@
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "BackgroundChildImpl.h"
+ 
+ #include "ActorsChild.h" // IndexedDB
+ #include "BroadcastChannelChild.h"
+-#include "ServiceWorkerManagerChild.h"
+ #include "FileDescriptorSetChild.h"
+ #ifdef MOZ_WEBRTC
+ #include "CamerasChild.h"
+ #endif
+ #include "mozilla/media/MediaChild.h"
+ #include "mozilla/Assertions.h"
+ #include "mozilla/SchedulerGroup.h"
+ #include "mozilla/dom/ClientManagerActors.h"
+@@ -29,16 +28,17 @@
+ #include "mozilla/dom/quota/PQuotaChild.h"
+ #include "mozilla/dom/StorageIPC.h"
+ #include "mozilla/dom/GamepadEventChannelChild.h"
+ #include "mozilla/dom/GamepadTestChannelChild.h"
+ #include "mozilla/dom/LocalStorage.h"
+ #include "mozilla/dom/MessagePortChild.h"
+ #include "mozilla/dom/TabChild.h"
+ #include "mozilla/dom/TabGroup.h"
++#include "mozilla/dom/workers/ServiceWorkerManagerChild.h"
+ #include "mozilla/ipc/IPCStreamAlloc.h"
+ #include "mozilla/ipc/PBackgroundTestChild.h"
+ #include "mozilla/ipc/PChildToParentStreamChild.h"
+ #include "mozilla/ipc/PParentToChildStreamChild.h"
+ #include "mozilla/layout/VsyncChild.h"
+ #include "mozilla/net/HttpBackgroundChannelChild.h"
+ #include "mozilla/net/PUDPSocketChild.h"
+ #include "mozilla/dom/network/UDPSocketChild.h"
+diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp
+--- a/ipc/glue/BackgroundParentImpl.cpp
++++ b/ipc/glue/BackgroundParentImpl.cpp
+@@ -27,16 +27,17 @@
+ #include "mozilla/dom/asmjscache/AsmJSCache.h"
+ #include "mozilla/dom/cache/ActorUtils.h"
+ #include "mozilla/dom/indexedDB/ActorsParent.h"
+ #include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
+ #include "mozilla/dom/ipc/PendingIPCBlobParent.h"
+ #include "mozilla/dom/ipc/TemporaryIPCBlobParent.h"
+ #include "mozilla/dom/quota/ActorsParent.h"
+ #include "mozilla/dom/StorageIPC.h"
++#include "mozilla/dom/workers/ServiceWorkerManagerParent.h"
+ #include "mozilla/ipc/BackgroundParent.h"
+ #include "mozilla/ipc/BackgroundUtils.h"
+ #include "mozilla/ipc/IPCStreamAlloc.h"
+ #include "mozilla/ipc/PBackgroundSharedTypes.h"
+ #include "mozilla/ipc/PBackgroundTestParent.h"
+ #include "mozilla/ipc/PChildToParentStreamParent.h"
+ #include "mozilla/ipc/PParentToChildStreamParent.h"
+ #include "mozilla/layout/VsyncParent.h"
+@@ -46,17 +47,16 @@
+ #include "mozilla/Preferences.h"
+ #include "nsNetUtil.h"
+ #include "nsIScriptSecurityManager.h"
+ #include "nsProxyRelease.h"
+ #include "mozilla/RefPtr.h"
+ #include "nsThreadUtils.h"
+ #include "nsTraceRefcnt.h"
+ #include "nsXULAppAPI.h"
+-#include "ServiceWorkerManagerParent.h"
+ 
+ #ifdef DISABLE_ASSERTS_FOR_FUZZING
+ #define ASSERT_UNLESS_FUZZING(...) do { } while (0)
+ #else
+ #define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false)
+ #endif
+ 
+ using mozilla::ipc::AssertIsOnBackgroundThread;

+ 6934 - 0
mozilla-release/patches/1430139-3-60a1.patch

@@ -0,0 +1,6934 @@
+# HG changeset patch
+# User Ben Kelly <ben@wanderview.com>
+# Date 1517000939 28800
+# Node ID 8d8c6cf162ed012864c0c6cc1ecc6159f57c066a
+# Parent  3d358c19f4f82dc892221d2d2dda27015c1c60ee
+Bug 1430139 P3 Remove workers namespace from service worker code. r=asuth
+
+diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
+--- a/docshell/base/nsDocShell.cpp
++++ b/docshell/base/nsDocShell.cpp
+@@ -42,22 +42,22 @@
+ #include "mozilla/dom/Element.h"
+ #include "mozilla/dom/HTMLAnchorElement.h"
+ #include "mozilla/dom/PerformanceNavigation.h"
+ #include "mozilla/dom/PermissionMessageUtils.h"
+ #include "mozilla/dom/ProfileTimelineMarkerBinding.h"
+ #include "mozilla/dom/ScreenOrientation.h"
+ #include "mozilla/dom/ScriptSettings.h"
+ #include "mozilla/dom/ServiceWorkerInterceptController.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/dom/ServiceWorkerUtils.h"
+ #include "mozilla/dom/TabChild.h"
+ #include "mozilla/dom/TabGroup.h"
+ #include "mozilla/dom/ToJSValue.h"
+ 
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ 
+ #include "mozilla/net/ReferrerPolicy.h"
+ 
+ #include "nsIApplicationCacheChannel.h"
+ #include "nsIApplicationCacheContainer.h"
+ #include "nsIAppShell.h"
+ #include "nsIAsyncVerifyRedirectCallback.h"
+ #include "nsIAuthPrompt.h"
+@@ -223,17 +223,16 @@
+ #endif
+ 
+ #ifdef MOZ_TOOLKIT_SEARCH
+ #include "nsIBrowserSearchService.h"
+ #endif
+ 
+ using namespace mozilla;
+ using namespace mozilla::dom;
+-using mozilla::dom::workers::ServiceWorkerManager;
+ 
+ // Threshold value in ms for META refresh based redirects
+ #define REFRESH_REDIRECT_TIMER 15000
+ 
+ // Hint for native dispatch of events on how long to delay after
+ // all documents have loaded in milliseconds before favoring normal
+ // native event dispatch priorites over performance
+ // Can be overridden with docshell.event_starvation_delay_hint pref.
+diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
+--- a/dom/base/nsContentUtils.cpp
++++ b/dom/base/nsContentUtils.cpp
+@@ -52,17 +52,16 @@
+ #include "mozilla/dom/IPCBlobUtils.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/ScriptSettings.h"
+ #include "mozilla/dom/TabParent.h"
+ #include "mozilla/dom/TouchEvent.h"
+ #include "mozilla/dom/ShadowRoot.h"
+ #include "mozilla/dom/XULCommandEvent.h"
+ #include "mozilla/dom/WorkerPrivate.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "mozilla/EventDispatcher.h"
+ #include "mozilla/EventListenerManager.h"
+ #include "mozilla/EventStateManager.h"
+ #include "mozilla/gfx/DataSurfaceHelpers.h"
+ #include "mozilla/HTMLEditor.h"
+ #include "mozilla/IMEStateManager.h"
+ #include "mozilla/InternalMutationEvent.h"
+ #include "mozilla/Likely.h"
+diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
+--- a/dom/base/nsDocument.cpp
++++ b/dom/base/nsDocument.cpp
+@@ -80,17 +80,17 @@
+ #include "mozilla/dom/NodeIterator.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/PromiseNativeHandler.h"
+ #include "mozilla/dom/ResizeObserver.h"
+ #include "mozilla/dom/ResizeObserverController.h"
+ #include "mozilla/dom/TreeWalker.h"
+ 
+ #include "nsIServiceManager.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "imgLoader.h"
+ 
+ #include "nsCanvasFrame.h"
+ #include "nsContentCID.h"
+ #include "nsError.h"
+ #include "nsPresContext.h"
+ #include "nsIJSON.h"
+ #include "nsThreadUtils.h"
+@@ -5407,17 +5407,17 @@ nsDocument::DispatchContentLoadedEvents(
+   Element* root = GetRootElement();
+   if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::manifest)) {
+     nsContentUtils::DispatchChromeEvent(this, static_cast<nsIDocument*>(this),
+                                         NS_LITERAL_STRING("MozApplicationManifest"),
+                                         true, true);
+   }
+ 
+   if (mMaybeServiceWorkerControlled) {
+-    using mozilla::dom::workers::ServiceWorkerManager;
++    using mozilla::dom::ServiceWorkerManager;
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (swm) {
+       Maybe<ClientInfo> clientInfo = GetClientInfo();
+       if (clientInfo.isSome()) {
+         swm->MaybeCheckNavigationUpdate(clientInfo.ref());
+       }
+     }
+   }
+diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
+--- a/dom/bindings/Bindings.conf
++++ b/dom/bindings/Bindings.conf
+@@ -323,28 +323,25 @@ DOMInterfaces = {
+     'binaryNames': {
+         'message': 'messageMoz',
+     },
+     'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'stack' ],
+ },
+ 
+ 'ExtendableEvent': {
+     'headerFile': 'mozilla/dom/ServiceWorkerEvents.h',
+-    'nativeType': 'mozilla::dom::workers::ExtendableEvent',
+     'implicitJSContext': [ 'waitUntil' ],
+ },
+ 
+ 'ExtendableMessageEvent': {
+     'headerFile': 'mozilla/dom/ServiceWorkerEvents.h',
+-    'nativeType': 'mozilla::dom::workers::ExtendableMessageEvent',
+ },
+ 
+ 'FetchEvent': {
+     'headerFile': 'ServiceWorkerEvents.h',
+-    'nativeType': 'mozilla::dom::workers::FetchEvent',
+     'binaryNames': {
+         'request': 'request_'
+     },
+     'implicitJSContext': [ 'respondWith' ],
+ },
+ 
+ 'FileReader': {
+     'implicitJSContext': [ 'readAsArrayBuffer' ],
+@@ -713,22 +710,20 @@ DOMInterfaces = {
+ },
+ 
+ 'PromiseNativeHandler': {
+     'wrapperCache': False,
+ },
+ 
+ 'PushEvent': {
+     'headerFile': 'ServiceWorkerEvents.h',
+-    'nativeType': 'mozilla::dom::workers::PushEvent',
+ },
+ 
+ 'PushMessageData': {
+     'headerFile': 'ServiceWorkerEvents.h',
+-    'nativeType': 'mozilla::dom::workers::PushMessageData',
+ },
+ 
+ 'Range': {
+     'nativeType': 'nsRange',
+     'binaryNames': {
+         '__stringifier': 'ToString'
+     }
+ },
+@@ -764,21 +759,16 @@ DOMInterfaces = {
+ 'RGBColor': {
+     'nativeType': 'nsDOMCSSRGBColor',
+ },
+ 
+ 'Screen': {
+     'nativeType': 'nsScreen',
+ },
+ 
+-'ServiceWorker': {
+-    'nativeType': 'mozilla::dom::workers::ServiceWorker',
+-    'headerFile': 'mozilla/dom/workers/bindings/ServiceWorker.h',
+-},
+-
+ 'ServiceWorkerGlobalScope': {
+     'headerFile': 'mozilla/dom/WorkerScope.h',
+ },
+ 
+ 'ServiceWorkerRegistration': {
+     'implicitJSContext': [ 'pushManager' ],
+ },
+ 
+diff --git a/dom/clients/api/Clients.cpp b/dom/clients/api/Clients.cpp
+--- a/dom/clients/api/Clients.cpp
++++ b/dom/clients/api/Clients.cpp
+@@ -7,28 +7,27 @@
+ #include "Clients.h"
+ 
+ #include "ClientDOMUtil.h"
+ #include "mozilla/dom/ClientIPCTypes.h"
+ #include "mozilla/dom/ClientManager.h"
+ #include "mozilla/dom/ClientsBinding.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/ServiceWorkerDescriptor.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/dom/WorkerPrivate.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "mozilla/SystemGroup.h"
+ #include "nsIGlobalObject.h"
+ #include "nsString.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
+ using mozilla::dom::workers::WorkerPrivate;
+-using mozilla::dom::workers::ServiceWorkerManager;
+ using mozilla::ipc::PrincipalInfo;
+ 
+ NS_IMPL_CYCLE_COLLECTING_ADDREF(Clients);
+ NS_IMPL_CYCLE_COLLECTING_RELEASE(Clients);
+ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Clients, mGlobal);
+ 
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Clients)
+   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+diff --git a/dom/clients/manager/ClientSource.cpp b/dom/clients/manager/ClientSource.cpp
+--- a/dom/clients/manager/ClientSource.cpp
++++ b/dom/clients/manager/ClientSource.cpp
+@@ -13,30 +13,27 @@
+ #include "ClientValidation.h"
+ #include "mozilla/dom/ClientIPCTypes.h"
+ #include "mozilla/dom/ipc/StructuredCloneData.h"
+ #include "mozilla/dom/MessageEvent.h"
+ #include "mozilla/dom/MessageEventBinding.h"
+ #include "mozilla/dom/Navigator.h"
+ #include "mozilla/dom/WorkerPrivate.h"
+ #include "mozilla/dom/WorkerScope.h"
++#include "mozilla/dom/ServiceWorker.h"
+ #include "mozilla/dom/ServiceWorkerContainer.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+-#include "mozilla/dom/workers/bindings/ServiceWorker.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "nsContentUtils.h"
+ #include "nsIDocShell.h"
+ #include "nsPIDOMWindow.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ using mozilla::dom::ipc::StructuredCloneData;
+-using mozilla::dom::workers::ServiceWorkerInfo;
+-using mozilla::dom::workers::ServiceWorkerManager;
+-using mozilla::dom::workers::ServiceWorkerRegistrationInfo;
+ using mozilla::dom::workers::WorkerPrivate;
+ using mozilla::ipc::PrincipalInfo;
+ using mozilla::ipc::PrincipalInfoToPrincipal;
+ 
+ void
+ ClientSource::Shutdown()
+ {
+   NS_ASSERT_OWNINGTHREAD(ClientSource);
+diff --git a/dom/events/Event.h b/dom/events/Event.h
+--- a/dom/events/Event.h
++++ b/dom/events/Event.h
+@@ -26,25 +26,23 @@ class nsIContent;
+ class nsIDOMEventTarget;
+ class nsPresContext;
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ class EventTarget;
+ class EventMessageAutoOverride;
++// ExtendableEvent is a ServiceWorker event that is not
++// autogenerated since it has some extra methods.
++class ExtendableEvent;
+ class WantsPopupControlCheck;
+ #define GENERATED_EVENT(EventClass_) class EventClass_;
+ #include "mozilla/dom/GeneratedEventList.h"
+ #undef GENERATED_EVENT
+-// ExtendableEvent is a ServiceWorker event that is not
+-// autogenerated since it has some extra methods.
+-namespace workers {
+-class ExtendableEvent;
+-} // namespace workers
+ 
+ // Dummy class so we can cast through it to get from nsISupports to
+ // Event subclasses with only two non-ambiguous static casts.
+ class EventBase : public nsIDOMEvent
+ {
+ };
+ 
+ class Event : public EventBase,
+@@ -101,17 +99,17 @@ public:
+   {                                       \
+     return nullptr;                       \
+   }
+ #include "mozilla/dom/GeneratedEventList.h"
+ #undef GENERATED_EVENT
+ 
+   // ExtendableEvent is a ServiceWorker event that is not
+   // autogenerated since it has some extra methods.
+-  virtual workers::ExtendableEvent* AsExtendableEvent()
++  virtual ExtendableEvent* AsExtendableEvent()
+   {
+     return nullptr;
+   }
+ 
+   // nsIDOMEvent Interface
+   NS_DECL_NSIDOMEVENT
+ 
+   void InitPresContextData(nsPresContext* aPresContext);
+diff --git a/dom/events/MessageEvent.cpp b/dom/events/MessageEvent.cpp
+--- a/dom/events/MessageEvent.cpp
++++ b/dom/events/MessageEvent.cpp
+@@ -3,17 +3,17 @@
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "mozilla/dom/MessageEvent.h"
+ #include "mozilla/dom/MessageEventBinding.h"
+ #include "mozilla/dom/MessagePort.h"
+ #include "mozilla/dom/MessagePortBinding.h"
+-#include "mozilla/dom/workers/bindings/ServiceWorker.h"
++#include "mozilla/dom/ServiceWorker.h"
+ 
+ #include "mozilla/HoldDropJSObjects.h"
+ #include "jsapi.h"
+ #include "nsGlobalWindow.h" // So we can assign an nsGlobalWindow* to mWindowSource
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+diff --git a/dom/events/MessageEvent.h b/dom/events/MessageEvent.h
+--- a/dom/events/MessageEvent.h
++++ b/dom/events/MessageEvent.h
+@@ -12,22 +12,19 @@
+ #include "nsCycleCollectionParticipant.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ struct MessageEventInit;
+ class MessagePort;
+ class OwningWindowProxyOrMessagePortOrServiceWorker;
++class ServiceWorker;
+ class WindowProxyOrMessagePortOrServiceWorker;
+ 
+-namespace workers {
+-class ServiceWorker;
+-}
+-
+ /**
+  * Implements the MessageEvent event, used for cross-document messaging and
+  * server-sent events.
+  *
+  * See http://www.whatwg.org/specs/web-apps/current-work/#messageevent for
+  * further details.
+  */
+ class MessageEvent final : public Event
+@@ -74,17 +71,17 @@ protected:
+   ~MessageEvent();
+ 
+ private:
+   JS::Heap<JS::Value> mData;
+   nsString mOrigin;
+   nsString mLastEventId;
+   RefPtr<nsPIDOMWindowOuter> mWindowSource;
+   RefPtr<MessagePort> mPortSource;
+-  RefPtr<workers::ServiceWorker> mServiceWorkerSource;
++  RefPtr<ServiceWorker> mServiceWorkerSource;
+ 
+   nsTArray<RefPtr<MessagePort>> mPorts;
+ };
+ 
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_MessageEvent_h_
+diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
+--- a/dom/ipc/ContentChild.cpp
++++ b/dom/ipc/ContentChild.cpp
+@@ -32,18 +32,18 @@
+ #include "mozilla/dom/DocGroup.h"
+ #include "mozilla/dom/ExternalHelperAppChild.h"
+ #include "mozilla/dom/FileCreatorHelper.h"
+ #include "mozilla/dom/GetFilesHelper.h"
+ #include "mozilla/dom/IPCBlobUtils.h"
+ #include "mozilla/dom/MemoryReportRequest.h"
+ #include "mozilla/dom/ProcessGlobal.h"
+ #include "mozilla/dom/PushNotifier.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/dom/TabGroup.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "mozilla/dom/nsIContentChild.h"
+ #include "mozilla/dom/URLClassifierChild.h"
+ #include "mozilla/gfx/gfxVars.h"
+ #include "mozilla/psm/PSMContentListener.h"
+ #include "mozilla/hal_sandbox/PHalChild.h"
+ #include "mozilla/ipc/BackgroundChild.h"
+ #include "mozilla/ipc/FileDescriptorSetChild.h"
+ #include "mozilla/ipc/FileDescriptorUtils.h"
+diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp
+--- a/dom/notification/Notification.cpp
++++ b/dom/notification/Notification.cpp
+@@ -18,16 +18,17 @@
+ #include "mozilla/dom/BindingUtils.h"
+ #include "mozilla/dom/ContentChild.h"
+ #include "mozilla/dom/DOMPrefs.h"
+ #include "mozilla/dom/NotificationEvent.h"
+ #include "mozilla/dom/PermissionMessageUtils.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/PromiseWorkerProxy.h"
+ #include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ 
+ #include "nsAlertsUtils.h"
+ #include "nsComponentManagerUtils.h"
+ #include "nsContentPermissionHelper.h"
+ #include "nsContentUtils.h"
+ #include "nsCRTGlue.h"
+ #include "nsDOMJSUtils.h"
+ #include "nsGlobalWindow.h"
+@@ -46,17 +47,16 @@
+ #include "nsIXPConnect.h"
+ #include "nsNetUtil.h"
+ #include "nsProxyRelease.h"
+ #include "nsServiceManagerUtils.h"
+ #include "nsStructuredCloneContainer.h"
+ #include "nsThreadUtils.h"
+ #include "nsToolkitCompsCID.h"
+ #include "nsXULAppAPI.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "WorkerPrivate.h"
+ #include "WorkerRunnable.h"
+ #include "WorkerScope.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ using namespace workers;
+diff --git a/dom/push/PushNotifier.cpp b/dom/push/PushNotifier.cpp
+--- a/dom/push/PushNotifier.cpp
++++ b/dom/push/PushNotifier.cpp
+@@ -7,30 +7,29 @@
+ #include "PushNotifier.h"
+ 
+ #include "nsContentUtils.h"
+ #include "nsCOMPtr.h"
+ #include "nsICategoryManager.h"
+ #include "nsIXULRuntime.h"
+ #include "nsNetUtil.h"
+ #include "nsXPCOM.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ 
+ #include "mozilla/Services.h"
+ #include "mozilla/Unused.h"
+ 
+ #include "mozilla/dom/BodyUtil.h"
+ #include "mozilla/dom/ContentChild.h"
+ #include "mozilla/dom/ContentParent.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ using workers::AssertIsOnMainThread;
+-using workers::ServiceWorkerManager;
+ 
+ PushNotifier::PushNotifier()
+ {}
+ 
+ PushNotifier::~PushNotifier()
+ {}
+ 
+ NS_IMPL_CYCLE_COLLECTION_0(PushNotifier)
+diff --git a/dom/serviceworkers/ServiceWorker.cpp b/dom/serviceworkers/ServiceWorker.cpp
+--- a/dom/serviceworkers/ServiceWorker.cpp
++++ b/dom/serviceworkers/ServiceWorker.cpp
+@@ -22,56 +22,55 @@
+ #undef PostMessage
+ #endif
+ 
+ using mozilla::ErrorResult;
+ using namespace mozilla::dom;
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ bool
+ ServiceWorkerVisible(JSContext* aCx, JSObject* aObj)
+ {
+   if (NS_IsMainThread()) {
+     return DOMPrefs::ServiceWorkersEnabled();
+   }
+ 
+   return IS_INSTANCE_OF(ServiceWorkerGlobalScope, aObj);
+ }
+ 
+ ServiceWorker::ServiceWorker(nsPIDOMWindowInner* aWindow,
+                              ServiceWorkerInfo* aInfo)
+   : DOMEventTargetHelper(aWindow),
+     mInfo(aInfo)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aInfo);
+ 
+   // This will update our state too.
+   mInfo->AppendWorker(this);
+ }
+ 
+ ServiceWorker::~ServiceWorker()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mInfo->RemoveWorker(this);
+ }
+ 
+ NS_IMPL_ADDREF_INHERITED(ServiceWorker, DOMEventTargetHelper)
+ NS_IMPL_RELEASE_INHERITED(ServiceWorker, DOMEventTargetHelper)
+ 
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorker)
+ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
+ 
+ JSObject*
+ ServiceWorker::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   return ServiceWorkerBinding::Wrap(aCx, this, aGivenProto);
+ }
+ 
+ void
+ ServiceWorker::GetScriptURL(nsString& aURL) const
+ {
+   CopyUTF8toUTF16(mInfo->ScriptSpec(), aURL);
+@@ -111,11 +110,10 @@ ServiceWorker::PostMessage(JSContext* aC
+   }
+ 
+   ServiceWorkerPrivate* workerPrivate = mInfo->WorkerPrivate();
+   aRv = workerPrivate->SendMessageEvent(aCx, aMessage, aTransferable,
+                                         ClientInfoAndState(clientInfo.ref().ToIPC(),
+                                                            clientState.ref().ToIPC()));
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorker.h b/dom/serviceworkers/ServiceWorker.h
+--- a/dom/serviceworkers/ServiceWorker.h
++++ b/dom/serviceworkers/ServiceWorker.h
+@@ -1,28 +1,26 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworker_h__
+-#define mozilla_dom_workers_serviceworker_h__
++#ifndef mozilla_dom_serviceworker_h__
++#define mozilla_dom_serviceworker_h__
+ 
+ #include "mozilla/DOMEventTargetHelper.h"
+ #include "mozilla/dom/BindingDeclarations.h"
+ #include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState.
+ 
+ class nsPIDOMWindowInner;
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+-namespace workers {
+-
+ class ServiceWorkerInfo;
+ class ServiceWorkerManager;
+ class SharedWorker;
+ 
+ bool
+ ServiceWorkerVisible(JSContext* aCx, JSObject* aObj);
+ 
+ class ServiceWorker final : public DOMEventTargetHelper
+@@ -72,13 +70,12 @@ private:
+ 
+   // This class is reference-counted and will be destroyed from Release().
+   ~ServiceWorker();
+ 
+   ServiceWorkerState mState;
+   const RefPtr<ServiceWorkerInfo> mInfo;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworker_h__
++#endif // mozilla_dom_serviceworker_h__
+diff --git a/dom/serviceworkers/ServiceWorkerContainer.cpp b/dom/serviceworkers/ServiceWorkerContainer.cpp
+--- a/dom/serviceworkers/ServiceWorkerContainer.cpp
++++ b/dom/serviceworkers/ServiceWorkerContainer.cpp
+@@ -15,28 +15,24 @@
+ #include "mozilla/Services.h"
+ 
+ #include "nsCycleCollectionParticipant.h"
+ #include "nsServiceManagerUtils.h"
+ 
+ #include "mozilla/dom/DOMPrefs.h"
+ #include "mozilla/dom/Navigator.h"
+ #include "mozilla/dom/Promise.h"
++#include "mozilla/dom/ServiceWorker.h"
+ #include "mozilla/dom/ServiceWorkerContainerBinding.h"
+-#include "mozilla/dom/workers/bindings/ServiceWorker.h"
+ 
+ #include "ServiceWorker.h"
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+-using mozilla::dom::workers::ServiceWorkerInfo;
+-using mozilla::dom::workers::ServiceWorkerManager;
+-using mozilla::dom::workers::ServiceWorkerRegistrationInfo;
+-
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerContainer)
+ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
+ 
+ NS_IMPL_ADDREF_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
+ NS_IMPL_RELEASE_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
+ 
+ NS_IMPL_CYCLE_COLLECTION_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper,
+                                    mControllerWorker, mReadyPromise)
+@@ -212,17 +208,17 @@ ServiceWorkerContainer::Register(const n
+     return nullptr;
+   }
+ 
+   RefPtr<Promise> ret = static_cast<Promise*>(promise.get());
+   MOZ_ASSERT(ret);
+   return ret.forget();
+ }
+ 
+-already_AddRefed<workers::ServiceWorker>
++already_AddRefed<ServiceWorker>
+ ServiceWorkerContainer::GetController()
+ {
+   if (!mControllerWorker) {
+     // If we don't have a controller reference cached, then we need to
+     // check if we should create one.  We try to do this in a thread-agnostic
+     // way here to help support workers in the future.  There are still
+     // some main thread calls for now, though.
+ 
+@@ -253,17 +249,17 @@ ServiceWorkerContainer::GetController()
+     NS_ENSURE_TRUE(inner, nullptr);
+ 
+     // Right now we only know how to create ServiceWorker DOM objects on
+     // the main thread with a window.  In the future this should operate
+     // on only nsIGlobalObject somehow.
+     mControllerWorker = info->GetOrCreateInstance(inner);
+   }
+ 
+-  RefPtr<workers::ServiceWorker> ref = mControllerWorker;
++  RefPtr<ServiceWorker> ref = mControllerWorker;
+   return ref.forget();
+ }
+ 
+ already_AddRefed<Promise>
+ ServiceWorkerContainer::GetRegistrations(ErrorResult& aRv)
+ {
+   nsresult rv;
+   nsCOMPtr<nsIServiceWorkerManager> swm = do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
+diff --git a/dom/serviceworkers/ServiceWorkerContainer.h b/dom/serviceworkers/ServiceWorkerContainer.h
+--- a/dom/serviceworkers/ServiceWorkerContainer.h
++++ b/dom/serviceworkers/ServiceWorkerContainer.h
+@@ -11,20 +11,17 @@
+ 
+ class nsPIDOMWindowInner;
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ class Promise;
+ struct RegistrationOptions;
+-
+-namespace workers {
+ class ServiceWorker;
+-} // namespace workers
+ 
+ // Lightweight serviceWorker APIs collection.
+ class ServiceWorkerContainer final : public DOMEventTargetHelper
+ {
+ public:
+   NS_DECL_ISUPPORTS_INHERITED
+   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
+ 
+@@ -39,17 +36,17 @@ public:
+   virtual JSObject*
+   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+ 
+   already_AddRefed<Promise>
+   Register(const nsAString& aScriptURL,
+            const RegistrationOptions& aOptions,
+            ErrorResult& aRv);
+ 
+-  already_AddRefed<workers::ServiceWorker>
++  already_AddRefed<ServiceWorker>
+   GetController();
+ 
+   already_AddRefed<Promise>
+   GetRegistration(const nsAString& aDocumentURL,
+                   ErrorResult& aRv);
+ 
+   already_AddRefed<Promise>
+   GetRegistrations(ErrorResult& aRv);
+@@ -71,17 +68,17 @@ public:
+ 
+ private:
+   ~ServiceWorkerContainer();
+ 
+   void RemoveReadyPromise();
+ 
+   // This only changes when a worker hijacks everything in its scope by calling
+   // claim.
+-  RefPtr<workers::ServiceWorker> mControllerWorker;
++  RefPtr<ServiceWorker> mControllerWorker;
+ 
+   RefPtr<Promise> mReadyPromise;
+ };
+ 
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif /* mozilla_dom_workers_serviceworkercontainer_h__ */
++#endif /* mozilla_dom_serviceworkercontainer_h__ */
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -19,16 +19,17 @@
+ #include "nsContentUtils.h"
+ #include "nsComponentManagerUtils.h"
+ #include "nsServiceManagerUtils.h"
+ #include "nsStreamUtils.h"
+ #include "nsNetCID.h"
+ #include "nsNetUtil.h"
+ #include "nsSerializationHelper.h"
+ #include "nsQueryObject.h"
++#include "ServiceWorker.h"
+ #include "ServiceWorkerManager.h"
+ 
+ #include "mozilla/ErrorResult.h"
+ #include "mozilla/LoadInfo.h"
+ #include "mozilla/Move.h"
+ #include "mozilla/Preferences.h"
+ #include "mozilla/dom/BodyUtil.h"
+ #include "mozilla/dom/Client.h"
+@@ -37,17 +38,16 @@
+ #include "mozilla/dom/PromiseNativeHandler.h"
+ #include "mozilla/dom/PushEventBinding.h"
+ #include "mozilla/dom/PushMessageDataBinding.h"
+ #include "mozilla/dom/PushUtil.h"
+ #include "mozilla/dom/Request.h"
+ #include "mozilla/dom/TypedArray.h"
+ #include "mozilla/dom/Response.h"
+ #include "mozilla/dom/WorkerScope.h"
+-#include "mozilla/dom/workers/bindings/ServiceWorker.h"
+ 
+ #include "js/Conversions.h"
+ #include "js/TypeDecls.h"
+ #include "WorkerPrivate.h"
+ #include "xpcpublic.h"
+ 
+ using namespace mozilla;
+ using namespace mozilla::dom;
+@@ -89,23 +89,24 @@ AsyncLog(nsIInterceptedChannel* aInterce
+   StringArrayAppender::Append(paramsList, sizeof...(Params) + 1,
+                               aFirstParam, Forward<Params>(aParams)...);
+   AsyncLog(aInterceptedChannel, aRespondWithScriptSpec, aRespondWithLineNumber,
+            aRespondWithColumnNumber, aMessageName, paramsList);
+ }
+ 
+ } // anonymous namespace
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ CancelChannelRunnable::CancelChannelRunnable(
+   nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo>& aRegistration,
+   nsresult aStatus)
+-  : Runnable("dom::workers::CancelChannelRunnable")
++  : Runnable("dom::CancelChannelRunnable")
+   , mChannel(aChannel)
+   , mRegistration(aRegistration)
+   , mStatus(aStatus)
+ {
+ }
+ 
+ NS_IMETHODIMP
+ CancelChannelRunnable::Run()
+@@ -192,25 +193,25 @@ struct RespondWithClosure
+ };
+ 
+ class FinishResponse final : public Runnable
+ {
+   nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
+ 
+ public:
+   explicit FinishResponse(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel)
+-    : Runnable("dom::workers::FinishResponse")
++    : Runnable("dom::FinishResponse")
+     , mChannel(aChannel)
+   {
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     nsresult rv = mChannel->FinishSynthesizedResponse();
+     if (NS_WARN_IF(NS_FAILED(rv))) {
+       mChannel->CancelInterception(NS_ERROR_INTERCEPTION_FAILED);
+       return NS_OK;
+     }
+ 
+     TimeStamp timeStamp = TimeStamp::Now();
+@@ -278,30 +279,30 @@ class StartResponse final : public Runna
+ 
+ public:
+   StartResponse(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
+                 InternalResponse* aInternalResponse,
+                 const ChannelInfo& aWorkerChannelInfo,
+                 const nsACString& aScriptSpec,
+                 const nsACString& aResponseURLSpec,
+                 UniquePtr<RespondWithClosure>&& aClosure)
+-    : Runnable("dom::workers::StartResponse")
++    : Runnable("dom::StartResponse")
+     , mChannel(aChannel)
+     , mInternalResponse(aInternalResponse)
+     , mWorkerChannelInfo(aWorkerChannelInfo)
+     , mScriptSpec(aScriptSpec)
+     , mResponseURLSpec(aResponseURLSpec)
+     , mClosure(Move(aClosure))
+   {
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     nsCOMPtr<nsIChannel> underlyingChannel;
+     nsresult rv = mChannel->GetChannel(getter_AddRefs(underlyingChannel));
+     NS_ENSURE_SUCCESS(rv, rv);
+     NS_ENSURE_TRUE(underlyingChannel, NS_ERROR_UNEXPECTED);
+     nsCOMPtr<nsILoadInfo> loadInfo = underlyingChannel->GetLoadInfo();
+ 
+     if (!loadInfo || !CSPPermitsResponse(loadInfo)) {
+@@ -378,17 +379,17 @@ public:
+       obsService->NotifyObservers(underlyingChannel, "service-worker-synthesized-response", nullptr);
+     }
+ 
+     return rv;
+   }
+ 
+   bool CSPPermitsResponse(nsILoadInfo* aLoadInfo)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aLoadInfo);
+     nsresult rv;
+     nsCOMPtr<nsIURI> uri;
+     nsCString url = mInternalResponse->GetUnfilteredURL();
+     if (url.IsEmpty()) {
+       // Synthetic response. The buck stops at the worker script.
+       url = mScriptSpec;
+     }
+@@ -915,17 +916,17 @@ public:
+     MOZ_ALWAYS_SUCCEEDS(mWorkerPrivate->DispatchToMainThread(
+                           NewRunnableMethod("WaitUntilHandler::ReportOnMainThread",
+                                             this, &WaitUntilHandler::ReportOnMainThread)));
+   }
+ 
+   void
+   ReportOnMainThread()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (!swm) {
+       // browser shutdown
+       return;
+     }
+ 
+     // TODO: Make the error message a localized string. (bug 1222720)
+     nsString message;
+@@ -1301,9 +1302,10 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INH
+ NS_IMPL_CYCLE_COLLECTION_TRACE_END
+ 
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ExtendableMessageEvent)
+ NS_INTERFACE_MAP_END_INHERITING(Event)
+ 
+ NS_IMPL_ADDREF_INHERITED(ExtendableMessageEvent, Event)
+ NS_IMPL_RELEASE_INHERITED(ExtendableMessageEvent, Event)
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.h b/dom/serviceworkers/ServiceWorkerEvents.h
+--- a/dom/serviceworkers/ServiceWorkerEvents.h
++++ b/dom/serviceworkers/ServiceWorkerEvents.h
+@@ -1,48 +1,47 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerevents_h__
+-#define mozilla_dom_workers_serviceworkerevents_h__
++#ifndef mozilla_dom_serviceworkerevents_h__
++#define mozilla_dom_serviceworkerevents_h__
+ 
+ #include "mozilla/dom/DOMPrefs.h"
+ #include "mozilla/dom/Event.h"
+ #include "mozilla/dom/ExtendableEventBinding.h"
+ #include "mozilla/dom/ExtendableMessageEventBinding.h"
+ #include "mozilla/dom/FetchEventBinding.h"
+ #include "mozilla/dom/File.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/Response.h"
+-#include "mozilla/dom/workers/bindings/ServiceWorker.h"
+ #include "mozilla/dom/workers/Workers.h"
+ 
+ #include "nsProxyRelease.h"
+ #include "nsContentUtils.h"
+ 
+ class nsIInterceptedChannel;
+ 
+ namespace mozilla {
+ namespace dom {
++
+ class Blob;
+ class Client;
+ class MessagePort;
++struct PushEventInit;
+ class Request;
+ class ResponseOrPromise;
++class ServiceWorker;
++class ServiceWorkerRegistrationInfo;
+ 
+-struct PushEventInit;
+-} // namespace dom
+-} // namespace mozilla
+-
+-BEGIN_WORKERS_NAMESPACE
+-
+-class ServiceWorkerRegistrationInfo;
++// Defined in ServiceWorker.cpp
++bool
++ServiceWorkerVisible(JSContext* aCx, JSObject* aObj);
+ 
+ class CancelChannelRunnable final : public Runnable
+ {
+   nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> mRegistration;
+   const nsresult mStatus;
+ public:
+   CancelChannelRunnable(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
+@@ -320,11 +319,12 @@ public:
+   {
+     aLastEventId = mLastEventId;
+     return NS_OK;
+   }
+ 
+   void GetPorts(nsTArray<RefPtr<MessagePort>>& aPorts);
+ };
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+ 
+-#endif /* mozilla_dom_workers_serviceworkerevents_h__ */
++#endif /* mozilla_dom_serviceworkerevents_h__ */
+diff --git a/dom/serviceworkers/ServiceWorkerInfo.cpp b/dom/serviceworkers/ServiceWorkerInfo.cpp
+--- a/dom/serviceworkers/ServiceWorkerInfo.cpp
++++ b/dom/serviceworkers/ServiceWorkerInfo.cpp
+@@ -3,17 +3,18 @@
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerInfo.h"
+ 
+ #include "ServiceWorkerScriptCache.h"
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ using mozilla::ipc::PrincipalInfo;
+ 
+ static_assert(nsIServiceWorkerInfo::STATE_PARSED == static_cast<uint16_t>(ServiceWorkerState::Parsed),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ static_assert(nsIServiceWorkerInfo::STATE_INSTALLING == static_cast<uint16_t>(ServiceWorkerState::Installing),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ static_assert(nsIServiceWorkerInfo::STATE_INSTALLED == static_cast<uint16_t>(ServiceWorkerState::Installed),
+@@ -27,34 +28,34 @@ static_assert(nsIServiceWorkerInfo::STAT
+ static_assert(nsIServiceWorkerInfo::STATE_UNKNOWN == static_cast<uint16_t>(ServiceWorkerState::EndGuard_),
+               "ServiceWorkerState enumeration value should match state values from nsIServiceWorkerInfo.");
+ 
+ NS_IMPL_ISUPPORTS(ServiceWorkerInfo, nsIServiceWorkerInfo)
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetScriptSpec(nsAString& aScriptSpec)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   CopyUTF8toUTF16(mScriptSpec, aScriptSpec);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetCacheName(nsAString& aCacheName)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   aCacheName = mCacheName;
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetState(uint16_t* aState)
+ {
+   MOZ_ASSERT(aState);
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   *aState = static_cast<uint16_t>(State());
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetDebugger(nsIWorkerDebugger** aResult)
+ {
+   if (NS_WARN_IF(!aResult)) {
+@@ -63,43 +64,43 @@ ServiceWorkerInfo::GetDebugger(nsIWorker
+ 
+   return mServiceWorkerPrivate->GetDebugger(aResult);
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetHandlesFetchEvents(bool* aValue)
+ {
+   MOZ_ASSERT(aValue);
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   *aValue = HandlesFetch();
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetInstalledTime(PRTime* _retval)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(_retval);
+   *_retval = mInstalledTime;
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetActivatedTime(PRTime* _retval)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(_retval);
+   *_retval = mActivatedTime;
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::GetRedundantTime(PRTime* _retval)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(_retval);
+   *_retval = mRedundantTime;
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerInfo::AttachDebugger()
+ {
+@@ -143,17 +144,17 @@ ServiceWorkerInfo::RemoveWorker(ServiceW
+ 
+ namespace {
+ 
+ class ChangeStateUpdater final : public Runnable
+ {
+ public:
+   ChangeStateUpdater(const nsTArray<ServiceWorker*>& aInstances,
+                      ServiceWorkerState aState)
+-    : Runnable("dom::workers::ChangeStateUpdater")
++    : Runnable("dom::ChangeStateUpdater")
+     , mState(aState)
+   {
+     for (size_t i = 0; i < aInstances.Length(); ++i) {
+       mInstances.AppendElement(aInstances[i]);
+     }
+   }
+ 
+   NS_IMETHOD Run() override
+@@ -176,17 +177,17 @@ private:
+   ServiceWorkerState mState;
+ };
+ 
+ }
+ 
+ void
+ ServiceWorkerInfo::UpdateState(ServiceWorkerState aState)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ #ifdef DEBUG
+   // Any state can directly transition to redundant, but everything else is
+   // ordered.
+   if (aState != ServiceWorkerState::Redundant) {
+     MOZ_ASSERT_IF(State() == ServiceWorkerState::EndGuard_,
+                   aState == ServiceWorkerState::Installing);
+     MOZ_ASSERT_IF(State() == ServiceWorkerState::Installing,
+                   aState == ServiceWorkerState::Installed);
+@@ -262,17 +263,17 @@ uint64_t
+ ServiceWorkerInfo::GetNextID() const
+ {
+   return ++gServiceWorkerInfoCurrentID;
+ }
+ 
+ already_AddRefed<ServiceWorker>
+ ServiceWorkerInfo::GetOrCreateInstance(nsPIDOMWindowInner* aWindow)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aWindow);
+ 
+   RefPtr<ServiceWorker> ref;
+ 
+   for (uint32_t i = 0; i < mInstances.Length(); ++i) {
+     MOZ_ASSERT(mInstances[i]);
+     if (mInstances[i]->GetOwner() == aWindow) {
+       ref = mInstances[i];
+@@ -315,9 +316,10 @@ ServiceWorkerInfo::UpdateRedundantTime()
+   MOZ_ASSERT(State() == ServiceWorkerState::Redundant);
+   MOZ_ASSERT(mRedundantTime == 0);
+ 
+   mRedundantTime =
+     mCreationTime + static_cast<PRTime>((TimeStamp::Now() -
+                                          mCreationTimeStamp).ToMicroseconds());
+ }
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerInfo.h b/dom/serviceworkers/ServiceWorkerInfo.h
+--- a/dom/serviceworkers/ServiceWorkerInfo.h
++++ b/dom/serviceworkers/ServiceWorkerInfo.h
+@@ -1,24 +1,24 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerinfo_h
+-#define mozilla_dom_workers_serviceworkerinfo_h
++#ifndef mozilla_dom_serviceworkerinfo_h
++#define mozilla_dom_serviceworkerinfo_h
+ 
++#include "MainThreadUtils.h"
+ #include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState
+ #include "mozilla/dom/workers/Workers.h"
+ #include "nsIServiceWorkerManager.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorker;
+ class ServiceWorkerPrivate;
+ 
+ /*
+  * Wherever the spec treats a worker instance and a description of said worker
+  * as the same thing; i.e. "Resolve foo with
+  * _GetNewestWorker(serviceWorkerRegistration)", we represent the description
+@@ -101,23 +101,23 @@ public:
+   const nsCString&
+   Scope() const
+   {
+     return mDescriptor.Scope();
+   }
+ 
+   bool SkipWaitingFlag() const
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     return mSkipWaitingFlag;
+   }
+ 
+   void SetSkipWaitingFlag()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mSkipWaitingFlag = true;
+   }
+ 
+   ServiceWorkerInfo(nsIPrincipal* aPrincipal,
+                     const nsACString& aScope,
+                     const nsACString& aScriptSpec,
+                     const nsAString& aCacheName,
+                     nsLoadFlags aLoadFlags);
+@@ -160,32 +160,32 @@ public:
+ 
+   void
+   UpdateState(ServiceWorkerState aState);
+ 
+   // Only used to set initial state when loading from disk!
+   void
+   SetActivateStateUncheckedWithoutEvent(ServiceWorkerState aState)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mDescriptor.SetState(aState);
+   }
+ 
+   void
+   SetHandlesFetch(bool aHandlesFetch)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_DIAGNOSTIC_ASSERT(mHandlesFetch == Unknown);
+     mHandlesFetch = aHandlesFetch ? Enabled : Disabled;
+   }
+ 
+   bool
+   HandlesFetch() const
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_DIAGNOSTIC_ASSERT(mHandlesFetch != Unknown);
+     return mHandlesFetch != Disabled;
+   }
+ 
+   void
+   AppendWorker(ServiceWorker* aWorker);
+ 
+   void
+@@ -231,13 +231,12 @@ public:
+     if (aTime == 0) {
+       return;
+     }
+ 
+     mActivatedTime = aTime;
+   }
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerinfo_h
++#endif // mozilla_dom_serviceworkerinfo_h
+diff --git a/dom/serviceworkers/ServiceWorkerJob.cpp b/dom/serviceworkers/ServiceWorkerJob.cpp
+--- a/dom/serviceworkers/ServiceWorkerJob.cpp
++++ b/dom/serviceworkers/ServiceWorkerJob.cpp
+@@ -7,17 +7,16 @@
+ #include "ServiceWorkerJob.h"
+ 
+ #include "nsProxyRelease.h"
+ #include "nsThreadUtils.h"
+ #include "Workers.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ ServiceWorkerJob::Type
+ ServiceWorkerJob::GetType() const
+ {
+   return mType;
+ }
+ 
+ ServiceWorkerJob::State
+@@ -36,40 +35,40 @@ bool
+ ServiceWorkerJob::ResultCallbacksInvoked() const
+ {
+   return mResultCallbacksInvoked;
+ }
+ 
+ bool
+ ServiceWorkerJob::IsEquivalentTo(ServiceWorkerJob* aJob) const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aJob);
+   return mType == aJob->mType &&
+          mScope.Equals(aJob->mScope) &&
+          mScriptSpec.Equals(aJob->mScriptSpec) &&
+          mPrincipal->Equals(aJob->mPrincipal);
+ }
+ 
+ void
+ ServiceWorkerJob::AppendResultCallback(Callback* aCallback)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_DIAGNOSTIC_ASSERT(mState != State::Finished);
+   MOZ_DIAGNOSTIC_ASSERT(aCallback);
+   MOZ_DIAGNOSTIC_ASSERT(mFinalCallback != aCallback);
+   MOZ_ASSERT(!mResultCallbackList.Contains(aCallback));
+   MOZ_DIAGNOSTIC_ASSERT(!mResultCallbacksInvoked);
+   mResultCallbackList.AppendElement(aCallback);
+ }
+ 
+ void
+ ServiceWorkerJob::StealResultCallbacksFrom(ServiceWorkerJob* aJob)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aJob);
+   MOZ_ASSERT(aJob->mState == State::Initial);
+ 
+   // Take the callbacks from the other job immediately to avoid the
+   // any possibility of them existing on both jobs at once.
+   nsTArray<RefPtr<Callback>> callbackList;
+   callbackList.SwapElements(aJob->mResultCallbackList);
+ 
+@@ -78,17 +77,17 @@ ServiceWorkerJob::StealResultCallbacksFr
+     // each callback.
+     AppendResultCallback(callback);
+   }
+ }
+ 
+ void
+ ServiceWorkerJob::Start(Callback* aFinalCallback)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_DIAGNOSTIC_ASSERT(!mCanceled);
+ 
+   MOZ_DIAGNOSTIC_ASSERT(aFinalCallback);
+   MOZ_DIAGNOSTIC_ASSERT(!mFinalCallback);
+   MOZ_ASSERT(!mResultCallbackList.Contains(aFinalCallback));
+   mFinalCallback = aFinalCallback;
+ 
+   MOZ_DIAGNOSTIC_ASSERT(mState == State::Initial);
+@@ -110,52 +109,52 @@ ServiceWorkerJob::Start(Callback* aFinal
+   // Otherwise start asynchronously.  We should never run a job synchronously.
+   MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+     NS_DispatchToMainThread(runnable.forget())));
+ }
+ 
+ void
+ ServiceWorkerJob::Cancel()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(!mCanceled);
+   mCanceled = true;
+ }
+ 
+ ServiceWorkerJob::ServiceWorkerJob(Type aType,
+                                    nsIPrincipal* aPrincipal,
+                                    const nsACString& aScope,
+                                    const nsACString& aScriptSpec)
+   : mType(aType)
+   , mPrincipal(aPrincipal)
+   , mScope(aScope)
+   , mScriptSpec(aScriptSpec)
+   , mState(State::Initial)
+   , mCanceled(false)
+   , mResultCallbacksInvoked(false)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mPrincipal);
+   MOZ_ASSERT(!mScope.IsEmpty());
+   // Some job types may have an empty script spec
+ }
+ 
+ ServiceWorkerJob::~ServiceWorkerJob()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   // Jobs must finish or never be started.  Destroying an actively running
+   // job is an error.
+   MOZ_ASSERT(mState != State::Started);
+   MOZ_ASSERT_IF(mState == State::Finished, mResultCallbacksInvoked);
+ }
+ 
+ void
+ ServiceWorkerJob::InvokeResultCallbacks(ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_DIAGNOSTIC_ASSERT(mState == State::Started);
+ 
+   MOZ_DIAGNOSTIC_ASSERT(!mResultCallbacksInvoked);
+   mResultCallbacksInvoked = true;
+ 
+   nsTArray<RefPtr<Callback>> callbackList;
+   callbackList.SwapElements(mResultCallbackList);
+ 
+@@ -177,17 +176,17 @@ ServiceWorkerJob::InvokeResultCallbacks(
+ {
+   ErrorResult converted(aRv);
+   InvokeResultCallbacks(converted);
+ }
+ 
+ void
+ ServiceWorkerJob::Finish(ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // Avoid double-completion because it can result on operating on cleaned
+   // up data.  This should not happen, though, so also assert to try to
+   // narrow down the causes.
+   MOZ_DIAGNOSTIC_ASSERT(mState == State::Started);
+   if (mState != State::Started) {
+     return;
+   }
+@@ -233,11 +232,10 @@ ServiceWorkerJob::Finish(ErrorResult& aR
+ 
+ void
+ ServiceWorkerJob::Finish(nsresult aRv)
+ {
+   ErrorResult converted(aRv);
+   Finish(converted);
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerJob.h b/dom/serviceworkers/ServiceWorkerJob.h
+--- a/dom/serviceworkers/ServiceWorkerJob.h
++++ b/dom/serviceworkers/ServiceWorkerJob.h
+@@ -1,29 +1,28 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerjob_h
+-#define mozilla_dom_workers_serviceworkerjob_h
++#ifndef mozilla_dom_serviceworkerjob_h
++#define mozilla_dom_serviceworkerjob_h
+ 
+ #include "nsCOMPtr.h"
+ #include "nsString.h"
+ #include "nsTArray.h"
+ 
+ class nsIPrincipal;
+ 
+ namespace mozilla {
+ 
+ class ErrorResult;
+ 
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerJob
+ {
+ public:
+   // Implement this interface to receive notification when a job completes.
+   class Callback
+   {
+   public:
+@@ -139,13 +138,12 @@ private:
+   State mState;
+   bool mCanceled;
+   bool mResultCallbacksInvoked;
+ 
+ public:
+   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJob)
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerjob_h
++#endif // mozilla_dom_serviceworkerjob_h
+diff --git a/dom/serviceworkers/ServiceWorkerJobQueue.cpp b/dom/serviceworkers/ServiceWorkerJobQueue.cpp
+--- a/dom/serviceworkers/ServiceWorkerJobQueue.cpp
++++ b/dom/serviceworkers/ServiceWorkerJobQueue.cpp
+@@ -6,54 +6,53 @@
+ 
+ #include "ServiceWorkerJobQueue.h"
+ 
+ #include "ServiceWorkerJob.h"
+ #include "Workers.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerJobQueue::Callback final : public ServiceWorkerJob::Callback
+ {
+   RefPtr<ServiceWorkerJobQueue> mQueue;
+ 
+   ~Callback()
+   {
+   }
+ 
+ public:
+   explicit Callback(ServiceWorkerJobQueue* aQueue)
+     : mQueue(aQueue)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mQueue);
+   }
+ 
+   virtual void
+   JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mQueue->JobFinished(aJob);
+   }
+ 
+   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue::Callback, override)
+ };
+ 
+ ServiceWorkerJobQueue::~ServiceWorkerJobQueue()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mJobList.IsEmpty());
+ }
+ 
+ void
+ ServiceWorkerJobQueue::JobFinished(ServiceWorkerJob* aJob)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aJob);
+ 
+   // XXX There are some corner cases where jobs can double-complete.  Until
+   // we track all these down we do a non-fatal assert in debug builds and
+   // a runtime check to verify the queue is in the correct state.
+   NS_ASSERTION(!mJobList.IsEmpty(),
+                "Job queue should contain the job that just completed.");
+   NS_ASSERTION(mJobList.SafeElementAt(0, nullptr) == aJob,
+@@ -69,33 +68,33 @@ ServiceWorkerJobQueue::JobFinished(Servi
+   }
+ 
+   RunJob();
+ }
+ 
+ void
+ ServiceWorkerJobQueue::RunJob()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(!mJobList.IsEmpty());
+   MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob::State::Initial);
+ 
+   RefPtr<Callback> callback = new Callback(this);
+   mJobList[0]->Start(callback);
+ }
+ 
+ ServiceWorkerJobQueue::ServiceWorkerJobQueue()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ }
+ 
+ void
+ ServiceWorkerJobQueue::ScheduleJob(ServiceWorkerJob* aJob)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aJob);
+   MOZ_ASSERT(!mJobList.Contains(aJob));
+ 
+   if (mJobList.IsEmpty()) {
+     mJobList.AppendElement(aJob);
+     RunJob();
+     return;
+   }
+@@ -109,26 +108,25 @@ ServiceWorkerJobQueue::ScheduleJob(Servi
+   }
+ 
+   mJobList.AppendElement(aJob);
+ }
+ 
+ void
+ ServiceWorkerJobQueue::CancelAll()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   for (RefPtr<ServiceWorkerJob>& job : mJobList) {
+     job->Cancel();
+   }
+ 
+   // Remove jobs that are queued but not started since they should never
+   // run after being canceled.  This means throwing away all jobs except
+   // for the job at the front of the list.
+   if (!mJobList.IsEmpty()) {
+     MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob::State::Started);
+     mJobList.TruncateLength(1);
+   }
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerJobQueue.h b/dom/serviceworkers/ServiceWorkerJobQueue.h
+--- a/dom/serviceworkers/ServiceWorkerJobQueue.h
++++ b/dom/serviceworkers/ServiceWorkerJobQueue.h
+@@ -1,23 +1,22 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerjobqueue_h
+-#define mozilla_dom_workers_serviceworkerjobqueue_h
++#ifndef mozilla_dom_serviceworkerjobqueue_h
++#define mozilla_dom_serviceworkerjobqueue_h
+ 
+ #include "mozilla/RefPtr.h"
+ #include "nsTArray.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerJob;
+ 
+ class ServiceWorkerJobQueue final
+ {
+   class Callback;
+ 
+   nsTArray<RefPtr<ServiceWorkerJob>> mJobList;
+@@ -37,13 +36,12 @@ public:
+   ScheduleJob(ServiceWorkerJob* aJob);
+ 
+   void
+   CancelAll();
+ 
+   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue)
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerjobqueue_h
++#endif // mozilla_dom_serviceworkerjobqueue_h
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
+@@ -91,17 +91,18 @@
+ #ifdef PostMessage
+ #undef PostMessage
+ #endif
+ 
+ using namespace mozilla;
+ using namespace mozilla::dom;
+ using namespace mozilla::ipc;
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ #define PURGE_DOMAIN_DATA "browser:purge-domain-data"
+ #define PURGE_SESSION_HISTORY "browser:purge-session-history"
+ #define CLEAR_ORIGIN_DATA "clear-origin-attributes-data"
+ 
+ static_assert(nsIHttpChannelInternal::CORS_MODE_SAME_ORIGIN == static_cast<uint32_t>(RequestMode::Same_origin),
+               "RequestMode enumeration value should match Necko CORS mode value.");
+ static_assert(nsIHttpChannelInternal::CORS_MODE_NO_CORS == static_cast<uint32_t>(RequestMode::No_cors),
+@@ -218,17 +219,17 @@ PopulateRegistrationData(nsIPrincipal* a
+ 
+   return NS_OK;
+ }
+ 
+ class TeardownRunnable final : public Runnable
+ {
+ public:
+   explicit TeardownRunnable(ServiceWorkerManagerChild* aActor)
+-    : Runnable("dom::workers::TeardownRunnable")
++    : Runnable("dom::ServiceWorkerManager::TeardownRunnable")
+     , mActor(aActor)
+   {
+     MOZ_ASSERT(mActor);
+   }
+ 
+   NS_IMETHOD Run() override
+   {
+     MOZ_ASSERT(mActor);
+@@ -438,17 +439,17 @@ class ServiceWorkerResolveWindowPromiseO
+   PromiseWindowProxy mPromise;
+ 
+   ~ServiceWorkerResolveWindowPromiseOnRegisterCallback()
+   {}
+ 
+   virtual void
+   JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aJob);
+     RefPtr<Promise> promise = mPromise.Get();
+     if (!promise) {
+       return;
+     }
+ 
+     if (aStatus.Failed()) {
+       promise->MaybeReject(aStatus);
+@@ -481,24 +482,24 @@ public:
+ 
+ namespace {
+ 
+ class PropagateSoftUpdateRunnable final : public Runnable
+ {
+ public:
+   PropagateSoftUpdateRunnable(const OriginAttributes& aOriginAttributes,
+                               const nsAString& aScope)
+-    : Runnable("dom::workers::PropagateSoftUpdateRunnable")
++    : Runnable("dom::ServiceWorkerManager::PropagateSoftUpdateRunnable")
+     , mOriginAttributes(aOriginAttributes)
+     , mScope(aScope)
+   {}
+ 
+   NS_IMETHOD Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (swm) {
+       swm->PropagateSoftUpdate(mOriginAttributes, mScope);
+     }
+ 
+     return NS_OK;
+   }
+@@ -570,26 +571,26 @@ private:
+ //   notified by the parent (aInternalMethod == true)
+ class SoftUpdateRunnable final : public CancelableRunnable
+ {
+ public:
+   SoftUpdateRunnable(const OriginAttributes& aOriginAttributes,
+                      const nsACString& aScope,
+                      bool aInternalMethod,
+                      GenericPromise::Private* aPromise)
+-    : CancelableRunnable("dom::workers::SoftUpdateRunnable")
++    : CancelableRunnable("dom::ServiceWorkerManager::SoftUpdateRunnable")
+     , mAttrs(aOriginAttributes)
+     , mScope(aScope)
+     , mInternalMethod(aInternalMethod)
+     , mPromise(aPromise)
+   {}
+ 
+   NS_IMETHOD Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (!swm) {
+       return NS_ERROR_FAILURE;
+     }
+ 
+     if (mInternalMethod) {
+       RefPtr<PromiseResolverCallback> callback =
+@@ -641,27 +642,27 @@ public:
+     eFailure,
+   };
+ 
+   UpdateRunnable(nsIPrincipal* aPrincipal,
+                  const nsACString& aScope,
+                  ServiceWorkerUpdateFinishCallback* aCallback,
+                  Type aType,
+                  GenericPromise::Private* aPromise)
+-    : CancelableRunnable("dom::workers::UpdateRunnable")
++    : CancelableRunnable("dom::ServiceWorkerManager::UpdateRunnable")
+     , mPrincipal(aPrincipal)
+     , mScope(aScope)
+     , mCallback(aCallback)
+     , mType(aType)
+     , mPromise(aPromise)
+   {}
+ 
+   NS_IMETHOD Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (!swm) {
+       return NS_ERROR_FAILURE;
+     }
+ 
+     if (mType == ePostpone) {
+       swm->Update(mPrincipal, mScope, mCallback);
+@@ -706,17 +707,17 @@ private:
+ 
+   RefPtr<GenericPromise::Private> mPromise;
+ };
+ 
+ class ResolvePromiseRunnable final : public CancelableRunnable
+ {
+ public:
+   explicit ResolvePromiseRunnable(GenericPromise::Private* aPromise)
+-    : CancelableRunnable("dom::workers::ResolvePromiseRunnable")
++    : CancelableRunnable("dom::ServiceWorkerManager::ResolvePromiseRunnable")
+     , mPromise(aPromise)
+   {}
+ 
+   NS_IMETHOD
+   Run() override
+   {
+     MaybeResolve();
+     return NS_OK;
+@@ -786,17 +787,17 @@ IsFromAuthenticatedOrigin(nsIDocument* a
+ // automatically reject the Promise.
+ NS_IMETHODIMP
+ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
+                                nsIURI* aScopeURI,
+                                nsIURI* aScriptURI,
+                                uint16_t aUpdateViaCache,
+                                nsISupports** aPromise)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!aWindow)) {
+     return NS_ERROR_DOM_INVALID_STATE_ERR;
+   }
+ 
+   auto* window = nsPIDOMWindowInner::From(aWindow);
+ 
+   nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+@@ -930,33 +931,33 @@ ServiceWorkerManager::Register(mozIDOMWi
+   RefPtr<ServiceWorkerRegisterJob> job = new ServiceWorkerRegisterJob(
+     documentPrincipal, cleanedScope, spec, loadGroup,
+     static_cast<ServiceWorkerUpdateViaCache>(aUpdateViaCache)
+   );
+ 
+   job->AppendResultCallback(cb);
+   queue->ScheduleJob(job);
+ 
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REGISTRATIONS, 1);
+ 
+   promise.forget(aPromise);
+   return NS_OK;
+ }
+ 
+ /*
+  * Implements the async aspects of the getRegistrations algorithm.
+  */
+ class GetRegistrationsRunnable final : public Runnable
+ {
+   nsCOMPtr<nsPIDOMWindowInner> mWindow;
+   RefPtr<Promise> mPromise;
+ public:
+   GetRegistrationsRunnable(nsPIDOMWindowInner* aWindow, Promise* aPromise)
+-    : Runnable("dom::workers::GetRegistrationsRunnable")
++    : Runnable("dom::ServiceWorkerManager::GetRegistrationsRunnable")
+     , mWindow(aWindow)
+     , mPromise(aPromise)
+   {}
+ 
+   NS_IMETHOD
+   Run() override
+   {
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+@@ -1035,17 +1036,17 @@ public:
+ };
+ 
+ // If we return an error code here, the ServiceWorkerContainer will
+ // automatically reject the Promise.
+ NS_IMETHODIMP
+ ServiceWorkerManager::GetRegistrations(mozIDOMWindow* aWindow,
+                                        nsISupports** aPromise)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!aWindow)) {
+     return NS_ERROR_DOM_INVALID_STATE_ERR;
+   }
+ 
+   auto* window = nsPIDOMWindowInner::From(aWindow);
+ 
+   // Don't allow a service worker to access service worker registrations
+@@ -1087,17 +1088,17 @@ class GetRegistrationRunnable final : pu
+   nsCOMPtr<nsPIDOMWindowInner> mWindow;
+   RefPtr<Promise> mPromise;
+   nsString mDocumentURL;
+ 
+ public:
+   GetRegistrationRunnable(nsPIDOMWindowInner* aWindow,
+                           Promise* aPromise,
+                           const nsAString& aDocumentURL)
+-    : Runnable("dom::workers::GetRegistrationRunnable")
++    : Runnable("dom::ServiceWorkerManager::GetRegistrationRunnable")
+     , mWindow(aWindow)
+     , mPromise(aPromise)
+     , mDocumentURL(aDocumentURL)
+   {}
+ 
+   NS_IMETHOD
+   Run() override
+   {
+@@ -1158,17 +1159,17 @@ public:
+ 
+ // If we return an error code here, the ServiceWorkerContainer will
+ // automatically reject the Promise.
+ NS_IMETHODIMP
+ ServiceWorkerManager::GetRegistration(mozIDOMWindow* aWindow,
+                                       const nsAString& aDocumentURL,
+                                       nsISupports** aPromise)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!aWindow)) {
+     return NS_ERROR_DOM_INVALID_STATE_ERR;
+   }
+ 
+   auto* window = nsPIDOMWindowInner::From(aWindow);
+ 
+   // Don't allow a service worker to access service worker registrations
+@@ -1204,17 +1205,17 @@ ServiceWorkerManager::GetRegistration(mo
+ 
+ class GetReadyPromiseRunnable final : public Runnable
+ {
+   nsCOMPtr<nsPIDOMWindowInner> mWindow;
+   RefPtr<Promise> mPromise;
+ 
+ public:
+   GetReadyPromiseRunnable(nsPIDOMWindowInner* aWindow, Promise* aPromise)
+-    : Runnable("dom::workers::GetReadyPromiseRunnable")
++    : Runnable("dom::ServiceWorkerManager::GetReadyPromiseRunnable")
+     , mWindow(aWindow)
+     , mPromise(aPromise)
+   {}
+ 
+   NS_IMETHOD
+   Run() override
+   {
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+@@ -1367,17 +1368,17 @@ ServiceWorkerManager::SendNotificationCl
+                                aOriginSuffix, aScope, aID, aTitle, aDir, aLang,
+                                aBody, aTag, aIcon, aData, aBehavior);
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::GetReadyPromise(mozIDOMWindow* aWindow,
+                                       nsISupports** aPromise)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!aWindow)) {
+     return NS_ERROR_DOM_INVALID_STATE_ERR;
+   }
+ 
+   auto* window = nsPIDOMWindowInner::From(aWindow);
+ 
+   nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+@@ -1402,17 +1403,17 @@ ServiceWorkerManager::GetReadyPromise(mo
+     new GetReadyPromiseRunnable(window, promise);
+   promise.forget(aPromise);
+   return NS_DispatchToCurrentThread(runnable);
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::RemoveReadyPromise(mozIDOMWindow* aWindow)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aWindow);
+ 
+   if (!aWindow) {
+     return NS_ERROR_FAILURE;
+   }
+ 
+   mPendingReadyPromises.Remove(aWindow);
+   return NS_OK;
+@@ -1473,17 +1474,17 @@ ServiceWorkerManager::CheckReadyPromise(
+ 
+   return false;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerManager::GetActiveWorkerInfoForScope(const OriginAttributes& aOriginAttributes,
+                                                   const nsACString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIURI> scopeURI;
+   nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
+   if (NS_FAILED(rv)) {
+     return nullptr;
+   }
+   nsCOMPtr<nsIPrincipal> principal =
+     BasePrincipal::CreateCodebasePrincipal(scopeURI, aOriginAttributes);
+@@ -1494,17 +1495,17 @@ ServiceWorkerManager::GetActiveWorkerInf
+   }
+ 
+   return registration->GetActive();
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerManager::GetActiveWorkerInfoForDocument(nsIDocument* aDocument)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   Maybe<ClientInfo> clientInfo(aDocument->GetClientInfo());
+   if (clientInfo.isNothing()) {
+     return nullptr;
+   }
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> registration;
+   GetClientRegistration(clientInfo.ref(), getter_AddRefs(registration));
+@@ -1525,24 +1526,24 @@ class UnregisterJobCallback final : publ
+   ~UnregisterJobCallback()
+   {
+   }
+ 
+ public:
+   explicit UnregisterJobCallback(nsIServiceWorkerUnregisterCallback* aCallback)
+     : mCallback(aCallback)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mCallback);
+   }
+ 
+   void
+   JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aJob);
+ 
+     if (aStatus.Failed()) {
+       mCallback->UnregisterFailed();
+       return;
+     }
+ 
+     MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob::Type::Unregister);
+@@ -1556,17 +1557,17 @@ public:
+ 
+ } // anonymous namespace
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::Unregister(nsIPrincipal* aPrincipal,
+                                  nsIServiceWorkerUnregisterCallback* aCallback,
+                                  const nsAString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!aPrincipal) {
+     return NS_ERROR_FAILURE;
+   }
+ 
+   nsresult rv;
+ 
+ // This is not accessible by content, and callers should always ensure scope is
+@@ -1599,17 +1600,17 @@ ServiceWorkerManager::Unregister(nsIPrin
+   queue->ScheduleJob(job);
+   return NS_OK;
+ }
+ 
+ nsresult
+ ServiceWorkerManager::NotifyUnregister(nsIPrincipal* aPrincipal,
+                                        const nsAString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   nsresult rv;
+ 
+ // This is not accessible by content, and callers should always ensure scope is
+ // a correct URI, so this is wrapped in DEBUG
+ #ifdef DEBUG
+   nsCOMPtr<nsIURI> scopeURI;
+@@ -1634,17 +1635,17 @@ ServiceWorkerManager::NotifyUnregister(n
+ 
+   queue->ScheduleJob(job);
+   return NS_OK;
+ }
+ 
+ void
+ ServiceWorkerManager::WorkerIsIdle(ServiceWorkerInfo* aWorker)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_DIAGNOSTIC_ASSERT(aWorker);
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> reg =
+     GetRegistration(aWorker->Principal(), aWorker->Scope());
+   if (!reg) {
+     return;
+   }
+ 
+@@ -1696,17 +1697,17 @@ ServiceWorkerManager::GetInstance()
+       swr = ServiceWorkerRegistrar::Get();
+       if (!swr) {
+         return nullptr;
+       }
+     }
+ 
+     firstTime = false;
+ 
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     gInstance = new ServiceWorkerManager();
+     gInstance->Init(swr);
+     ClearOnShutdown(&gInstance);
+   }
+   RefPtr<ServiceWorkerManager> copy = gInstance.get();
+   return copy.forget();
+ }
+@@ -1771,17 +1772,17 @@ ServiceWorkerManager::HandleError(JSCont
+                                   const nsString& aMessage,
+                                   const nsString& aFilename,
+                                   const nsString& aLine,
+                                   uint32_t aLineNumber,
+                                   uint32_t aColumnNumber,
+                                   uint32_t aFlags,
+                                   JSExnType aExnType)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   nsAutoCString scopeKey;
+   nsresult rv = PrincipalToScopeKey(aPrincipal, scopeKey);
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     return;
+   }
+ 
+@@ -1795,17 +1796,17 @@ ServiceWorkerManager::HandleError(JSCont
+   ReportToAllClients(aScope, aMessage, aFilename, aLine, aLineNumber,
+                      aColumnNumber, aFlags);
+ }
+ 
+ void
+ ServiceWorkerManager::LoadRegistration(
+                              const ServiceWorkerRegistrationData& aRegistration)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIPrincipal> principal =
+     PrincipalInfoToPrincipal(aRegistration.principal());
+   if (!principal) {
+     return;
+   }
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> registration =
+@@ -1851,17 +1852,17 @@ ServiceWorkerManager::LoadRegistration(
+     registration->GetActive()->SetActivatedTime(aRegistration.currentWorkerActivatedTime());
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::LoadRegistrations(
+                   const nsTArray<ServiceWorkerRegistrationData>& aRegistrations)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   for (uint32_t i = 0, len = aRegistrations.Length(); i < len; ++i) {
+     LoadRegistration(aRegistrations[i]);
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::StoreRegistration(
+@@ -2165,17 +2166,17 @@ ServiceWorkerManager::MaybeRemoveRegistr
+     }
+   }
+ }
+ 
+ bool
+ ServiceWorkerManager::StartControlling(const ClientInfo& aClientInfo,
+                                        const ServiceWorkerDescriptor& aServiceWorker)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIPrincipal> principal =
+     PrincipalInfoToPrincipal(aServiceWorker.PrincipalInfo());
+   NS_ENSURE_TRUE(principal, false);
+ 
+   nsCOMPtr<nsIURI> scope;
+   nsresult rv =
+     NS_NewURI(getter_AddRefs(scope), aServiceWorker.Scope(), nullptr, nullptr);
+@@ -2188,17 +2189,17 @@ ServiceWorkerManager::StartControlling(c
+   StartControllingClient(aClientInfo, registration);
+ 
+   return true;
+ }
+ 
+ void
+ ServiceWorkerManager::MaybeCheckNavigationUpdate(const ClientInfo& aClientInfo)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   // We perform these success path navigation update steps when the
+   // document tells us its more or less done loading.  This avoids
+   // slowing down page load and also lets pages consistently get
+   // updatefound events when they fire.
+   //
+   // 9.8.20 If respondWithEntered is false, then:
+   // 9.8.22 Else: (respondWith was entered and succeeded)
+   //    If request is a non-subresource request, then: Invoke Soft Update
+@@ -2250,17 +2251,17 @@ ServiceWorkerManager::GetScopeForUrl(nsI
+   aScope = NS_ConvertUTF8toUTF16(r->mScope);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::AddRegistrationEventListener(const nsAString& aScope,
+                                                    ServiceWorkerRegistrationListener* aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aListener);
+ #ifdef DEBUG
+   // Ensure a registration is only listening for it's own scope.
+   nsAutoString regScope;
+   aListener->GetScope(regScope);
+   MOZ_ASSERT(!regScope.IsEmpty());
+   MOZ_ASSERT(aScope.Equals(regScope));
+ #endif
+@@ -2269,17 +2270,17 @@ ServiceWorkerManager::AddRegistrationEve
+   mServiceWorkerRegistrationListeners.AppendElement(aListener);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::RemoveRegistrationEventListener(const nsAString& aScope,
+                                                       ServiceWorkerRegistrationListener* aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aListener);
+ #ifdef DEBUG
+   // Ensure a registration is unregistering for it's own scope.
+   nsAutoString regScope;
+   aListener->GetScope(regScope);
+   MOZ_ASSERT(!regScope.IsEmpty());
+   MOZ_ASSERT(aScope.Equals(regScope));
+ #endif
+@@ -2288,17 +2289,17 @@ ServiceWorkerManager::RemoveRegistration
+   mServiceWorkerRegistrationListeners.RemoveElement(aListener);
+   return NS_OK;
+ }
+ 
+ void
+ ServiceWorkerManager::FireUpdateFoundOnServiceWorkerRegistrations(
+   ServiceWorkerRegistrationInfo* aRegistration)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsTObserverArray<ServiceWorkerRegistrationListener*>::ForwardIterator it(mServiceWorkerRegistrationListeners);
+   while (it.HasMore()) {
+     RefPtr<ServiceWorkerRegistrationListener> target = it.GetNext();
+     nsAutoString regScope;
+     target->GetScope(regScope);
+     MOZ_ASSERT(!regScope.IsEmpty());
+ 
+@@ -2313,17 +2314,17 @@ ServiceWorkerManager::FireUpdateFoundOnS
+  * This is used for installing, waiting and active.
+  */
+ nsresult
+ ServiceWorkerManager::GetServiceWorkerForScope(nsPIDOMWindowInner* aWindow,
+                                                const nsAString& aScope,
+                                                WhichServiceWorker aWhichWorker,
+                                                nsISupports** aServiceWorker)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!aWindow)) {
+     return NS_ERROR_DOM_INVALID_STATE_ERR;
+   }
+ 
+   nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
+   MOZ_ASSERT(doc);
+ 
+@@ -2383,42 +2384,42 @@ class ContinueDispatchFetchEventRunnable
+   nsCOMPtr<nsILoadGroup> mLoadGroup;
+   bool mIsReload;
+ public:
+   ContinueDispatchFetchEventRunnable(
+     ServiceWorkerPrivate* aServiceWorkerPrivate,
+     nsIInterceptedChannel* aChannel,
+     nsILoadGroup* aLoadGroup,
+     bool aIsReload)
+-    : Runnable("dom::workers::ContinueDispatchFetchEventRunnable")
++    : Runnable("dom::ServiceWorkerManager::ContinueDispatchFetchEventRunnable")
+     , mServiceWorkerPrivate(aServiceWorkerPrivate)
+     , mChannel(aChannel)
+     , mLoadGroup(aLoadGroup)
+     , mIsReload(aIsReload)
+   {
+     MOZ_ASSERT(aServiceWorkerPrivate);
+     MOZ_ASSERT(aChannel);
+   }
+ 
+   void
+   HandleError()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     NS_WARNING("Unexpected error while dispatching fetch event!");
+     nsresult rv = mChannel->ResetInterception();
+     if (NS_FAILED(rv)) {
+       NS_WARNING("Failed to resume intercepted network request");
+       mChannel->CancelInterception(rv);
+     }
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     nsCOMPtr<nsIChannel> channel;
+     nsresult rv = mChannel->GetChannel(getter_AddRefs(channel));
+     if (NS_WARN_IF(NS_FAILED(rv))) {
+       HandleError();
+       return NS_OK;
+     }
+ 
+@@ -2455,17 +2456,17 @@ public:
+ 
+ } // anonymous namespace
+ 
+ void
+ ServiceWorkerManager::DispatchFetchEvent(nsIInterceptedChannel* aChannel,
+                                          ErrorResult& aRv)
+ {
+   MOZ_ASSERT(aChannel);
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIChannel> internalChannel;
+   aRv = aChannel->GetChannel(getter_AddRefs(internalChannel));
+   if (NS_WARN_IF(aRv.Failed())) {
+     return;
+   }
+ 
+   nsCOMPtr<nsILoadGroup> loadGroup;
+@@ -2572,17 +2573,17 @@ ServiceWorkerManager::DispatchFetchEvent
+     new ContinueDispatchFetchEventRunnable(serviceWorker->WorkerPrivate(),
+                                            aChannel, loadGroup,
+                                            loadInfo->GetIsDocshellReload());
+ 
+   // When this service worker was registered, we also sent down the permissions
+   // for the runnable. They should have arrived by now, but we still need to
+   // wait for them if they have not.
+   nsCOMPtr<nsIRunnable> permissionsRunnable = NS_NewRunnableFunction(
+-    "dom::workers::ServiceWorkerManager::DispatchFetchEvent", [=]() {
++    "dom::ServiceWorkerManager::DispatchFetchEvent", [=]() {
+       nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
+       MOZ_ALWAYS_SUCCEEDS(permMgr->WhenPermissionsAvailable(serviceWorker->Principal(),
+                                                             continueRunnable));
+     });
+ 
+   nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(internalChannel);
+ 
+   // If there is no upload stream, then continue immediately
+@@ -2655,17 +2656,17 @@ ServiceWorkerManager::GetActive(nsPIDOMW
+                                   WhichServiceWorker::ACTIVE_WORKER,
+                                   aServiceWorker);
+ }
+ 
+ void
+ ServiceWorkerManager::TransitionServiceWorkerRegistrationWorker(ServiceWorkerRegistrationInfo* aRegistration,
+                                                                 WhichServiceWorker aWhichOne)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsTObserverArray<ServiceWorkerRegistrationListener*>::ForwardIterator it(mServiceWorkerRegistrationListeners);
+   while (it.HasMore()) {
+     RefPtr<ServiceWorkerRegistrationListener> target = it.GetNext();
+     nsAutoString regScope;
+     target->GetScope(regScope);
+     MOZ_ASSERT(!regScope.IsEmpty());
+ 
+     NS_ConvertUTF16toUTF8 utf8Scope(regScope);
+@@ -2675,17 +2676,17 @@ ServiceWorkerManager::TransitionServiceW
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::InvalidateServiceWorkerRegistrationWorker(ServiceWorkerRegistrationInfo* aRegistration,
+                                                                 WhichServiceWorker aWhichOnes)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsTObserverArray<ServiceWorkerRegistrationListener*>::ForwardIterator it(mServiceWorkerRegistrationListeners);
+   while (it.HasMore()) {
+     RefPtr<ServiceWorkerRegistrationListener> target = it.GetNext();
+     nsAutoString regScope;
+     target->GetScope(regScope);
+     MOZ_ASSERT(!regScope.IsEmpty());
+ 
+     NS_ConvertUTF16toUTF8 utf8Scope(regScope);
+@@ -2694,17 +2695,17 @@ ServiceWorkerManager::InvalidateServiceW
+       target->InvalidateWorkers(aWhichOnes);
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::NotifyServiceWorkerRegistrationRemoved(ServiceWorkerRegistrationInfo* aRegistration)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsTObserverArray<ServiceWorkerRegistrationListener*>::ForwardIterator it(mServiceWorkerRegistrationListeners);
+   while (it.HasMore()) {
+     RefPtr<ServiceWorkerRegistrationListener> target = it.GetNext();
+     nsAutoString regScope;
+     target->GetScope(regScope);
+     MOZ_ASSERT(!regScope.IsEmpty());
+ 
+     NS_ConvertUTF16toUTF8 utf8Scope(regScope);
+@@ -2714,17 +2715,17 @@ ServiceWorkerManager::NotifyServiceWorke
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::SoftUpdate(const OriginAttributes& aOriginAttributes,
+                                  const nsACString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mShuttingDown) {
+     return;
+   }
+ 
+   RefPtr<GenericPromise::Private> promise =
+     new GenericPromise::Private(__func__);
+ 
+@@ -2748,24 +2749,24 @@ class UpdateJobCallback final : public S
+   RefPtr<ServiceWorkerUpdateFinishCallback> mCallback;
+ 
+   ~UpdateJobCallback() = default;
+ 
+ public:
+   explicit UpdateJobCallback(ServiceWorkerUpdateFinishCallback* aCallback)
+     : mCallback(aCallback)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mCallback);
+   }
+ 
+   void
+   JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aJob);
+ 
+     if (aStatus.Failed()) {
+       mCallback->UpdateFailed(aStatus);
+       return;
+     }
+ 
+     MOZ_DIAGNOSTIC_ASSERT(aJob->GetType() == ServiceWorkerJob::Type::Update);
+@@ -2780,17 +2781,17 @@ public:
+ 
+ } // anonymous namespace
+ 
+ void
+ ServiceWorkerManager::SoftUpdateInternal(const OriginAttributes& aOriginAttributes,
+                                          const nsACString& aScope,
+                                          ServiceWorkerUpdateFinishCallback* aCallback)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aCallback);
+ 
+   if (mShuttingDown) {
+     return;
+   }
+ 
+   nsCOMPtr<nsIURI> scopeURI;
+   nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope);
+@@ -2852,17 +2853,17 @@ ServiceWorkerManager::SoftUpdateInternal
+   queue->ScheduleJob(job);
+ }
+ 
+ void
+ ServiceWorkerManager::Update(nsIPrincipal* aPrincipal,
+                              const nsACString& aScope,
+                              ServiceWorkerUpdateFinishCallback* aCallback)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<GenericPromise::Private> promise =
+     new GenericPromise::Private(__func__);
+ 
+   RefPtr<CancelableRunnable> successRunnable =
+     new UpdateRunnable(aPrincipal, aScope, aCallback,
+                        UpdateRunnable::eSuccess, promise);
+ 
+@@ -3021,17 +3022,17 @@ ServiceWorkerManager::SetSkipWaitingFlag
+   if (worker->State() == ServiceWorkerState::Installed) {
+     registration->TryToActivateAsync();
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::UpdateClientControllers(ServiceWorkerRegistrationInfo* aRegistration)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerInfo> activeWorker = aRegistration->GetActive();
+   MOZ_DIAGNOSTIC_ASSERT(activeWorker);
+ 
+   AutoTArray<RefPtr<ClientHandle>, 16> handleList;
+   for (auto iter = mControlledClients.Iter(); !iter.Done(); iter.Next()) {
+     if (iter.UserData()->mRegistrationInfo != aRegistration) {
+       continue;
+@@ -3116,17 +3117,17 @@ ServiceWorkerManager::GetRegistration(co
+ 
+ already_AddRefed<ServiceWorkerRegistrationInfo>
+ ServiceWorkerManager::CreateNewRegistration(
+     const nsCString& aScope,
+     nsIPrincipal* aPrincipal,
+     ServiceWorkerUpdateViaCache aUpdateViaCache)
+ {
+ #ifdef DEBUG
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIURI> scopeURI;
+   nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), aScope, nullptr, nullptr);
+   MOZ_ASSERT(NS_SUCCEEDED(rv));
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> tmp =
+     GetRegistration(aPrincipal, aScope);
+   MOZ_ASSERT(!tmp);
+ #endif
+@@ -3185,17 +3186,17 @@ namespace {
+  * Returns true if the |url| passed in is part of the given root |domain|.
+  * For example, if |url| is "www.mozilla.org", and we pass in |domain| as
+  * "mozilla.org", this will return true. It would return false the other way
+  * around.
+  */
+ bool
+ HasRootDomain(nsIURI* aURI, const nsACString& aDomain)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aURI);
+ 
+   nsAutoCString host;
+   nsresult rv = aURI->GetHost(host);
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     return false;
+   }
+ 
+@@ -3220,17 +3221,17 @@ HasRootDomain(nsIURI* aURI, const nsACSt
+   return prevChar == '.';
+ }
+ 
+ } // namespace
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::GetAllRegistrations(nsIArray** aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID));
+   if (!array) {
+     return NS_ERROR_OUT_OF_MEMORY;
+   }
+ 
+   for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
+     for (auto it2 = it1.UserData()->mInfos.Iter(); !it2.Done(); it2.Next()) {
+@@ -3278,17 +3279,17 @@ ServiceWorkerManager::RemoveAndPropagate
+   Remove(aHost);
+   PropagateRemove(aHost);
+   return NS_OK;
+ }
+ 
+ void
+ ServiceWorkerManager::Remove(const nsACString& aHost)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
+     ServiceWorkerManager::RegistrationDataPerPrincipal* data = it1.UserData();
+     for (auto it2 = data->mInfos.Iter(); !it2.Done(); it2.Next()) {
+       ServiceWorkerRegistrationInfo* reg = it2.UserData();
+       nsCOMPtr<nsIURI> scopeURI;
+       nsresult rv = NS_NewURI(getter_AddRefs(scopeURI), it2.Key(),
+                               nullptr, nullptr);
+@@ -3298,46 +3299,46 @@ ServiceWorkerManager::Remove(const nsACS
+       }
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::PropagateRemove(const nsACString& aHost)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mActor->SendPropagateRemove(nsCString(aHost));
+ }
+ 
+ void
+ ServiceWorkerManager::RemoveAll()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
+     ServiceWorkerManager::RegistrationDataPerPrincipal* data = it1.UserData();
+     for (auto it2 = data->mInfos.Iter(); !it2.Done(); it2.Next()) {
+       ServiceWorkerRegistrationInfo* reg = it2.UserData();
+       ForceUnregister(data, reg);
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::PropagateRemoveAll()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(XRE_IsParentProcess());
+   mActor->SendPropagateRemoveAll();
+ }
+ 
+ void
+ ServiceWorkerManager::RemoveAllRegistrations(OriginAttributesPattern* aPattern)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   MOZ_ASSERT(aPattern);
+ 
+   for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
+     ServiceWorkerManager::RegistrationDataPerPrincipal* data = it1.UserData();
+ 
+     // We can use iteration because ForceUnregister (and Unregister) are
+     // async. Otherwise doing some R/W operations on an hashtable during
+@@ -3357,31 +3358,31 @@ ServiceWorkerManager::RemoveAllRegistrat
+       ForceUnregister(data, reg);
+     }
+   }
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::AddListener(nsIServiceWorkerManagerListener* aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!aListener || mListeners.Contains(aListener)) {
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+   mListeners.AppendElement(aListener);
+ 
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::RemoveListener(nsIServiceWorkerManagerListener* aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!aListener || !mListeners.Contains(aListener)) {
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+   mListeners.RemoveElement(aListener);
+ 
+   return NS_OK;
+@@ -3424,41 +3425,41 @@ ServiceWorkerManager::Observe(nsISupport
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::PropagateSoftUpdate(JS::Handle<JS::Value> aOriginAttributes,
+                                           const nsAString& aScope,
+                                           JSContext* aCx)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   OriginAttributes attrs;
+   if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) {
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+   PropagateSoftUpdate(attrs, aScope);
+   return NS_OK;
+ }
+ 
+ void
+ ServiceWorkerManager::PropagateSoftUpdate(const OriginAttributes& aOriginAttributes,
+                                           const nsAString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mActor->SendPropagateSoftUpdate(aOriginAttributes, nsString(aScope));
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerManager::PropagateUnregister(nsIPrincipal* aPrincipal,
+                                           nsIServiceWorkerUnregisterCallback* aCallback,
+                                           const nsAString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   PrincipalInfo principalInfo;
+   if (NS_WARN_IF(NS_FAILED(PrincipalToPrincipalInfo(aPrincipal,
+                                                     &principalInfo)))) {
+     return NS_ERROR_FAILURE;
+   }
+ 
+@@ -3502,25 +3503,25 @@ class UpdateTimerCallback final : public
+   {
+   }
+ 
+ public:
+   UpdateTimerCallback(nsIPrincipal* aPrincipal, const nsACString& aScope)
+     : mPrincipal(aPrincipal)
+     , mScope(aScope)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mPrincipal);
+     MOZ_ASSERT(!mScope.IsEmpty());
+   }
+ 
+   NS_IMETHOD
+   Notify(nsITimer* aTimer) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (!swm) {
+       // shutting down, do nothing
+       return NS_OK;
+     }
+ 
+     swm->UpdateTimerFired(mPrincipal, mScope);
+@@ -3538,17 +3539,17 @@ public:
+ };
+ 
+ NS_IMPL_ISUPPORTS(UpdateTimerCallback, nsITimerCallback, nsINamed)
+ 
+ bool
+ ServiceWorkerManager::MayHaveActiveServiceWorkerInstance(ContentParent* aContent,
+                                                          nsIPrincipal* aPrincipal)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   if (mShuttingDown) {
+     return false;
+   }
+ 
+   nsAutoCString scopeKey;
+   nsresult rv = PrincipalToScopeKey(aPrincipal, scopeKey);
+@@ -3563,17 +3564,17 @@ ServiceWorkerManager::MayHaveActiveServi
+ 
+   return true;
+ }
+ 
+ void
+ ServiceWorkerManager::ScheduleUpdateTimer(nsIPrincipal* aPrincipal,
+                                           const nsACString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(!aScope.IsEmpty());
+ 
+   if (mShuttingDown) {
+     return;
+   }
+ 
+   nsAutoCString scopeKey;
+@@ -3613,17 +3614,17 @@ ServiceWorkerManager::ScheduleUpdateTime
+     return;
+   }
+ }
+ 
+ void
+ ServiceWorkerManager::UpdateTimerFired(nsIPrincipal* aPrincipal,
+                                        const nsACString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(!aScope.IsEmpty());
+ 
+   if (mShuttingDown) {
+     return;
+   }
+ 
+   // First cleanup the timer.
+@@ -3657,26 +3658,27 @@ ServiceWorkerManager::UpdateTimerFired(n
+ 
+   SoftUpdate(attrs, aScope);
+ }
+ 
+ void
+ ServiceWorkerManager::MaybeSendUnregister(nsIPrincipal* aPrincipal,
+                                           const nsACString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(!aScope.IsEmpty());
+ 
+   if (!mActor) {
+     return;
+   }
+ 
+   PrincipalInfo principalInfo;
+   nsresult rv = PrincipalToPrincipalInfo(aPrincipal, &principalInfo);
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     return;
+   }
+ 
+   Unused << mActor->SendUnregister(principalInfo, NS_ConvertUTF8toUTF16(aScope));
+ }
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerManager.h b/dom/serviceworkers/ServiceWorkerManager.h
+--- a/dom/serviceworkers/ServiceWorkerManager.h
++++ b/dom/serviceworkers/ServiceWorkerManager.h
+@@ -21,17 +21,17 @@
+ #include "mozilla/UniquePtr.h"
+ #include "mozilla/WeakPtr.h"
+ #include "mozilla/dom/BindingUtils.h"
+ #include "mozilla/dom/ClientHandle.h"
+ #include "mozilla/dom/Promise.h"
+ #include "mozilla/dom/ServiceWorkerCommon.h"
+ #include "mozilla/dom/ServiceWorkerRegistrar.h"
+ #include "mozilla/dom/ServiceWorkerRegistrarTypes.h"
+-#include "mozilla/dom/workers/ServiceWorkerRegistrationInfo.h"
++#include "mozilla/dom/ServiceWorkerRegistrationInfo.h"
+ #include "mozilla/ipc/BackgroundUtils.h"
+ #include "nsClassHashtable.h"
+ #include "nsDataHashtable.h"
+ #include "nsRefPtrHashtable.h"
+ #include "nsTArrayForwardDeclare.h"
+ #include "nsTObserverArray.h"
+ 
+ class nsIConsoleReportCollector;
+@@ -41,25 +41,22 @@ namespace mozilla {
+ class OriginAttributes;
+ 
+ namespace ipc {
+ class PrincipalInfo;
+ } // namespace ipc
+ 
+ namespace dom {
+ 
+-class ServiceWorkerRegistrar;
+-class ServiceWorkerRegistrationListener;
+-
+-namespace workers {
+-
+ class ServiceWorkerInfo;
+ class ServiceWorkerJobQueue;
+ class ServiceWorkerManagerChild;
+ class ServiceWorkerPrivate;
++class ServiceWorkerRegistrar;
++class ServiceWorkerRegistrationListener;
+ 
+ class ServiceWorkerUpdateFinishCallback
+ {
+ protected:
+   virtual ~ServiceWorkerUpdateFinishCallback()
+   {}
+ 
+ public:
+@@ -487,13 +484,12 @@ private:
+                         const nsAString& aLang,
+                         const nsAString& aBody,
+                         const nsAString& aTag,
+                         const nsAString& aIcon,
+                         const nsAString& aData,
+                         const nsAString& aBehavior);
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_workers_serviceworkermanager_h
+diff --git a/dom/serviceworkers/ServiceWorkerManagerChild.cpp b/dom/serviceworkers/ServiceWorkerManagerChild.cpp
+--- a/dom/serviceworkers/ServiceWorkerManagerChild.cpp
++++ b/dom/serviceworkers/ServiceWorkerManagerChild.cpp
+@@ -9,17 +9,16 @@
+ #include "ServiceWorkerUpdaterChild.h"
+ #include "mozilla/Unused.h"
+ 
+ namespace mozilla {
+ 
+ using namespace ipc;
+ 
+ namespace dom {
+-namespace workers {
+ 
+ mozilla::ipc::IPCResult
+ ServiceWorkerManagerChild::RecvNotifyRegister(
+                                      const ServiceWorkerRegistrationData& aData)
+ {
+   if (mShuttingDown) {
+     return IPC_OK();
+   }
+@@ -112,11 +111,10 @@ ServiceWorkerManagerChild::AllocPService
+ 
+ bool
+ ServiceWorkerManagerChild::DeallocPServiceWorkerUpdaterChild(PServiceWorkerUpdaterChild* aActor)
+ {
+   delete aActor;
+   return true;
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerManagerChild.h b/dom/serviceworkers/ServiceWorkerManagerChild.h
+--- a/dom/serviceworkers/ServiceWorkerManagerChild.h
++++ b/dom/serviceworkers/ServiceWorkerManagerChild.h
+@@ -14,17 +14,16 @@ namespace mozilla {
+ 
+ class OriginAttributes;
+ 
+ namespace ipc {
+ class BackgroundChildImpl;
+ } // namespace ipc
+ 
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerManagerChild final : public PServiceWorkerManagerChild
+ {
+   friend class mozilla::ipc::BackgroundChildImpl;
+ 
+ public:
+   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerChild)
+ 
+@@ -58,13 +57,12 @@ private:
+     : mShuttingDown(false)
+   {}
+ 
+   ~ServiceWorkerManagerChild() {}
+ 
+   bool mShuttingDown;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_ServiceWorkerManagerChild_h
+diff --git a/dom/serviceworkers/ServiceWorkerManagerParent.cpp b/dom/serviceworkers/ServiceWorkerManagerParent.cpp
+--- a/dom/serviceworkers/ServiceWorkerManagerParent.cpp
++++ b/dom/serviceworkers/ServiceWorkerManagerParent.cpp
+@@ -14,28 +14,27 @@
+ #include "mozilla/Unused.h"
+ #include "nsThreadUtils.h"
+ 
+ namespace mozilla {
+ 
+ using namespace ipc;
+ 
+ namespace dom {
+-namespace workers {
+ 
+ namespace {
+ 
+ uint64_t sServiceWorkerManagerParentID = 0;
+ 
+ class RegisterServiceWorkerCallback final : public Runnable
+ {
+ public:
+   RegisterServiceWorkerCallback(const ServiceWorkerRegistrationData& aData,
+                                 uint64_t aParentID)
+-    : Runnable("dom::workers::RegisterServiceWorkerCallback")
++    : Runnable("dom::RegisterServiceWorkerCallback")
+     , mData(aData)
+     , mParentID(aParentID)
+   {
+     AssertIsInMainProcess();
+     AssertIsOnBackgroundThread();
+   }
+ 
+   NS_IMETHOD
+@@ -70,17 +69,17 @@ private:
+ };
+ 
+ class UnregisterServiceWorkerCallback final : public Runnable
+ {
+ public:
+   UnregisterServiceWorkerCallback(const PrincipalInfo& aPrincipalInfo,
+                                   const nsString& aScope,
+                                   uint64_t aParentID)
+-    : Runnable("dom::workers::UnregisterServiceWorkerCallback")
++    : Runnable("dom::UnregisterServiceWorkerCallback")
+     , mPrincipalInfo(aPrincipalInfo)
+     , mScope(aScope)
+     , mParentID(aParentID)
+   {
+     AssertIsInMainProcess();
+     AssertIsOnBackgroundThread();
+   }
+ 
+@@ -119,17 +118,17 @@ private:
+ };
+ 
+ class CheckPrincipalWithCallbackRunnable final : public Runnable
+ {
+ public:
+   CheckPrincipalWithCallbackRunnable(already_AddRefed<ContentParent> aParent,
+                                      const PrincipalInfo& aPrincipalInfo,
+                                      Runnable* aCallback)
+-    : Runnable("dom::workers::CheckPrincipalWithCallbackRunnable")
++    : Runnable("dom::CheckPrincipalWithCallbackRunnable")
+     , mContentParent(aParent)
+     , mPrincipalInfo(aPrincipalInfo)
+     , mCallback(aCallback)
+     , mBackgroundEventTarget(GetCurrentThreadEventTarget())
+   {
+     AssertIsInMainProcess();
+     AssertIsOnBackgroundThread();
+ 
+@@ -353,11 +352,10 @@ ServiceWorkerManagerParent::ActorDestroy
+ 
+   if (mService) {
+     // This object is about to be released and with it, also mService will be
+     // released too.
+     mService->UnregisterActor(this);
+   }
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerManagerParent.h b/dom/serviceworkers/ServiceWorkerManagerParent.h
+--- a/dom/serviceworkers/ServiceWorkerManagerParent.h
++++ b/dom/serviceworkers/ServiceWorkerManagerParent.h
+@@ -13,17 +13,16 @@ namespace mozilla {
+ 
+ class OriginAttributes;
+ 
+ namespace ipc {
+ class BackgroundParentImpl;
+ } // namespace ipc
+ 
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerManagerService;
+ 
+ class ServiceWorkerManagerParent final : public PServiceWorkerManagerParent
+ {
+   friend class mozilla::ipc::BackgroundParentImpl;
+ 
+ public:
+@@ -72,13 +71,12 @@ private:
+ 
+   RefPtr<ServiceWorkerManagerService> mService;
+ 
+   // We use this ID in the Service in order to avoid the sending of messages to
+   // ourself.
+   uint64_t mID;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_ServiceWorkerManagerParent_h
+diff --git a/dom/serviceworkers/ServiceWorkerManagerService.cpp b/dom/serviceworkers/ServiceWorkerManagerService.cpp
+--- a/dom/serviceworkers/ServiceWorkerManagerService.cpp
++++ b/dom/serviceworkers/ServiceWorkerManagerService.cpp
+@@ -13,17 +13,16 @@
+ #include "mozilla/Unused.h"
+ #include "nsAutoPtr.h"
+ 
+ namespace mozilla {
+ 
+ using namespace ipc;
+ 
+ namespace dom {
+-namespace workers {
+ 
+ namespace {
+ 
+ ServiceWorkerManagerService* sInstance = nullptr;
+ 
+ } // namespace
+ 
+ ServiceWorkerManagerService::ServiceWorkerManagerService()
+@@ -105,17 +104,17 @@ ServiceWorkerManagerService::PropagateRe
+ #endif
+     }
+   }
+ 
+   // Send permissions fot the newly registered service worker to all of the
+   // content processes.
+   PrincipalInfo pi = aData.principal();
+   NS_DispatchToMainThread(NS_NewRunnableFunction(
+-    "dom::workers::ServiceWorkerManagerService::PropagateRegistration", [pi]() {
++    "dom::ServiceWorkerManagerService::PropagateRegistration", [pi]() {
+       nsTArray<ContentParent*> cps;
+       ContentParent::GetAll(cps);
+       for (auto* cp : cps) {
+         nsCOMPtr<nsIPrincipal> principal = PrincipalInfoToPrincipal(pi);
+         if (principal) {
+           cp->TransmitPermissionsForPrincipal(principal);
+         }
+       }
+@@ -288,11 +287,10 @@ ServiceWorkerManagerService::UpdaterActo
+       mPendingUpdaterActors.RemoveElementAt(i);
+       return;
+     }
+   }
+ 
+   MOZ_CRASH("The actor should be found");
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerManagerService.h b/dom/serviceworkers/ServiceWorkerManagerService.h
+--- a/dom/serviceworkers/ServiceWorkerManagerService.h
++++ b/dom/serviceworkers/ServiceWorkerManagerService.h
+@@ -17,21 +17,18 @@ namespace mozilla {
+ class OriginAttributes;
+ 
+ namespace ipc {
+ class PrincipalInfo;
+ } // namespace ipc
+ 
+ namespace dom {
+ 
++class ServiceWorkerManagerParent;
+ class ServiceWorkerRegistrationData;
+-
+-namespace workers {
+-
+-class ServiceWorkerManagerParent;
+ class ServiceWorkerUpdaterParent;
+ 
+ class ServiceWorkerManagerService final
+ {
+ public:
+   NS_INLINE_DECL_REFCOUNTING(ServiceWorkerManagerService)
+ 
+   static already_AddRefed<ServiceWorkerManagerService> Get();
+@@ -73,13 +70,12 @@ private:
+     nsCString mScope;
+     ServiceWorkerUpdaterParent* mActor;
+     uint64_t mParentId;
+   };
+ 
+   nsTArray<PendingUpdaterActor> mPendingUpdaterActors;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_ServiceWorkerManagerService_h
+diff --git a/dom/serviceworkers/ServiceWorkerPrivate.cpp b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+--- a/dom/serviceworkers/ServiceWorkerPrivate.cpp
++++ b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+@@ -35,17 +35,18 @@
+ #include "mozilla/dom/PromiseNativeHandler.h"
+ #include "mozilla/dom/PushEventBinding.h"
+ #include "mozilla/dom/RequestBinding.h"
+ #include "mozilla/Unused.h"
+ 
+ using namespace mozilla;
+ using namespace mozilla::dom;
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ using mozilla::ipc::PrincipalInfo;
+ 
+ NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(ServiceWorkerPrivate)
+ NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE(ServiceWorkerPrivate)
+ NS_IMPL_CYCLE_COLLECTION(ServiceWorkerPrivate, mSupportsArray)
+ 
+ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(ServiceWorkerPrivate, AddRef)
+@@ -64,39 +65,39 @@ Atomic<uint32_t> gDOMDisableOpenClickDel
+ class KeepAliveToken final : public nsISupports
+ {
+ public:
+   NS_DECL_ISUPPORTS
+ 
+   explicit KeepAliveToken(ServiceWorkerPrivate* aPrivate)
+     : mPrivate(aPrivate)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aPrivate);
+     mPrivate->AddToken();
+   }
+ 
+ private:
+   ~KeepAliveToken()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mPrivate->ReleaseToken();
+   }
+ 
+   RefPtr<ServiceWorkerPrivate> mPrivate;
+ };
+ 
+ NS_IMPL_ISUPPORTS0(KeepAliveToken)
+ 
+ ServiceWorkerPrivate::ServiceWorkerPrivate(ServiceWorkerInfo* aInfo)
+   : mInfo(aInfo)
+   , mDebuggerCount(0)
+   , mTokenCount(0)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aInfo);
+ 
+   mIdleWorkerTimer = NS_NewTimer();
+   MOZ_ASSERT(mIdleWorkerTimer);
+ }
+ 
+ ServiceWorkerPrivate::~ServiceWorkerPrivate()
+ {
+@@ -133,46 +134,46 @@ public:
+         "CheckScriptEvaluationWithCallback::mServiceWorkerPrivate", aServiceWorkerPrivate))
+     , mKeepAliveToken(new nsMainThreadPtrHolder<KeepAliveToken>(
+         "CheckScriptEvaluationWithCallback::mKeepAliveToken", aKeepAliveToken))
+     , mScriptEvaluationCallback(aScriptEvaluationCallback)
+ #ifdef DEBUG
+     , mDone(false)
+ #endif
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   ~CheckScriptEvaluationWithCallback()
+   {
+     MOZ_ASSERT(mDone);
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     aWorkerPrivate->AssertIsOnWorkerThread();
+ 
+     bool fetchHandlerWasAdded = aWorkerPrivate->FetchHandlerWasAdded();
+     nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod<bool>(
+-      "dom::workers::CheckScriptEvaluationWithCallback::ReportFetchFlag",
++      "dom::CheckScriptEvaluationWithCallback::ReportFetchFlag",
+       this,
+       &CheckScriptEvaluationWithCallback::ReportFetchFlag,
+       fetchHandlerWasAdded);
+     aWorkerPrivate->DispatchToMainThread(runnable.forget());
+ 
+     ReportScriptEvaluationResult(aWorkerPrivate->WorkerScriptExecutedSuccessfully());
+ 
+     return true;
+   }
+ 
+   void
+   ReportFetchFlag(bool aFetchHandlerWasAdded)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mServiceWorkerPrivate->SetHandlesFetch(aFetchHandlerWasAdded);
+   }
+ 
+   nsresult
+   Cancel() override
+   {
+     ReportScriptEvaluationResult(false);
+     return WorkerRunnable::Cancel();
+@@ -382,17 +383,17 @@ private:
+     if (mPendingPromisesCount) {
+       return;
+     }
+ 
+     CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+     MOZ_ASSERT(cx);
+ 
+     RefPtr<nsIRunnable> r =
+-      NewRunnableMethod("dom::workers::KeepAliveHandler::MaybeDone",
++      NewRunnableMethod("dom::KeepAliveHandler::MaybeDone",
+                         this,
+                         &KeepAliveHandler::MaybeDone);
+     cx->DispatchToMicroTask(r.forget());
+   }
+ };
+ 
+ NS_IMPL_ISUPPORTS0(KeepAliveHandler)
+ 
+@@ -400,17 +401,17 @@ class RegistrationUpdateRunnable : publi
+ {
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> mRegistration;
+   const bool mNeedTimeCheck;
+ 
+ public:
+   RegistrationUpdateRunnable(
+     nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo>& aRegistration,
+     bool aNeedTimeCheck)
+-    : Runnable("dom::workers::RegistrationUpdateRunnable")
++    : Runnable("dom::RegistrationUpdateRunnable")
+     , mRegistration(aRegistration)
+     , mNeedTimeCheck(aNeedTimeCheck)
+   {
+     MOZ_DIAGNOSTIC_ASSERT(mRegistration);
+   }
+ 
+   NS_IMETHOD
+   Run() override
+@@ -429,17 +430,17 @@ class ExtendableEventWorkerRunnable : pu
+ protected:
+   nsMainThreadPtrHandle<KeepAliveToken> mKeepAliveToken;
+ 
+ public:
+   ExtendableEventWorkerRunnable(WorkerPrivate* aWorkerPrivate,
+                                 KeepAliveToken* aKeepAliveToken)
+     : WorkerRunnable(aWorkerPrivate)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aWorkerPrivate);
+     MOZ_ASSERT(aKeepAliveToken);
+ 
+     mKeepAliveToken =
+       new nsMainThreadPtrHolder<KeepAliveToken>(
+         "ExtendableEventWorkerRunnable::mKeepAliveToken", aKeepAliveToken);
+   }
+ 
+@@ -497,17 +498,17 @@ public:
+   SendMessageEventRunnable(WorkerPrivate*  aWorkerPrivate,
+                            KeepAliveToken* aKeepAliveToken,
+                            const ClientInfoAndState& aClientInfoAndState)
+     : ExtendableEventWorkerRunnable(aWorkerPrivate, aKeepAliveToken)
+     , StructuredCloneHolder(CloningSupported, TransferringSupported,
+                             StructuredCloneScope::SameProcessDifferentThread)
+     , mClientInfoAndState(aClientInfoAndState)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     JS::Rooted<JS::Value> messageData(aCx);
+     nsCOMPtr<nsIGlobalObject> sgo = aWorkerPrivate->GlobalScope();
+     ErrorResult rv;
+@@ -552,17 +553,17 @@ public:
+ } // anonymous namespace
+ 
+ nsresult
+ ServiceWorkerPrivate::SendMessageEvent(JSContext* aCx,
+                                        JS::Handle<JS::Value> aMessage,
+                                        const Sequence<JSObject*>& aTransferable,
+                                        const ClientInfoAndState& aClientInfoAndState)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   ErrorResult rv(SpawnWorkerIfNeeded(MessageEvent, nullptr));
+   if (NS_WARN_IF(rv.Failed())) {
+     return rv.StealNSResult();
+   }
+ 
+   JS::Rooted<JS::Value> transferable(aCx, JS::UndefinedHandleValue);
+ 
+@@ -637,17 +638,17 @@ public:
+   LifecycleEventWorkerRunnable(WorkerPrivate* aWorkerPrivate,
+                                KeepAliveToken* aToken,
+                                const nsAString& aEventName,
+                                LifeCycleEventCallback* aCallback)
+       : ExtendableEventWorkerRunnable(aWorkerPrivate, aToken)
+       , mEventName(aEventName)
+       , mCallback(aCallback)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     MOZ_ASSERT(aWorkerPrivate);
+     return DispatchLifecycleEvent(aCx, aWorkerPrivate);
+   }
+@@ -875,27 +876,27 @@ public:
+     WorkerPrivate* workerPrivate = mWorkerPrivate;
+     mWorkerPrivate->AssertIsOnWorkerThread();
+ 
+     if (NS_WARN_IF(aReason > nsIPushErrorReporter::DELIVERY_INTERNAL_ERROR) ||
+         mMessageId.IsEmpty()) {
+       return;
+     }
+     nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod<uint16_t>(
+-      "dom::workers::PushErrorReporter::ReportOnMainThread",
++      "dom::PushErrorReporter::ReportOnMainThread",
+       this,
+       &PushErrorReporter::ReportOnMainThread,
+       aReason);
+     MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
+       workerPrivate->DispatchToMainThread(runnable.forget())));
+   }
+ 
+   void ReportOnMainThread(uint16_t aReason)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     nsCOMPtr<nsIPushErrorReporter> reporter =
+       do_GetService("@mozilla.org/push/Service;1");
+     if (reporter) {
+       nsresult rv = reporter->ReportDeliveryError(mMessageId, aReason);
+       Unused << NS_WARN_IF(NS_FAILED(rv));
+     }
+   }
+ };
+@@ -911,17 +912,17 @@ public:
+                         const nsAString& aMessageId,
+                         const Maybe<nsTArray<uint8_t>>& aData,
+                         nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> aRegistration)
+       : ExtendableFunctionalEventWorkerRunnable(
+           aWorkerPrivate, aKeepAliveToken, aRegistration)
+       , mMessageId(aMessageId)
+       , mData(aData)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aWorkerPrivate);
+     MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     MOZ_ASSERT(aWorkerPrivate);
+@@ -969,17 +970,17 @@ public:
+ class SendPushSubscriptionChangeEventRunnable final : public ExtendableEventWorkerRunnable
+ {
+ 
+ public:
+   explicit SendPushSubscriptionChangeEventRunnable(
+     WorkerPrivate* aWorkerPrivate, KeepAliveToken* aKeepAliveToken)
+       : ExtendableEventWorkerRunnable(aWorkerPrivate, aKeepAliveToken)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aWorkerPrivate);
+     MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     MOZ_ASSERT(aWorkerPrivate);
+@@ -1214,17 +1215,17 @@ public:
+       , mLang(aLang)
+       , mBody(aBody)
+       , mTag(aTag)
+       , mIcon(aIcon)
+       , mData(aData)
+       , mBehavior(aBehavior)
+       , mScope(aScope)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aWorkerPrivate);
+     MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     MOZ_ASSERT(aWorkerPrivate);
+@@ -1384,17 +1385,17 @@ public:
+     mHeaderNames.AppendElement(aHeader);
+     mHeaderValues.AppendElement(aValue);
+     return NS_OK;
+   }
+ 
+   nsresult
+   Init()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     nsCOMPtr<nsIChannel> channel;
+     nsresult rv = mInterceptedChannel->GetChannel(getter_AddRefs(channel));
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+     nsCOMPtr<nsIURI> uri;
+     rv = mInterceptedChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri));
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+@@ -1539,25 +1540,25 @@ public:
+ private:
+   ~FetchEventRunnable() {}
+ 
+   class ResumeRequest final : public Runnable {
+     nsMainThreadPtrHandle<nsIInterceptedChannel> mChannel;
+   public:
+     explicit ResumeRequest(
+       nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel)
+-      : Runnable("dom::workers::FetchEventRunnable::ResumeRequest")
++      : Runnable("dom::FetchEventRunnable::ResumeRequest")
+       , mChannel(aChannel)
+     {
+       mChannel->SetFinishResponseStart(TimeStamp::Now());
+     }
+ 
+     NS_IMETHOD Run() override
+     {
+-      AssertIsOnMainThread();
++      MOZ_ASSERT(NS_IsMainThread());
+ 
+       TimeStamp timeStamp = TimeStamp::Now();
+       mChannel->SetHandleFetchEventEnd(timeStamp);
+       mChannel->SetChannelResetEnd(timeStamp);
+       mChannel->SaveTimeStamps();
+ 
+       nsresult rv = mChannel->ResetInterception();
+       if (NS_FAILED(rv)) {
+@@ -1682,17 +1683,17 @@ NS_IMPL_ISUPPORTS_INHERITED(FetchEventRu
+ 
+ } // anonymous namespace
+ 
+ nsresult
+ ServiceWorkerPrivate::SendFetchEvent(nsIInterceptedChannel* aChannel,
+                                      nsILoadGroup* aLoadGroup,
+                                      const nsAString& aClientId, bool aIsReload)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (NS_WARN_IF(!mInfo || !swm)) {
+     return NS_ERROR_FAILURE;
+   }
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> registration =
+     swm->GetRegistration(mInfo->Principal(), mInfo->Scope());
+@@ -1783,17 +1784,17 @@ ServiceWorkerPrivate::SendFetchEvent(nsI
+ }
+ 
+ nsresult
+ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
+                                           nsIRunnable* aLoadFailedRunnable,
+                                           bool* aNewWorkerCreated,
+                                           nsILoadGroup* aLoadGroup)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // Defaults to no new worker created, but if there is one, we'll set the value
+   // to true at the end of this function.
+   if (aNewWorkerCreated) {
+     *aNewWorkerCreated = false;
+   }
+ 
+   if (mWorkerPrivate) {
+@@ -1927,34 +1928,34 @@ ServiceWorkerPrivate::SpawnWorkerIfNeede
+   }
+ 
+   return NS_OK;
+ }
+ 
+ void
+ ServiceWorkerPrivate::StoreISupports(nsISupports* aSupports)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mWorkerPrivate);
+   MOZ_ASSERT(!mSupportsArray.Contains(aSupports));
+ 
+   mSupportsArray.AppendElement(aSupports);
+ }
+ 
+ void
+ ServiceWorkerPrivate::RemoveISupports(nsISupports* aSupports)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mSupportsArray.RemoveElement(aSupports);
+ }
+ 
+ void
+ ServiceWorkerPrivate::TerminateWorker()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   mIdleWorkerTimer->Cancel();
+   mIdleKeepAliveToken = nullptr;
+   if (mWorkerPrivate) {
+     if (DOMPrefs::ServiceWorkersTestingEnabled()) {
+       nsCOMPtr<nsIObserverService> os = services::GetObserverService();
+       if (os) {
+         os->NotifyObservers(nullptr, "service-worker-shutdown", nullptr);
+@@ -1974,17 +1975,17 @@ ServiceWorkerPrivate::TerminateWorker()
+       pendingEvents[i]->Cancel();
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerPrivate::NoteDeadServiceWorkerInfo()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mInfo = nullptr;
+   TerminateWorker();
+ }
+ 
+ namespace {
+ 
+ class UpdateStateControlRunnable final : public MainThreadWorkerControlRunnable
+ {
+@@ -2007,17 +2008,17 @@ public:
+   }
+ };
+ 
+ } // anonymous namespace
+ 
+ void
+ ServiceWorkerPrivate::UpdateState(ServiceWorkerState aState)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!mWorkerPrivate) {
+     MOZ_DIAGNOSTIC_ASSERT(mPendingFunctionalEvents.IsEmpty());
+     return;
+   }
+ 
+   RefPtr<WorkerRunnable> r =
+     new UpdateStateControlRunnable(mWorkerPrivate, aState);
+@@ -2036,17 +2037,17 @@ ServiceWorkerPrivate::UpdateState(Servic
+       NS_WARNING("Failed to dispatch pending functional event!");
+     }
+   }
+ }
+ 
+ nsresult
+ ServiceWorkerPrivate::GetDebugger(nsIWorkerDebugger** aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aResult);
+ 
+   if (!mDebuggerCount) {
+     return NS_OK;
+   }
+ 
+   MOZ_ASSERT(mWorkerPrivate);
+ 
+@@ -2054,17 +2055,17 @@ ServiceWorkerPrivate::GetDebugger(nsIWor
+   debugger.forget(aResult);
+ 
+   return NS_OK;
+ }
+ 
+ nsresult
+ ServiceWorkerPrivate::AttachDebugger()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // When the first debugger attaches to a worker, we spawn a worker if needed,
+   // and cancel the idle timeout. The idle timeout should not be reset until
+   // the last debugger detached from the worker.
+   if (!mDebuggerCount) {
+     nsresult rv = SpawnWorkerIfNeeded(AttachEvent, nullptr);
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+@@ -2074,17 +2075,17 @@ ServiceWorkerPrivate::AttachDebugger()
+   ++mDebuggerCount;
+ 
+   return NS_OK;
+ }
+ 
+ nsresult
+ ServiceWorkerPrivate::DetachDebugger()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!mDebuggerCount) {
+     return NS_ERROR_UNEXPECTED;
+   }
+ 
+   --mDebuggerCount;
+ 
+   // When the last debugger detaches from a worker, we either reset the idle
+@@ -2098,17 +2099,17 @@ ServiceWorkerPrivate::DetachDebugger()
+   }
+ 
+   return NS_OK;
+ }
+ 
+ bool
+ ServiceWorkerPrivate::IsIdle() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mTokenCount == 0 || (mTokenCount == 1 && mIdleKeepAliveToken);
+ }
+ 
+ namespace {
+ 
+ class ServiceWorkerPrivateTimerCallback final : public nsITimerCallback
+                                               , public nsINamed
+ {
+@@ -2148,17 +2149,17 @@ private:
+ 
+ NS_IMPL_ISUPPORTS(ServiceWorkerPrivateTimerCallback, nsITimerCallback, nsINamed);
+ 
+ } // anonymous namespace
+ 
+ void
+ ServiceWorkerPrivate::NoteIdleWorkerCallback(nsITimer* aTimer)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   MOZ_ASSERT(aTimer == mIdleWorkerTimer, "Invalid timer!");
+ 
+   // Release ServiceWorkerPrivate's token, since the grace period has ended.
+   mIdleKeepAliveToken = nullptr;
+ 
+   if (mWorkerPrivate) {
+     // If we still have a workerPrivate at this point it means there are pending
+@@ -2171,17 +2172,17 @@ ServiceWorkerPrivate::NoteIdleWorkerCall
+       mIdleWorkerTimer->InitWithCallback(cb, timeout, nsITimer::TYPE_ONE_SHOT);
+     MOZ_ASSERT(NS_SUCCEEDED(rv));
+   }
+ }
+ 
+ void
+ ServiceWorkerPrivate::TerminateWorkerCallback(nsITimer* aTimer)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   MOZ_ASSERT(aTimer == this->mIdleWorkerTimer, "Invalid timer!");
+ 
+   // mInfo must be non-null at this point because NoteDeadServiceWorkerInfo
+   // which zeroes it calls TerminateWorker which cancels our timer which will
+   // ensure we don't get invoked even if the nsTimerEvent is in the event queue.
+   ServiceWorkerManager::LocalizeAndReportToAllClients(
+     mInfo->Scope(),
+@@ -2218,24 +2219,24 @@ ServiceWorkerPrivate::ResetIdleTimeout()
+   DebugOnly<nsresult> rv =
+     mIdleWorkerTimer->InitWithCallback(cb, timeout, nsITimer::TYPE_ONE_SHOT);
+   MOZ_ASSERT(NS_SUCCEEDED(rv));
+ }
+ 
+ void
+ ServiceWorkerPrivate::AddToken()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   ++mTokenCount;
+ }
+ 
+ void
+ ServiceWorkerPrivate::ReleaseToken()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   MOZ_ASSERT(mTokenCount > 0);
+   --mTokenCount;
+   if (!mTokenCount) {
+     TerminateWorker();
+   }
+ 
+   // mInfo can be nullptr here if NoteDeadServiceWorkerInfo() is called while
+@@ -2246,28 +2247,29 @@ ServiceWorkerPrivate::ReleaseToken()
+       swm->WorkerIsIdle(mInfo);
+     }
+   }
+ }
+ 
+ already_AddRefed<KeepAliveToken>
+ ServiceWorkerPrivate::CreateEventKeepAliveToken()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mWorkerPrivate);
+   MOZ_ASSERT(mIdleKeepAliveToken);
+   RefPtr<KeepAliveToken> ref = new KeepAliveToken(this);
+   return ref.forget();
+ }
+ 
+ void
+ ServiceWorkerPrivate::SetHandlesFetch(bool aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (NS_WARN_IF(!mInfo)) {
+     return;
+   }
+ 
+   mInfo->SetHandlesFetch(aValue);
+ }
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerPrivate.h b/dom/serviceworkers/ServiceWorkerPrivate.h
+--- a/dom/serviceworkers/ServiceWorkerPrivate.h
++++ b/dom/serviceworkers/ServiceWorkerPrivate.h
+@@ -1,40 +1,37 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerprivate_h
+-#define mozilla_dom_workers_serviceworkerprivate_h
++#ifndef mozilla_dom_serviceworkerprivate_h
++#define mozilla_dom_serviceworkerprivate_h
+ 
+ #include "nsCOMPtr.h"
+ #include "WorkerPrivate.h"
+ 
+ #define NOTIFICATION_CLICK_EVENT_NAME "notificationclick"
+ #define NOTIFICATION_CLOSE_EVENT_NAME "notificationclose"
+ 
+ class nsIInterceptedChannel;
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ class ClientInfoAndState;
+-
+-namespace workers {
+-
++class KeepAliveToken;
+ class ServiceWorkerInfo;
+ class ServiceWorkerRegistrationInfo;
+-class KeepAliveToken;
+ 
+ class LifeCycleEventCallback : public Runnable
+ {
+ public:
+-  LifeCycleEventCallback() : Runnable("dom::workers::LifeCycleEventCallback") {}
++  LifeCycleEventCallback() : Runnable("dom::LifeCycleEventCallback") {}
+ 
+   // Called on the worker thread.
+   virtual void
+   SetResult(bool aResult) = 0;
+ };
+ 
+ // ServiceWorkerPrivate is a wrapper for managing the on-demand aspect of
+ // service workers. It handles all event dispatching to the worker and ensures
+@@ -209,17 +206,17 @@ private:
+   // The info object owns us. It is possible to outlive it for a brief period
+   // of time if there are pending waitUntil promises, in which case it
+   // will be null and |SpawnWorkerIfNeeded| will always fail.
+   ServiceWorkerInfo* MOZ_NON_OWNING_REF mInfo;
+ 
+   // The WorkerPrivate object can only be closed by this class or by the
+   // RuntimeService class if gecko is shutting down. Closing the worker
+   // multiple times is OK, since the second attempt will be a no-op.
+-  RefPtr<WorkerPrivate> mWorkerPrivate;
++  RefPtr<workers::WorkerPrivate> mWorkerPrivate;
+ 
+   nsCOMPtr<nsITimer> mIdleWorkerTimer;
+ 
+   // We keep a token for |dom.serviceWorkers.idle_timeout| seconds to give the
+   // worker a grace period after each event.
+   RefPtr<KeepAliveToken> mIdleKeepAliveToken;
+ 
+   uint64_t mDebuggerCount;
+@@ -229,16 +226,15 @@ private:
+   // Meant for keeping objects alive while handling requests from the worker
+   // on the main thread. Access to this array is provided through
+   // |StoreISupports| and |RemoveISupports|. Note that the array is also
+   // cleared whenever the worker is terminated.
+   nsTArray<nsCOMPtr<nsISupports>> mSupportsArray;
+ 
+   // Array of function event worker runnables that are pending due to
+   // the worker activating.  Main thread only.
+-  nsTArray<RefPtr<WorkerRunnable>> mPendingFunctionalEvents;
++  nsTArray<RefPtr<workers::WorkerRunnable>> mPendingFunctionalEvents;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerprivate_h
++#endif // mozilla_dom_serviceworkerprivate_h
+diff --git a/dom/serviceworkers/ServiceWorkerRegisterJob.cpp b/dom/serviceworkers/ServiceWorkerRegisterJob.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegisterJob.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegisterJob.cpp
+@@ -5,33 +5,32 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerRegisterJob.h"
+ 
+ #include "Workers.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ ServiceWorkerRegisterJob::ServiceWorkerRegisterJob(
+     nsIPrincipal* aPrincipal,
+     const nsACString& aScope,
+     const nsACString& aScriptSpec,
+     nsILoadGroup* aLoadGroup,
+     ServiceWorkerUpdateViaCache aUpdateViaCache)
+   : ServiceWorkerUpdateJob(Type::Register, aPrincipal, aScope, aScriptSpec,
+                            aLoadGroup, aUpdateViaCache)
+ {
+ }
+ 
+ void
+ ServiceWorkerRegisterJob::AsyncExecute()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (Canceled() || !swm) {
+     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> registration =
+@@ -72,11 +71,10 @@ ServiceWorkerRegisterJob::AsyncExecute()
+   SetRegistration(registration);
+   Update();
+ }
+ 
+ ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob()
+ {
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerRegisterJob.h b/dom/serviceworkers/ServiceWorkerRegisterJob.h
+--- a/dom/serviceworkers/ServiceWorkerRegisterJob.h
++++ b/dom/serviceworkers/ServiceWorkerRegisterJob.h
+@@ -1,22 +1,21 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerregisterjob_h
+-#define mozilla_dom_workers_serviceworkerregisterjob_h
++#ifndef mozilla_dom_serviceworkerregisterjob_h
++#define mozilla_dom_serviceworkerregisterjob_h
+ 
+ #include "ServiceWorkerUpdateJob.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ // The register job.  This implements the steps in the spec Register algorithm,
+ // but then uses ServiceWorkerUpdateJob to implement the Update and Install
+ // spec algorithms.
+ class ServiceWorkerRegisterJob final : public ServiceWorkerUpdateJob
+ {
+ public:
+   ServiceWorkerRegisterJob(nsIPrincipal* aPrincipal,
+@@ -29,13 +28,12 @@ private:
+   // Implement the Register algorithm steps and then call the parent class
+   // Update() to complete the job execution.
+   virtual void
+   AsyncExecute() override;
+ 
+   virtual ~ServiceWorkerRegisterJob();
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerregisterjob_h
++#endif // mozilla_dom_serviceworkerregisterjob_h
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrar.h b/dom/serviceworkers/ServiceWorkerRegistrar.h
+--- a/dom/serviceworkers/ServiceWorkerRegistrar.h
++++ b/dom/serviceworkers/ServiceWorkerRegistrar.h
+@@ -1,16 +1,16 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_ServiceWorkerRegistrar_h
+-#define mozilla_dom_workers_ServiceWorkerRegistrar_h
++#ifndef mozilla_dom_ServiceWorkerRegistrar_h
++#define mozilla_dom_ServiceWorkerRegistrar_h
+ 
+ #include "mozilla/Monitor.h"
+ #include "mozilla/Telemetry.h"
+ #include "nsClassHashtable.h"
+ #include "nsIAsyncShutdown.h"
+ #include "nsIObserver.h"
+ #include "nsCOMPtr.h"
+ #include "nsString.h"
+@@ -97,9 +97,9 @@ protected:
+   // PBackground thread only
+   bool mShuttingDown;
+   uint32_t mRunnableCounter;
+ };
+ 
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_ServiceWorkerRegistrar_h
++#endif // mozilla_dom_ServiceWorkerRegistrar_h
+diff --git a/dom/serviceworkers/ServiceWorkerRegistration.cpp b/dom/serviceworkers/ServiceWorkerRegistration.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistration.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistration.cpp
+@@ -182,17 +182,17 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(Servi
+                                    mPushManager,
+                                    mInstallingWorker, mWaitingWorker, mActiveWorker);
+ 
+ ServiceWorkerRegistrationMainThread::ServiceWorkerRegistrationMainThread(nsPIDOMWindowInner* aWindow,
+                                                                          const nsAString& aScope)
+   : ServiceWorkerRegistration(aWindow, aScope)
+   , mListeningForEvents(false)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aWindow);
+   MOZ_ASSERT(aWindow->IsInnerWindow());
+   StartListeningForEvents();
+ }
+ 
+ ServiceWorkerRegistrationMainThread::~ServiceWorkerRegistrationMainThread()
+ {
+   StopListeningForEvents();
+@@ -243,68 +243,68 @@ ServiceWorkerRegistrationMainThread::Get
+   return ref.forget();
+ }
+ 
+ // XXXnsm, maybe this can be optimized to only add when a event handler is
+ // registered.
+ void
+ ServiceWorkerRegistrationMainThread::StartListeningForEvents()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(!mListeningForEvents);
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (swm) {
+     swm->AddRegistrationEventListener(mScope, this);
+     mListeningForEvents = true;
+   }
+ }
+ 
+ void
+ ServiceWorkerRegistrationMainThread::StopListeningForEvents()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (!mListeningForEvents) {
+     return;
+   }
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (swm) {
+     swm->RemoveRegistrationEventListener(mScope, this);
+   }
+   mListeningForEvents = false;
+ }
+ 
+ already_AddRefed<ServiceWorker>
+ ServiceWorkerRegistrationMainThread::GetInstalling()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (!mInstallingWorker) {
+     mInstallingWorker = GetWorkerReference(WhichServiceWorker::INSTALLING_WORKER);
+   }
+ 
+   RefPtr<ServiceWorker> ret = mInstallingWorker;
+   return ret.forget();
+ }
+ 
+ already_AddRefed<ServiceWorker>
+ ServiceWorkerRegistrationMainThread::GetWaiting()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (!mWaitingWorker) {
+     mWaitingWorker = GetWorkerReference(WhichServiceWorker::WAITING_WORKER);
+   }
+ 
+   RefPtr<ServiceWorker> ret = mWaitingWorker;
+   return ret.forget();
+ }
+ 
+ already_AddRefed<ServiceWorker>
+ ServiceWorkerRegistrationMainThread::GetActive()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (!mActiveWorker) {
+     mActiveWorker = GetWorkerReference(WhichServiceWorker::ACTIVE_WORKER);
+   }
+ 
+   RefPtr<ServiceWorker> ret = mActiveWorker;
+   return ret.forget();
+ }
+ 
+@@ -312,17 +312,17 @@ void
+ ServiceWorkerRegistrationMainThread::UpdateFound()
+ {
+   DispatchTrustedEvent(NS_LITERAL_STRING("updatefound"));
+ }
+ 
+ void
+ ServiceWorkerRegistrationMainThread::TransitionWorker(WhichServiceWorker aWhichOne)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // We assert the worker's previous state because the 'statechange'
+   // event is dispatched in a queued runnable.
+   if (aWhichOne == WhichServiceWorker::INSTALLING_WORKER) {
+     MOZ_ASSERT_IF(mInstallingWorker, mInstallingWorker->State() == ServiceWorkerState::Installing);
+     mWaitingWorker = mInstallingWorker.forget();
+   } else if (aWhichOne == WhichServiceWorker::WAITING_WORKER) {
+     MOZ_ASSERT_IF(mWaitingWorker, mWaitingWorker->State() == ServiceWorkerState::Installed);
+@@ -330,17 +330,17 @@ ServiceWorkerRegistrationMainThread::Tra
+   } else {
+     MOZ_ASSERT_UNREACHABLE("Invalid transition!");
+   }
+ }
+ 
+ void
+ ServiceWorkerRegistrationMainThread::InvalidateWorkers(WhichServiceWorker aWhichOnes)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (aWhichOnes & WhichServiceWorker::INSTALLING_WORKER) {
+     mInstallingWorker = nullptr;
+   }
+ 
+   if (aWhichOnes & WhichServiceWorker::WAITING_WORKER) {
+     mWaitingWorker = nullptr;
+   }
+ 
+@@ -363,17 +363,17 @@ ServiceWorkerRegistrationMainThread::Reg
+ 
+ namespace {
+ 
+ void
+ UpdateInternal(nsIPrincipal* aPrincipal,
+                const nsAString& aScope,
+                ServiceWorkerUpdateFinishCallback* aCallback)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(aCallback);
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (!swm) {
+     // browser shutdown
+     return;
+   }
+@@ -388,17 +388,17 @@ class MainThreadUpdateCallback final : p
+   ~MainThreadUpdateCallback()
+   { }
+ 
+ public:
+   explicit MainThreadUpdateCallback(nsPIDOMWindowInner* aWindow,
+                                     Promise* aPromise)
+     : mPromise(aWindow, aPromise)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   UpdateSucceeded(ServiceWorkerRegistrationInfo* aRegistration) override
+   {
+     if (RefPtr<Promise> promise = mPromise.Get()) {
+       promise->MaybeResolveWithUndefined();
+     }
+@@ -460,17 +460,17 @@ class WorkerThreadUpdateCallback final :
+   ~WorkerThreadUpdateCallback()
+   {
+   }
+ 
+ public:
+   explicit WorkerThreadUpdateCallback(PromiseWorkerProxy* aPromiseProxy)
+     : mPromiseProxy(aPromiseProxy)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   UpdateSucceeded(ServiceWorkerRegistrationInfo* aRegistration) override
+   {
+     ErrorResult rv(NS_OK);
+     Finish(rv);
+   }
+@@ -496,29 +496,29 @@ public:
+     }
+ 
+     RefPtr<UpdateResultRunnable> r =
+       new UpdateResultRunnable(proxy, aStatus);
+     r->Dispatch();
+   }
+ };
+ 
+-class UpdateRunnable final : public Runnable
++class SWRUpdateRunnable final : public Runnable
+ {
+ public:
+-  UpdateRunnable(PromiseWorkerProxy* aPromiseProxy, const nsAString& aScope)
+-    : Runnable("dom::UpdateRunnable")
++  SWRUpdateRunnable(PromiseWorkerProxy* aPromiseProxy, const nsAString& aScope)
++    : Runnable("dom::SWRUpdateRunnable")
+     , mPromiseProxy(aPromiseProxy)
+     , mScope(aScope)
+   {}
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     ErrorResult result;
+ 
+     nsCOMPtr<nsIPrincipal> principal;
+     // UpdateInternal may try to reject the promise synchronously leading
+     // to a deadlock.
+     {
+       MutexAutoLock lock(mPromiseProxy->Lock());
+       if (mPromiseProxy->CleanedUp()) {
+@@ -531,17 +531,17 @@ public:
+ 
+     RefPtr<WorkerThreadUpdateCallback> cb =
+       new WorkerThreadUpdateCallback(mPromiseProxy);
+     UpdateInternal(principal, mScope, cb);
+     return NS_OK;
+   }
+ 
+ private:
+-  ~UpdateRunnable()
++  ~SWRUpdateRunnable()
+   {}
+ 
+   RefPtr<PromiseWorkerProxy> mPromiseProxy;
+   const nsString mScope;
+ };
+ 
+ class UnregisterCallback final : public nsIServiceWorkerUnregisterCallback
+ {
+@@ -555,27 +555,27 @@ public:
+     : mPromise(aWindow, aPromise)
+   {
+     MOZ_ASSERT(aPromise);
+   }
+ 
+   NS_IMETHOD
+   UnregisterSucceeded(bool aState) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     if (RefPtr<Promise> promise = mPromise.Get()) {
+       promise->MaybeResolve(aState);
+     }
+     return NS_OK;
+   }
+ 
+   NS_IMETHOD
+   UnregisterFailed() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     if (RefPtr<Promise> promise = mPromise.Get()) {
+       promise->MaybeReject(NS_ERROR_DOM_SECURITY_ERR);
+     }
+     return NS_OK;
+   }
+ 
+ private:
+@@ -591,17 +591,17 @@ class FulfillUnregisterPromiseRunnable f
+   Maybe<bool> mState;
+ public:
+   FulfillUnregisterPromiseRunnable(PromiseWorkerProxy* aProxy,
+                                    const Maybe<bool>& aState)
+     : WorkerRunnable(aProxy->GetWorkerPrivate())
+     , mPromiseWorkerProxy(aProxy)
+     , mState(aState)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mPromiseWorkerProxy);
+   }
+ 
+   bool
+   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+   {
+     RefPtr<Promise> promise = mPromiseWorkerProxy->WorkerPromise();
+     if (mState.isSome()) {
+@@ -625,37 +625,37 @@ public:
+     : mPromiseWorkerProxy(aProxy)
+   {
+     MOZ_ASSERT(aProxy);
+   }
+ 
+   NS_IMETHOD
+   UnregisterSucceeded(bool aState) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     Finish(Some(aState));
+     return NS_OK;
+   }
+ 
+   NS_IMETHOD
+   UnregisterFailed() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     Finish(Nothing());
+     return NS_OK;
+   }
+ 
+ private:
+   ~WorkerUnregisterCallback()
+   {}
+ 
+   void
+   Finish(const Maybe<bool>& aState)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     if (!mPromiseWorkerProxy) {
+       return;
+     }
+ 
+     RefPtr<PromiseWorkerProxy> proxy = mPromiseWorkerProxy.forget();
+     MutexAutoLock lock(proxy->Lock());
+     if (proxy->CleanedUp()) {
+       return;
+@@ -686,17 +686,17 @@ public:
+     , mScope(aScope)
+   {
+     MOZ_ASSERT(aProxy);
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     // XXXnsm: There is a rare chance of this failing if the worker gets
+     // destroyed. In that case, unregister() called from a SW is no longer
+     // guaranteed to run. We should fix this by having a main thread proxy
+     // maintain a strongref to ServiceWorkerRegistrationInfo and use its
+     // principal. Can that be trusted?
+     nsCOMPtr<nsIPrincipal> principal;
+     {
+@@ -723,17 +723,17 @@ public:
+     return NS_OK;
+   }
+ };
+ } // namespace
+ 
+ already_AddRefed<Promise>
+ ServiceWorkerRegistrationMainThread::Update(ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(GetOwner());
+   if (!go) {
+     aRv.Throw(NS_ERROR_FAILURE);
+     return nullptr;
+   }
+ 
+   RefPtr<Promise> promise = Promise::Create(go, aRv);
+   if (NS_WARN_IF(aRv.Failed())) {
+@@ -748,17 +748,17 @@ ServiceWorkerRegistrationMainThread::Upd
+   UpdateInternal(doc->NodePrincipal(), mScope, cb);
+ 
+   return promise.forget();
+ }
+ 
+ already_AddRefed<Promise>
+ ServiceWorkerRegistrationMainThread::Unregister(ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(GetOwner());
+   if (!go) {
+     aRv.Throw(NS_ERROR_FAILURE);
+     return nullptr;
+   }
+ 
+   // Although the spec says that the same-origin checks should also be done
+   // asynchronously, we do them in sync because the Promise created by the
+@@ -815,17 +815,17 @@ ServiceWorkerRegistrationMainThread::Unr
+ 
+ // Notification API extension.
+ already_AddRefed<Promise>
+ ServiceWorkerRegistrationMainThread::ShowNotification(JSContext* aCx,
+                                                       const nsAString& aTitle,
+                                                       const NotificationOptions& aOptions,
+                                                       ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsPIDOMWindowInner> window = GetOwner();
+   if (NS_WARN_IF(!window)) {
+     aRv.Throw(NS_ERROR_FAILURE);
+     return nullptr;
+   }
+ 
+   nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
+   if (NS_WARN_IF(!doc)) {
+@@ -848,30 +848,30 @@ ServiceWorkerRegistrationMainThread::Sho
+   }
+ 
+   return p.forget();
+ }
+ 
+ already_AddRefed<Promise>
+ ServiceWorkerRegistrationMainThread::GetNotifications(const GetNotificationOptions& aOptions, ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsPIDOMWindowInner> window = GetOwner();
+   if (NS_WARN_IF(!window)) {
+     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+     return nullptr;
+   }
+   return Notification::Get(window, aOptions, mScope, aRv);
+ }
+ 
+ already_AddRefed<PushManager>
+ ServiceWorkerRegistrationMainThread::GetPushManager(JSContext* aCx,
+                                                     ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!mPushManager) {
+     nsCOMPtr<nsIGlobalObject> globalObject = do_QueryInterface(GetOwner());
+ 
+     if (!globalObject) {
+       aRv.Throw(NS_ERROR_FAILURE);
+       return nullptr;
+     }
+@@ -985,31 +985,31 @@ public:
+     MOZ_ASSERT(mRegistration);
+     // Copy scope so we can return it on the main thread.
+     mRegistration->GetScope(mScope);
+   }
+ 
+   void
+   StartListeningForEvents()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(!mListeningForEvents);
+     MOZ_ASSERT(mWorkerPrivate);
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+     if (swm) {
+       // FIXME(nsm): Maybe the function shouldn't take an explicit scope.
+       swm->AddRegistrationEventListener(mScope, this);
+       mListeningForEvents = true;
+     }
+   }
+ 
+   void
+   StopListeningForEvents()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     MOZ_ASSERT(mListeningForEvents);
+ 
+     RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+ 
+     // We aren't going to need this anymore and we shouldn't hold on since the
+     // worker will go away soon.
+     mWorkerPrivate = nullptr;
+@@ -1023,31 +1023,31 @@ public:
+ 
+   // ServiceWorkerRegistrationListener
+   void
+   UpdateFound() override;
+ 
+   void
+   TransitionWorker(WhichServiceWorker aWhichOne) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     NS_WARNING("FIXME: Not implemented!");
+   }
+ 
+   void
+   InvalidateWorkers(WhichServiceWorker aWhichOnes) override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     // FIXME(nsm);
+   }
+ 
+   void
+   RegistrationRemoved() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   GetScope(nsAString& aScope) const override
+   {
+     aScope = mScope;
+   }
+ 
+@@ -1107,17 +1107,17 @@ ServiceWorkerRegistrationWorkerThread::S
+ }
+ 
+ ServiceWorkerRegistrationWorkerThread::~ServiceWorkerRegistrationWorkerThread()
+ {
+   ReleaseListener();
+   MOZ_ASSERT(!mListener);
+ }
+ 
+-already_AddRefed<workers::ServiceWorker>
++already_AddRefed<ServiceWorker>
+ ServiceWorkerRegistrationWorkerThread::GetInstalling()
+ {
+   // FIXME(nsm): Will be implemented after Bug 1113522.
+   return nullptr;
+ }
+ 
+ already_AddRefed<ServiceWorker>
+ ServiceWorkerRegistrationWorkerThread::GetWaiting()
+@@ -1154,17 +1154,17 @@ ServiceWorkerRegistrationWorkerThread::U
+   }
+ 
+   RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, promise);
+   if (!proxy) {
+     aRv.Throw(NS_ERROR_DOM_ABORT_ERR);
+     return nullptr;
+   }
+ 
+-  RefPtr<UpdateRunnable> r = new UpdateRunnable(proxy, mScope);
++  RefPtr<SWRUpdateRunnable> r = new SWRUpdateRunnable(proxy, mScope);
+   MOZ_ALWAYS_SUCCEEDS(worker->DispatchToMainThread(r.forget()));
+ 
+   return promise.forget();
+ }
+ 
+ already_AddRefed<Promise>
+ ServiceWorkerRegistrationWorkerThread::Unregister(ErrorResult& aRv)
+ {
+@@ -1280,17 +1280,17 @@ public:
+     }
+     return true;
+   }
+ };
+ 
+ void
+ WorkerListener::UpdateFound()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   if (mWorkerPrivate) {
+     RefPtr<FireUpdateFoundRunnable> r =
+       new FireUpdateFoundRunnable(mWorkerPrivate, this);
+     Unused << NS_WARN_IF(!r->Dispatch());
+   }
+ }
+ 
+ // Notification API extension.
+@@ -1363,17 +1363,17 @@ ServiceWorkerRegistration::CreateForMain
+ 
+   RefPtr<ServiceWorkerRegistration> registration =
+     new ServiceWorkerRegistrationMainThread(aWindow, aScope);
+ 
+   return registration.forget();
+ }
+ 
+ /* static */ already_AddRefed<ServiceWorkerRegistration>
+-ServiceWorkerRegistration::CreateForWorker(workers::WorkerPrivate* aWorkerPrivate,
++ServiceWorkerRegistration::CreateForWorker(WorkerPrivate* aWorkerPrivate,
+                                            const nsAString& aScope)
+ {
+   MOZ_ASSERT(aWorkerPrivate);
+   aWorkerPrivate->AssertIsOnWorkerThread();
+ 
+   RefPtr<ServiceWorkerRegistration> registration =
+     new ServiceWorkerRegistrationWorkerThread(aWorkerPrivate, aScope);
+ 
+diff --git a/dom/serviceworkers/ServiceWorkerRegistration.h b/dom/serviceworkers/ServiceWorkerRegistration.h
+--- a/dom/serviceworkers/ServiceWorkerRegistration.h
++++ b/dom/serviceworkers/ServiceWorkerRegistration.h
+@@ -21,21 +21,16 @@ class nsPIDOMWindowInner;
+ 
+ namespace mozilla {
+ namespace dom {
+ 
+ class Promise;
+ class PushManager;
+ class WorkerListener;
+ 
+-namespace workers {
+-class ServiceWorker;
+-class WorkerPrivate;
+-} // namespace workers
+-
+ // Used by ServiceWorkerManager to notify ServiceWorkerRegistrations of
+ // updatefound event and invalidating ServiceWorker instances.
+ class ServiceWorkerRegistrationListener
+ {
+ public:
+   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
+ 
+   virtual void
+@@ -67,23 +62,23 @@ public:
+ 
+   static already_AddRefed<ServiceWorkerRegistration>
+   CreateForWorker(workers::WorkerPrivate* aWorkerPrivate,
+                   const nsAString& aScope);
+ 
+   JSObject*
+   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+ 
+-  virtual already_AddRefed<workers::ServiceWorker>
++  virtual already_AddRefed<ServiceWorker>
+   GetInstalling() = 0;
+ 
+-  virtual already_AddRefed<workers::ServiceWorker>
++  virtual already_AddRefed<ServiceWorker>
+   GetWaiting() = 0;
+ 
+-  virtual already_AddRefed<workers::ServiceWorker>
++  virtual already_AddRefed<ServiceWorker>
+   GetActive() = 0;
+ 
+   virtual void
+   GetScope(nsAString& aScope) const = 0;
+ 
+   virtual ServiceWorkerUpdateViaCache
+   GetUpdateViaCache(ErrorResult& aRv) const = 0;
+ 
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+@@ -4,43 +4,44 @@
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerRegistrationInfo.h"
+ 
+ #include "ServiceWorkerManager.h"
+ #include "ServiceWorkerPrivate.h"
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ namespace {
+ 
+ class ContinueActivateRunnable final : public LifeCycleEventCallback
+ {
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> mRegistration;
+   bool mSuccess;
+ 
+ public:
+   explicit ContinueActivateRunnable(const nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo>& aRegistration)
+     : mRegistration(aRegistration)
+     , mSuccess(false)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   SetResult(bool aResult) override
+   {
+     mSuccess = aResult;
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mRegistration->FinishActivate(mSuccess);
+     mRegistration = nullptr;
+     return NS_OK;
+   }
+ };
+ 
+ } // anonymous namespace
+ 
+@@ -100,33 +101,33 @@ ServiceWorkerRegistrationInfo::~ServiceW
+   MOZ_DIAGNOSTIC_ASSERT(!IsControllingClients());
+ }
+ 
+ NS_IMPL_ISUPPORTS(ServiceWorkerRegistrationInfo, nsIServiceWorkerRegistrationInfo)
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetPrincipal(nsIPrincipal** aPrincipal)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   NS_ADDREF(*aPrincipal = mPrincipal);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetScope(nsAString& aScope)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   CopyUTF8toUTF16(mScope, aScope);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetScriptSpec(nsAString& aScriptSpec)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   RefPtr<ServiceWorkerInfo> newest = Newest();
+   if (newest) {
+     CopyUTF8toUTF16(newest->ScriptSpec(), aScriptSpec);
+   }
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+@@ -134,95 +135,95 @@ ServiceWorkerRegistrationInfo::GetUpdate
+ {
+     *aUpdateViaCache = static_cast<uint16_t>(GetUpdateViaCache());
+     return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetLastUpdateTime(PRTime* _retval)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(_retval);
+   *_retval = mLastUpdateTime;
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetInstallingWorker(nsIServiceWorkerInfo **aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIServiceWorkerInfo> info = do_QueryInterface(mInstallingWorker);
+   info.forget(aResult);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetWaitingWorker(nsIServiceWorkerInfo **aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIServiceWorkerInfo> info = do_QueryInterface(mWaitingWorker);
+   info.forget(aResult);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetActiveWorker(nsIServiceWorkerInfo **aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   nsCOMPtr<nsIServiceWorkerInfo> info = do_QueryInterface(mActiveWorker);
+   info.forget(aResult);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::GetWorkerByID(uint64_t aID, nsIServiceWorkerInfo **aResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aResult);
+ 
+   RefPtr<ServiceWorkerInfo> info = GetServiceWorkerInfoById(aID);
+   // It is ok to return null for a missing service worker info.
+   info.forget(aResult);
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::AddListener(
+                             nsIServiceWorkerRegistrationInfoListener *aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!aListener || mListeners.Contains(aListener)) {
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+   mListeners.AppendElement(aListener);
+ 
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ ServiceWorkerRegistrationInfo::RemoveListener(
+                             nsIServiceWorkerRegistrationInfoListener *aListener)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!aListener || !mListeners.Contains(aListener)) {
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+   mListeners.RemoveElement(aListener);
+ 
+   return NS_OK;
+ }
+ 
+ already_AddRefed<ServiceWorkerInfo>
+ ServiceWorkerRegistrationInfo::GetServiceWorkerInfoById(uint64_t aId)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerInfo> serviceWorker;
+   if (mEvaluatingWorker && mEvaluatingWorker->ID() == aId) {
+     serviceWorker = mEvaluatingWorker;
+   } else if (mInstallingWorker && mInstallingWorker->ID() == aId) {
+     serviceWorker = mInstallingWorker;
+   } else if (mWaitingWorker && mWaitingWorker->ID() == aId) {
+     serviceWorker = mWaitingWorker;
+@@ -243,17 +244,17 @@ ServiceWorkerRegistrationInfo::TryToActi
+ }
+ 
+ /*
+  * TryToActivate should not be called directly, use TryToActivateAsync instead.
+  */
+ void
+ ServiceWorkerRegistrationInfo::TryToActivate()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   bool controlling = IsControllingClients();
+   bool skipWaiting = mWaitingWorker && mWaitingWorker->SkipWaitingFlag();
+   bool idle = IsIdle();
+   if (idle && (!controlling || skipWaiting)) {
+     Activate();
+   }
+ }
+ 
+@@ -274,17 +275,17 @@ ServiceWorkerRegistrationInfo::Activate(
+ 
+   // FIXME(nsm): Unlink appcache if there is one.
+ 
+   // "Queue a task to fire a simple event named controllerchange..."
+   MOZ_DIAGNOSTIC_ASSERT(mActiveWorker);
+   swm->UpdateClientControllers(this);
+ 
+   nsCOMPtr<nsIRunnable> failRunnable = NewRunnableMethod<bool>(
+-    "dom::workers::ServiceWorkerRegistrationInfo::FinishActivate",
++    "dom::ServiceWorkerRegistrationInfo::FinishActivate",
+     this,
+     &ServiceWorkerRegistrationInfo::FinishActivate,
+     false /* success */);
+ 
+   nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> handle(
+     new nsMainThreadPtrHolder<ServiceWorkerRegistrationInfo>(
+       "ServiceWorkerRegistrationInfoProxy", this));
+   RefPtr<LifeCycleEventCallback> callback = new ContinueActivateRunnable(handle);
+@@ -318,28 +319,28 @@ ServiceWorkerRegistrationInfo::FinishAct
+     return;
+   }
+   swm->StoreRegistration(mPrincipal, this);
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::RefreshLastUpdateCheckTime()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   mLastUpdateTime =
+     mCreationTime + static_cast<PRTime>((TimeStamp::Now() -
+                                          mCreationTimeStamp).ToMicroseconds());
+   NotifyChromeRegistrationListeners();
+ }
+ 
+ bool
+ ServiceWorkerRegistrationInfo::IsLastUpdateCheckTimeOverOneDay() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // For testing.
+   if (Preferences::GetBool("dom.serviceWorkers.testUpdateOverOneDay")) {
+     return true;
+   }
+ 
+   const int64_t kSecondsPerDay = 86400;
+   const int64_t nowMicros =
+@@ -354,17 +355,17 @@ ServiceWorkerRegistrationInfo::IsLastUpd
+   }
+   return false;
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::AsyncUpdateRegistrationStateProperties(WhichServiceWorker aWorker,
+                                                                       TransitionType aTransition)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (!swm) {
+     // browser shutdown started during this async step
+     return;
+   }
+ 
+   if (aTransition == Invalidate) {
+     swm->InvalidateServiceWorkerRegistrationWorker(this, aWorker);
+@@ -377,21 +378,21 @@ ServiceWorkerRegistrationInfo::AsyncUpda
+     }
+   }
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::UpdateRegistrationStateProperties(WhichServiceWorker aWorker,
+                                                                  TransitionType aTransition)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIRunnable> runnable =
+     NewRunnableMethod<WhichServiceWorker, TransitionType>(
+-      "dom::workers::ServiceWorkerRegistrationInfo::"
++      "dom::ServiceWorkerRegistrationInfo::"
+       "AsyncUpdateRegistrationStateProperties",
+       this,
+       &ServiceWorkerRegistrationInfo::AsyncUpdateRegistrationStateProperties,
+       aWorker,
+       aTransition);
+   MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable.forget()));
+ }
+ 
+@@ -402,17 +403,17 @@ ServiceWorkerRegistrationInfo::NotifyChr
+   for (size_t index = 0; index < listeners.Length(); ++index) {
+     listeners[index]->OnChange();
+   }
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::MaybeScheduleTimeCheckAndUpdate()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (!swm) {
+     // shutting down, do nothing
+     return;
+   }
+ 
+   if (mUpdateState == NoUpdate) {
+@@ -420,68 +421,68 @@ ServiceWorkerRegistrationInfo::MaybeSche
+   }
+ 
+   swm->ScheduleUpdateTimer(mPrincipal, mScope);
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::MaybeScheduleUpdate()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (!swm) {
+     // shutting down, do nothing
+     return;
+   }
+ 
+   mUpdateState = NeedUpdate;
+ 
+   swm->ScheduleUpdateTimer(mPrincipal, mScope);
+ }
+ 
+ bool
+ ServiceWorkerRegistrationInfo::CheckAndClearIfUpdateNeeded()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   bool result = mUpdateState == NeedUpdate ||
+                (mUpdateState == NeedTimeCheckAndUpdate &&
+                 IsLastUpdateCheckTimeOverOneDay());
+ 
+   mUpdateState = NoUpdate;
+ 
+   return result;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerRegistrationInfo::GetEvaluating() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mEvaluatingWorker;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerRegistrationInfo::GetInstalling() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mInstallingWorker;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerRegistrationInfo::GetWaiting() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mWaitingWorker;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerRegistrationInfo::GetActive() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mActiveWorker;
+ }
+ 
+ ServiceWorkerInfo*
+ ServiceWorkerRegistrationInfo::GetByID(uint64_t aID) const
+ {
+   if (mActiveWorker && mActiveWorker->ID() == aID) {
+     return mActiveWorker;
+@@ -496,45 +497,45 @@ ServiceWorkerRegistrationInfo::GetByID(u
+     return mEvaluatingWorker;
+   }
+   return nullptr;
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::SetEvaluating(ServiceWorkerInfo* aServiceWorker)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aServiceWorker);
+   MOZ_ASSERT(!mEvaluatingWorker);
+   MOZ_ASSERT(!mInstallingWorker);
+   MOZ_ASSERT(mWaitingWorker != aServiceWorker);
+   MOZ_ASSERT(mActiveWorker != aServiceWorker);
+ 
+   mEvaluatingWorker = aServiceWorker;
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::ClearEvaluating()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!mEvaluatingWorker) {
+     return;
+   }
+ 
+   mEvaluatingWorker->UpdateState(ServiceWorkerState::Redundant);
+   // We don't update the redundant time for the sw here, since we've not expose
+   // evalutingWorker yet.
+   mEvaluatingWorker = nullptr;
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::ClearInstalling()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (!mInstallingWorker) {
+     return;
+   }
+ 
+   UpdateRegistrationStateProperties(WhichServiceWorker::INSTALLING_WORKER,
+                                     Invalidate);
+   mInstallingWorker->UpdateState(ServiceWorkerState::Redundant);
+@@ -542,29 +543,29 @@ ServiceWorkerRegistrationInfo::ClearInst
+   mInstallingWorker = nullptr;
+ 
+   NotifyChromeRegistrationListeners();
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::TransitionEvaluatingToInstalling()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mEvaluatingWorker);
+   MOZ_ASSERT(!mInstallingWorker);
+ 
+   mInstallingWorker = mEvaluatingWorker.forget();
+   mInstallingWorker->UpdateState(ServiceWorkerState::Installing);
+   NotifyChromeRegistrationListeners();
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::TransitionInstallingToWaiting()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mInstallingWorker);
+ 
+   if (mWaitingWorker) {
+     MOZ_ASSERT(mInstallingWorker->CacheName() != mWaitingWorker->CacheName());
+     mWaitingWorker->UpdateState(ServiceWorkerState::Redundant);
+     mWaitingWorker->UpdateRedundantTime();
+   }
+ 
+@@ -581,17 +582,17 @@ ServiceWorkerRegistrationInfo::Transitio
+     return;
+   }
+   swm->StoreRegistration(mPrincipal, this);
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::SetActive(ServiceWorkerInfo* aServiceWorker)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aServiceWorker);
+ 
+   // TODO: Assert installing, waiting, and active are nullptr once the SWM
+   //       moves to the parent process.  After that happens this code will
+   //       only run for browser initialization and not for cross-process
+   //       overrides.
+   MOZ_ASSERT(mInstallingWorker != aServiceWorker);
+   MOZ_ASSERT(mWaitingWorker != aServiceWorker);
+@@ -612,17 +613,17 @@ ServiceWorkerRegistrationInfo::SetActive
+   // registrar.
+   UpdateRegistrationStateProperties(WhichServiceWorker::ACTIVE_WORKER, Invalidate);
+   NotifyChromeRegistrationListeners();
+ }
+ 
+ void
+ ServiceWorkerRegistrationInfo::TransitionWaitingToActive()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mWaitingWorker);
+ 
+   if (mActiveWorker) {
+     MOZ_ASSERT(mWaitingWorker->CacheName() != mActiveWorker->CacheName());
+     mActiveWorker->UpdateState(ServiceWorkerState::Redundant);
+     mActiveWorker->UpdateRedundantTime();
+   }
+ 
+@@ -665,9 +666,10 @@ ServiceWorkerRegistrationInfo::SetLastUp
+ {
+   if (aTime == 0) {
+     return;
+   }
+ 
+   mLastUpdateTime = aTime;
+ }
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrationInfo.h b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
++++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+@@ -1,25 +1,24 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerregistrationinfo_h
+-#define mozilla_dom_workers_serviceworkerregistrationinfo_h
++#ifndef mozilla_dom_serviceworkerregistrationinfo_h
++#define mozilla_dom_serviceworkerregistrationinfo_h
+ 
+-#include "mozilla/dom/workers/ServiceWorkerInfo.h"
++#include "mozilla/dom/ServiceWorkerInfo.h"
+ #include "mozilla/dom/ServiceWorkerCommon.h"
+ #include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
+ #include "nsProxyRelease.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerRegistrationInfo final
+   : public nsIServiceWorkerRegistrationInfo
+ {
+   uint32_t mControlledClientsCounter;
+ 
+   enum
+   {
+@@ -217,13 +216,12 @@ private:
+   // Used by devtools to track changes to the properties of *nsIServiceWorkerRegistrationInfo*.
+   // Note, this doesn't necessarily need to be in sync with the DOM registration objects, but
+   // it does need to be called in the same task that changed |mInstallingWorker|,
+   // |mWaitingWorker| or |mActiveWorker|.
+   void
+   NotifyChromeRegistrationListeners();
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerregistrationinfo_h
++#endif // mozilla_dom_serviceworkerregistrationinfo_h
+diff --git a/dom/serviceworkers/ServiceWorkerScriptCache.cpp b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+--- a/dom/serviceworkers/ServiceWorkerScriptCache.cpp
++++ b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+@@ -29,32 +29,33 @@
+ #include "ServiceWorkerManager.h"
+ #include "Workers.h"
+ #include "nsStringStream.h"
+ 
+ using mozilla::dom::cache::Cache;
+ using mozilla::dom::cache::CacheStorage;
+ using mozilla::ipc::PrincipalInfo;
+ 
+-BEGIN_WORKERS_NAMESPACE
++namespace mozilla {
++namespace dom {
+ 
+ namespace serviceWorkerScriptCache {
+ 
+ namespace {
+ 
+ // XXX A sandbox nsIGlobalObject does not preserve its reflector, so |aSandbox|
+ // must be kept alive as long as the CacheStorage if you want to ensure that
+ // the CacheStorage will continue to work. Failures will manifest as errors
+ // like "JavaScript error: , line 0: TypeError: The expression cannot be
+ // converted to return the specified type."
+ already_AddRefed<CacheStorage>
+ CreateCacheStorage(JSContext* aCx, nsIPrincipal* aPrincipal, ErrorResult& aRv,
+                    JS::MutableHandle<JSObject*> aSandbox)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   nsIXPConnect* xpc = nsContentUtils::XPConnect();
+   MOZ_ASSERT(xpc, "This should never be null!");
+   aRv = xpc->CreateSandbox(aCx, aPrincipal, aSandbox.address());
+   if (NS_WARN_IF(aRv.Failed())) {
+     return nullptr;
+   }
+@@ -104,17 +105,17 @@ public:
+     , mLoadFlags(nsIChannel::LOAD_BYPASS_SERVICE_WORKER)
+     , mState(WaitingForInitialization)
+     , mNetworkResult(NS_OK)
+     , mCacheResult(NS_OK)
+     , mIsMainScript(aIsMainScript)
+     , mIsFromCache(false)
+   {
+     MOZ_ASSERT(aManager);
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   nsresult
+   Initialize(nsIPrincipal* aPrincipal,
+              const nsAString& aURL,
+              nsILoadGroup* aLoadGroup,
+              Cache* const aCache);
+ 
+@@ -124,23 +125,23 @@ public:
+   void
+   NetworkFinish(nsresult aRv);
+ 
+   void
+   CacheFinish(nsresult aRv);
+ 
+   const nsString& URL() const
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     return mURL;
+   }
+ 
+   const nsString& Buffer() const
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     return mBuffer;
+   }
+ 
+   const ChannelInfo&
+   GetChannelInfo() const
+   {
+     return mChannelInfo;
+   }
+@@ -168,17 +169,17 @@ public:
+   URLList() const
+   {
+     return mURLList;
+   }
+ 
+ private:
+   ~CompareNetwork()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(!mCC);
+   }
+ 
+   void
+   Finish();
+ 
+   nsresult
+   SetPrincipalInfo(nsIChannel* aChannel);
+@@ -226,17 +227,17 @@ public:
+   NS_DECL_NSISTREAMLOADEROBSERVER
+ 
+   explicit CompareCache(CompareNetwork* aCN)
+     : mCN(aCN)
+     , mState(WaitingForInitialization)
+     , mInCache(false)
+   {
+     MOZ_ASSERT(aCN);
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   nsresult
+   Initialize(Cache* const aCache, const nsAString& aURL);
+ 
+   void
+   Finish(nsresult aStatus, bool aInCache);
+ 
+@@ -246,30 +247,30 @@ public:
+   virtual void
+   ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
+ 
+   virtual void
+   RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
+ 
+   const nsString& Buffer() const
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     return mBuffer;
+   }
+ 
+   bool
+   InCache()
+   {
+     return mInCache;
+   }
+ 
+ private:
+   ~CompareCache()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   ManageValueResult(JSContext* aCx, JS::Handle<JS::Value> aValue);
+ 
+   RefPtr<CompareNetwork> mCN;
+   nsCOMPtr<nsIInputStreamPump> mPump;
+ 
+@@ -296,46 +297,46 @@ public:
+                           CompareCallback* aCallback)
+     : mRegistration(aRegistration)
+     , mCallback(aCallback)
+     , mLoadFlags(nsIChannel::LOAD_BYPASS_SERVICE_WORKER)
+     , mState(WaitingForInitialization)
+     , mPendingCount(0)
+     , mAreScriptsEqual(true)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aRegistration);
+   }
+ 
+   nsresult
+   Initialize(nsIPrincipal* aPrincipal, const nsAString& aURL,
+              const nsAString& aCacheName, nsILoadGroup* aLoadGroup);
+ 
+   void
+   ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
+ 
+   void
+   RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
+ 
+   CacheStorage*
+   CacheStorage_()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mCacheStorage);
+     return mCacheStorage;
+   }
+ 
+   void
+   ComparisonFinished(nsresult aStatus,
+                      bool aIsMainScript,
+                      bool aIsEqual,
+                      const nsACString& aMaxScope,
+                      nsLoadFlags aLoadFlags)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     if (mState == Finished) {
+       return;
+     }
+ 
+     MOZ_DIAGNOSTIC_ASSERT(mState == WaitingForScriptOrComparisonResult);
+ 
+     if (NS_WARN_IF(NS_FAILED(aStatus))) {
+       Fail(aStatus);
+@@ -368,32 +369,32 @@ public:
+ 
+     // Write to Cache so ScriptLoader reads succeed.
+     WriteNetworkBufferToNewCache();
+   }
+ 
+ private:
+   ~CompareManager()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mCNList.Length() == 0);
+   }
+ 
+   void
+   Fail(nsresult aStatus);
+ 
+   void
+   Cleanup();
+ 
+   nsresult
+   FetchScript(const nsAString& aURL,
+               bool aIsMainScript,
+               Cache* const aCache = nullptr)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+ 
+     MOZ_DIAGNOSTIC_ASSERT(mState == WaitingForInitialization ||
+                           mState == WaitingForScriptOrComparisonResult);
+ 
+     RefPtr<CompareNetwork> cn = new CompareNetwork(this,
+                                                    mRegistration,
+                                                    aIsMainScript);
+     mCNList.AppendElement(cn);
+@@ -555,17 +556,17 @@ private:
+ 
+     mState = WaitingForPut;
+     guard.release();
+   }
+ 
+   void
+   WriteNetworkBufferToNewCache()
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(mCNList.Length() != 0);
+     MOZ_ASSERT(mCacheStorage);
+     MOZ_ASSERT(mNewCacheName.IsEmpty());
+ 
+     ErrorResult result;
+     result = serviceWorkerScriptCache::GenerateCacheName(mNewCacheName);
+     if (NS_WARN_IF(result.Failed())) {
+       MOZ_ASSERT(!result.IsErrorWithMessage());
+@@ -582,17 +583,17 @@ private:
+ 
+     mState = WaitingForOpen;
+     cacheOpenPromise->AppendNativeHandler(this);
+   }
+ 
+   nsresult
+   WriteToCache(JSContext* aCx, Cache* aCache, CompareNetwork* aCN)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     MOZ_ASSERT(aCache);
+     MOZ_ASSERT(aCN);
+     MOZ_DIAGNOSTIC_ASSERT(mState == WaitingForOpen);
+ 
+     // We don't have to save any information from a failed CompareNetwork.
+     if (!aCN->Succeeded()) {
+       return NS_OK;
+     }
+@@ -681,17 +682,17 @@ NS_IMPL_ISUPPORTS0(CompareManager)
+ 
+ nsresult
+ CompareNetwork::Initialize(nsIPrincipal* aPrincipal,
+                            const nsAString& aURL,
+                            nsILoadGroup* aLoadGroup,
+                            Cache* const aCache)
+ {
+   MOZ_ASSERT(aPrincipal);
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   nsCOMPtr<nsIURI> uri;
+   nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL, nullptr, nullptr);
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     return rv;
+   }
+ 
+   mURL = aURL;
+@@ -849,17 +850,17 @@ CompareNetwork::CacheFinish(nsresult aRv
+     Finish();
+     return;
+   }
+ }
+ 
+ void
+ CompareNetwork::Abort()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState != Finished) {
+     mState = Finished;
+ 
+     MOZ_ASSERT(mChannel);
+     mChannel->Cancel(NS_BINDING_ABORTED);
+     mChannel = nullptr;
+ 
+@@ -868,17 +869,17 @@ CompareNetwork::Abort()
+       mCC = nullptr;
+     }
+   }
+ }
+ 
+ NS_IMETHODIMP
+ CompareNetwork::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState == Finished) {
+     return NS_OK;
+   }
+ 
+   nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
+   MOZ_ASSERT_IF(mIsMainScript, channel == mChannel);
+   mChannel = channel;
+@@ -934,17 +935,17 @@ CompareNetwork::OnStopRequest(nsIRequest
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ CompareNetwork::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
+                                  nsresult aStatus, uint32_t aLen,
+                                  const uint8_t* aString)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState == Finished) {
+     return NS_OK;
+   }
+ 
+   nsresult rv = NS_ERROR_FAILURE;
+   auto guard = MakeScopeExit([&] {
+     NetworkFinish(rv);
+@@ -1053,17 +1054,17 @@ CompareNetwork::OnStreamComplete(nsIStre
+ 
+   rv = NS_OK;
+   return NS_OK;
+ }
+ 
+ nsresult
+ CompareCache::Initialize(Cache* const aCache, const nsAString& aURL)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aCache);
+   MOZ_DIAGNOSTIC_ASSERT(mState == WaitingForInitialization);
+ 
+   // This JSContext will not end up executing JS code because here there are
+   // no ReadableStreams involved.
+   AutoJSAPI jsapi;
+   jsapi.Init();
+ 
+@@ -1093,34 +1094,34 @@ CompareCache::Finish(nsresult aStatus, b
+     mInCache = aInCache;
+     mCN->CacheFinish(aStatus);
+   }
+ }
+ 
+ void
+ CompareCache::Abort()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState != Finished) {
+     mState = Finished;
+ 
+     if (mPump) {
+       mPump->Cancel(NS_BINDING_ABORTED);
+       mPump = nullptr;
+     }
+   }
+ }
+ 
+ NS_IMETHODIMP
+ CompareCache::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
+                                nsresult aStatus, uint32_t aLen,
+                                const uint8_t* aString)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState == Finished) {
+     return aStatus;
+   }
+ 
+   if (NS_WARN_IF(NS_FAILED(aStatus))) {
+     Finish(aStatus, false);
+     return aStatus;
+@@ -1141,44 +1142,44 @@ CompareCache::OnStreamComplete(nsIStream
+ 
+   Finish(NS_OK, true);
+   return NS_OK;
+ }
+ 
+ void
+ CompareCache::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   switch (mState) {
+     case Finished:
+       return;
+     case WaitingForScript:
+       ManageValueResult(aCx, aValue);
+       return;
+     default:
+       MOZ_CRASH("Unacceptable state.");
+   }
+ }
+ 
+ void
+ CompareCache::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState != Finished) {
+     Finish(NS_ERROR_FAILURE, false);
+     return;
+   }
+ }
+ 
+ void
+ CompareCache::ManageValueResult(JSContext* aCx, JS::Handle<JS::Value> aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   // The cache returns undefined if the object is not stored.
+   if (aValue.isUndefined()) {
+     Finish(NS_OK, false);
+     return;
+   }
+ 
+   MOZ_ASSERT(aValue.isObject());
+@@ -1242,17 +1243,17 @@ CompareCache::ManageValueResult(JSContex
+ }
+ 
+ nsresult
+ CompareManager::Initialize(nsIPrincipal* aPrincipal,
+                            const nsAString& aURL,
+                            const nsAString& aCacheName,
+                            nsILoadGroup* aLoadGroup)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(mPendingCount == 0);
+   MOZ_DIAGNOSTIC_ASSERT(mState == WaitingForInitialization);
+ 
+   // RAII Cleanup when fails.
+   auto guard = MakeScopeExit([&] { Cleanup(); });
+ 
+   mURL = aURL;
+@@ -1301,17 +1302,17 @@ CompareManager::Initialize(nsIPrincipal*
+ // 1. Retrieve the Cache object by a given CacheName of OldCache.
+ // 2. Retrieve the URLs saved in OldCache.
+ // 3. Retrieve the Cache object of the NewCache for the newly created SW.
+ // 4. Put the value in the cache.
+ // For this reason we have mState to know what callback we are handling.
+ void
+ CompareManager::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(mCallback);
+ 
+   switch (mState) {
+     case Finished:
+       return;
+     case WaitingForExistingOpen:
+       ManageOldCache(aCx, aValue);
+       return;
+@@ -1335,17 +1336,17 @@ CompareManager::ResolvedCallback(JSConte
+     default:
+       MOZ_DIAGNOSTIC_ASSERT(false);
+   }
+ }
+ 
+ void
+ CompareManager::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   switch (mState) {
+     case Finished:
+       return;
+     case WaitingForExistingOpen:
+       NS_WARNING("Could not open the existing cache.");
+       break;
+     case WaitingForExistingKeys:
+       NS_WARNING("Could not get the existing URLs.");
+@@ -1361,26 +1362,26 @@ CompareManager::RejectedCallback(JSConte
+   }
+ 
+   Fail(NS_ERROR_FAILURE);
+ }
+ 
+ void
+ CompareManager::Fail(nsresult aStatus)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   mCallback->ComparisonResult(aStatus, false /* aIsEqual */,
+                               EmptyString(), EmptyCString(), mLoadFlags);
+   Cleanup();
+ }
+ 
+ void
+ CompareManager::Cleanup()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (mState != Finished) {
+     mState = Finished;
+ 
+     MOZ_ASSERT(mCallback);
+     mCallback = nullptr;
+ 
+     // Abort and release CompareNetworks.
+@@ -1391,17 +1392,17 @@ CompareManager::Cleanup()
+   }
+ }
+ 
+ } // namespace
+ 
+ nsresult
+ PurgeCache(nsIPrincipal* aPrincipal, const nsAString& aCacheName)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aPrincipal);
+ 
+   if (aCacheName.IsEmpty()) {
+     return NS_OK;
+   }
+ 
+   AutoJSAPI jsapi;
+   jsapi.Init();
+@@ -1449,17 +1450,17 @@ GenerateCacheName(nsAString& aName)
+ }
+ 
+ nsresult
+ Compare(ServiceWorkerRegistrationInfo* aRegistration,
+         nsIPrincipal* aPrincipal, const nsAString& aCacheName,
+         const nsAString& aURL, CompareCallback* aCallback,
+         nsILoadGroup* aLoadGroup)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aRegistration);
+   MOZ_ASSERT(aPrincipal);
+   MOZ_ASSERT(!aURL.IsEmpty());
+   MOZ_ASSERT(aCallback);
+ 
+   RefPtr<CompareManager> cm = new CompareManager(aRegistration, aCallback);
+ 
+   nsresult rv = cm->Initialize(aPrincipal, aURL, aCacheName, aLoadGroup);
+@@ -1467,9 +1468,10 @@ Compare(ServiceWorkerRegistrationInfo* a
+     return rv;
+   }
+ 
+   return NS_OK;
+ }
+ 
+ } // namespace serviceWorkerScriptCache
+ 
+-END_WORKERS_NAMESPACE
++} // namespace dom
++} // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerScriptCache.h b/dom/serviceworkers/ServiceWorkerScriptCache.h
+--- a/dom/serviceworkers/ServiceWorkerScriptCache.h
++++ b/dom/serviceworkers/ServiceWorkerScriptCache.h
+@@ -1,25 +1,24 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_ServiceWorkerScriptCache_h
+-#define mozilla_dom_workers_ServiceWorkerScriptCache_h
++#ifndef mozilla_dom_ServiceWorkerScriptCache_h
++#define mozilla_dom_ServiceWorkerScriptCache_h
+ 
+ #include "nsString.h"
+ 
+ class nsILoadGroup;
+ class nsIPrincipal;
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerRegistrationInfo;
+ 
+ namespace serviceWorkerScriptCache {
+ 
+ nsresult
+ PurgeCache(nsIPrincipal* aPrincipal, const nsAString& aCacheName);
+ 
+@@ -47,13 +46,12 @@ public:
+ 
+ nsresult
+ Compare(ServiceWorkerRegistrationInfo* aRegistration,
+         nsIPrincipal* aPrincipal, const nsAString& aCacheName,
+         const nsAString& aURL, CompareCallback* aCallback, nsILoadGroup* aLoadGroup);
+ 
+ } // namespace serviceWorkerScriptCache
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_ServiceWorkerScriptCache_h
++#endif // mozilla_dom_ServiceWorkerScriptCache_h
+diff --git a/dom/serviceworkers/ServiceWorkerUnregisterJob.cpp b/dom/serviceworkers/ServiceWorkerUnregisterJob.cpp
+--- a/dom/serviceworkers/ServiceWorkerUnregisterJob.cpp
++++ b/dom/serviceworkers/ServiceWorkerUnregisterJob.cpp
+@@ -5,28 +5,27 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerUnregisterJob.h"
+ 
+ #include "nsIPushService.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerUnregisterJob::PushUnsubscribeCallback final :
+         public nsIUnsubscribeResultCallback
+ {
+ public:
+   NS_DECL_ISUPPORTS
+ 
+   explicit PushUnsubscribeCallback(ServiceWorkerUnregisterJob* aJob)
+     : mJob(aJob)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   NS_IMETHOD
+   OnUnsubscribe(nsresult aStatus, bool) override
+   {
+     // Warn if unsubscribing fails, but don't prevent the worker from
+     // unregistering.
+     Unused << NS_WARN_IF(NS_FAILED(aStatus));
+@@ -52,28 +51,28 @@ ServiceWorkerUnregisterJob::ServiceWorke
+   , mResult(false)
+   , mSendToParent(aSendToParent)
+ {
+ }
+ 
+ bool
+ ServiceWorkerUnregisterJob::GetResult() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   return mResult;
+ }
+ 
+ ServiceWorkerUnregisterJob::~ServiceWorkerUnregisterJob()
+ {
+ }
+ 
+ void
+ ServiceWorkerUnregisterJob::AsyncExecute()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   if (Canceled()) {
+     Finish(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+   // Push API, section 5: "When a service worker registration is unregistered,
+   // any associated push subscription must be deactivated." To ensure the
+@@ -92,17 +91,17 @@ ServiceWorkerUnregisterJob::AsyncExecute
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     Unregister();
+   }
+ }
+ 
+ void
+ ServiceWorkerUnregisterJob::Unregister()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (Canceled() || !swm) {
+     Finish(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+   // Step 1 of the Unregister algorithm requires checking that the
+@@ -141,11 +140,10 @@ ServiceWorkerUnregisterJob::Unregister()
+   if (!registration->IsControllingClients() && registration->IsIdle()) {
+     // "Invoke [[Clear Registration]]..."
+     swm->RemoveRegistration(registration);
+   }
+ 
+   Finish(NS_OK);
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerUnregisterJob.h b/dom/serviceworkers/ServiceWorkerUnregisterJob.h
+--- a/dom/serviceworkers/ServiceWorkerUnregisterJob.h
++++ b/dom/serviceworkers/ServiceWorkerUnregisterJob.h
+@@ -1,22 +1,21 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerunregisterjob_h
+-#define mozilla_dom_workers_serviceworkerunregisterjob_h
++#ifndef mozilla_dom_serviceworkerunregisterjob_h
++#define mozilla_dom_serviceworkerunregisterjob_h
+ 
+ #include "ServiceWorkerJob.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerUnregisterJob final : public ServiceWorkerJob
+ {
+ public:
+   ServiceWorkerUnregisterJob(nsIPrincipal* aPrincipal,
+                              const nsACString& aScope,
+                              bool aSendToParent);
+ 
+@@ -33,13 +32,12 @@ private:
+ 
+   void
+   Unregister();
+ 
+   bool mResult;
+   bool mSendToParent;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerunregisterjob_h
++#endif // mozilla_dom_serviceworkerunregisterjob_h
+diff --git a/dom/serviceworkers/ServiceWorkerUpdateJob.cpp b/dom/serviceworkers/ServiceWorkerUpdateJob.cpp
+--- a/dom/serviceworkers/ServiceWorkerUpdateJob.cpp
++++ b/dom/serviceworkers/ServiceWorkerUpdateJob.cpp
+@@ -8,17 +8,16 @@
+ 
+ #include "nsIScriptError.h"
+ #include "nsIURL.h"
+ #include "ServiceWorkerScriptCache.h"
+ #include "Workers.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ namespace {
+ 
+ /**
+  * The spec mandates slightly different behaviors for computing the scope
+  * prefix string in case a Service-Worker-Allowed header is specified versus
+  * when it's not available.
+  *
+@@ -116,58 +115,58 @@ class ServiceWorkerUpdateJob::ContinueUp
+   nsMainThreadPtrHandle<ServiceWorkerUpdateJob> mJob;
+   bool mSuccess;
+ 
+ public:
+   explicit ContinueUpdateRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob>& aJob)
+     : mJob(aJob)
+     , mSuccess(false)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   SetResult(bool aResult) override
+   {
+     mSuccess = aResult;
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mJob->ContinueUpdateAfterScriptEval(mSuccess);
+     mJob = nullptr;
+     return NS_OK;
+   }
+ };
+ 
+ class ServiceWorkerUpdateJob::ContinueInstallRunnable final : public LifeCycleEventCallback
+ {
+   nsMainThreadPtrHandle<ServiceWorkerUpdateJob> mJob;
+   bool mSuccess;
+ 
+ public:
+   explicit ContinueInstallRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob>& aJob)
+     : mJob(aJob)
+     , mSuccess(false)
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+   }
+ 
+   void
+   SetResult(bool aResult) override
+   {
+     mSuccess = aResult;
+   }
+ 
+   NS_IMETHOD
+   Run() override
+   {
+-    AssertIsOnMainThread();
++    MOZ_ASSERT(NS_IsMainThread());
+     mJob->ContinueAfterInstallEvent(mSuccess);
+     mJob = nullptr;
+     return NS_OK;
+   }
+ };
+ 
+ ServiceWorkerUpdateJob::ServiceWorkerUpdateJob(
+     nsIPrincipal* aPrincipal,
+@@ -179,17 +178,17 @@ ServiceWorkerUpdateJob::ServiceWorkerUpd
+   , mLoadGroup(aLoadGroup)
+   , mUpdateViaCache(aUpdateViaCache)
+ {
+ }
+ 
+ already_AddRefed<ServiceWorkerRegistrationInfo>
+ ServiceWorkerUpdateJob::GetRegistration() const
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   RefPtr<ServiceWorkerRegistrationInfo> ref = mRegistration;
+   return ref.forget();
+ }
+ 
+ ServiceWorkerUpdateJob::ServiceWorkerUpdateJob(
+     Type aType,
+     nsIPrincipal* aPrincipal,
+     const nsACString& aScope,
+@@ -204,17 +203,17 @@ ServiceWorkerUpdateJob::ServiceWorkerUpd
+ 
+ ServiceWorkerUpdateJob::~ServiceWorkerUpdateJob()
+ {
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::FailUpdateJob(ErrorResult& aRv)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aRv.Failed());
+ 
+   // Cleanup after a failed installation.  This essentially implements
+   // step 12 of the Install algorithm.
+   //
+   //  https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#installation-algorithm
+   //
+   // The spec currently only runs this after an install event fails,
+@@ -240,17 +239,17 @@ ServiceWorkerUpdateJob::FailUpdateJob(ns
+ {
+   ErrorResult rv(aRv);
+   FailUpdateJob(rv);
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::AsyncExecute()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(GetType() == Type::Update);
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (Canceled() || !swm) {
+     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+@@ -283,27 +282,27 @@ ServiceWorkerUpdateJob::AsyncExecute()
+ 
+   SetRegistration(registration);
+   Update();
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::SetRegistration(ServiceWorkerRegistrationInfo* aRegistration)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   MOZ_ASSERT(!mRegistration);
+   MOZ_ASSERT(aRegistration);
+   mRegistration = aRegistration;
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::Update()
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(!Canceled());
+ 
+   // SetRegistration() must be called before Update().
+   MOZ_ASSERT(mRegistration);
+   MOZ_ASSERT(!mRegistration->GetInstalling());
+ 
+   // Begin the script download and comparison steps starting at step 5
+   // of the Update algorithm.
+@@ -337,17 +336,17 @@ ServiceWorkerUpdateJob::GetUpdateViaCach
+ 
+ void
+ ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
+                                          bool aInCacheAndEqual,
+                                          const nsAString& aNewCacheName,
+                                          const nsACString& aMaxScope,
+                                          nsLoadFlags aLoadFlags)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (NS_WARN_IF(Canceled() || !swm)) {
+     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+   // Handle failure of the download or comparison.  This is part of Update
+@@ -456,17 +455,17 @@ ServiceWorkerUpdateJob::ComparisonResult
+     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::ContinueUpdateAfterScriptEval(bool aScriptEvaluationResult)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+ 
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (Canceled() || !swm) {
+     FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
+     return;
+   }
+ 
+   // Step 7.5 of the Update algorithm verifying that the script evaluated
+@@ -483,17 +482,17 @@ ServiceWorkerUpdateJob::ContinueUpdateAf
+   }
+ 
+   Install(swm);
+ }
+ 
+ void
+ ServiceWorkerUpdateJob::Install(ServiceWorkerManager* aSWM)
+ {
+-  AssertIsOnMainThread();
++  MOZ_ASSERT(NS_IsMainThread());
+   MOZ_DIAGNOSTIC_ASSERT(!Canceled());
+   MOZ_DIAGNOSTIC_ASSERT(aSWM);
+ 
+   MOZ_ASSERT(!mRegistration->GetInstalling());
+ 
+   // Begin step 2 of the Install algorithm.
+   //
+   //  https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#installation-algorithm
+@@ -504,27 +503,27 @@ ServiceWorkerUpdateJob::Install(ServiceW
+   InvokeResultCallbacks(NS_OK);
+ 
+   // The job promise cannot be rejected after this point, but the job can
+   // still fail; e.g. if the install event handler throws, etc.
+ 
+   // fire the updatefound event
+   nsCOMPtr<nsIRunnable> upr =
+     NewRunnableMethod<RefPtr<ServiceWorkerRegistrationInfo>>(
+-      "dom::workers::ServiceWorkerManager::"
++      "dom::ServiceWorkerManager::"
+       "FireUpdateFoundOnServiceWorkerRegistrations",
+       aSWM,
+       &ServiceWorkerManager::FireUpdateFoundOnServiceWorkerRegistrations,
+       mRegistration);
+   NS_DispatchToMainThread(upr);
+ 
+   // Call ContinueAfterInstallEvent(false) on main thread if the SW
+   // script fails to load.
+   nsCOMPtr<nsIRunnable> failRunnable = NewRunnableMethod<bool>(
+-    "dom::workers::ServiceWorkerUpdateJob::ContinueAfterInstallEvent",
++    "dom::ServiceWorkerUpdateJob::ContinueAfterInstallEvent",
+     this,
+     &ServiceWorkerUpdateJob::ContinueAfterInstallEvent,
+     false);
+ 
+   nsMainThreadPtrHandle<ServiceWorkerUpdateJob> handle(
+     new nsMainThreadPtrHolder<ServiceWorkerUpdateJob>(
+       "ServiceWorkerUpdateJob", this));
+   RefPtr<LifeCycleEventCallback> callback = new ContinueInstallRunnable(handle);
+@@ -573,11 +572,10 @@ ServiceWorkerUpdateJob::ContinueAfterIns
+   // flushed from the queue before proceeding.
+ 
+   // Step 22 of the Install algorithm.  Activate is executed after the completion
+   // of this job.  The controlling client and skipWaiting checks are performed
+   // in TryToActivate().
+   mRegistration->TryToActivateAsync();
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerUpdateJob.h b/dom/serviceworkers/ServiceWorkerUpdateJob.h
+--- a/dom/serviceworkers/ServiceWorkerUpdateJob.h
++++ b/dom/serviceworkers/ServiceWorkerUpdateJob.h
+@@ -1,23 +1,22 @@
+ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+-#ifndef mozilla_dom_workers_serviceworkerupdatejob_h
+-#define mozilla_dom_workers_serviceworkerupdatejob_h
++#ifndef mozilla_dom_serviceworkerupdatejob_h
++#define mozilla_dom_serviceworkerupdatejob_h
+ 
+ #include "ServiceWorkerJob.h"
+ #include "ServiceWorkerRegistration.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerManager;
+ 
+ // A job class that performs the Update and Install algorithms from the
+ // service worker spec.  This class is designed to be inherited and customized
+ // as a different job type.  This is necessary because the register job
+ // performs largely the same operations as the update job, but has a few
+ // different starting steps.
+@@ -101,13 +100,12 @@ private:
+   ContinueAfterInstallEvent(bool aInstallEventSuccess);
+ 
+   nsCOMPtr<nsILoadGroup> mLoadGroup;
+   ServiceWorkerUpdateViaCache mUpdateViaCache;
+ 
+   RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+-#endif // mozilla_dom_workers_serviceworkerupdatejob_h
++#endif // mozilla_dom_serviceworkerupdatejob_h
+diff --git a/dom/serviceworkers/ServiceWorkerUpdaterChild.cpp b/dom/serviceworkers/ServiceWorkerUpdaterChild.cpp
+--- a/dom/serviceworkers/ServiceWorkerUpdaterChild.cpp
++++ b/dom/serviceworkers/ServiceWorkerUpdaterChild.cpp
+@@ -4,17 +4,16 @@
+  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerUpdaterChild.h"
+ #include "nsThreadUtils.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ ServiceWorkerUpdaterChild::ServiceWorkerUpdaterChild(GenericPromise* aPromise,
+                                                      CancelableRunnable* aSuccessRunnable,
+                                                      CancelableRunnable* aFailureRunnable)
+   : mSuccessRunnable(aSuccessRunnable)
+   , mFailureRunnable(aFailureRunnable)
+ {
+   // TODO: remove the main thread restriction after fixing bug 1364821.
+@@ -59,11 +58,10 @@ ServiceWorkerUpdaterChild::ActorDestroy(
+ 
+   if (mFailureRunnable) {
+     mFailureRunnable->Cancel();
+   }
+ 
+   mPromiseHolder.DisconnectIfExists();
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerUpdaterChild.h b/dom/serviceworkers/ServiceWorkerUpdaterChild.h
+--- a/dom/serviceworkers/ServiceWorkerUpdaterChild.h
++++ b/dom/serviceworkers/ServiceWorkerUpdaterChild.h
+@@ -8,17 +8,16 @@
+ #define mozilla_dom_ServiceWorkerUpdaterChild_h
+ 
+ #include "mozilla/dom/PServiceWorkerUpdaterChild.h"
+ #include "mozilla/BasePrincipal.h"
+ #include "mozilla/MozPromise.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerUpdaterChild final : public PServiceWorkerUpdaterChild
+ {
+ public:
+   ServiceWorkerUpdaterChild(GenericPromise* aPromise,
+                             CancelableRunnable* aSuccessRunnable,
+                             CancelableRunnable* aFailureRunnable);
+ 
+@@ -30,13 +29,12 @@ private:
+   ActorDestroy(ActorDestroyReason aWhy) override;
+ 
+   MozPromiseRequestHolder<GenericPromise> mPromiseHolder;
+ 
+   RefPtr<CancelableRunnable> mSuccessRunnable;
+   RefPtr<CancelableRunnable> mFailureRunnable;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_ServiceWorkerUpdaterChild_h
+diff --git a/dom/serviceworkers/ServiceWorkerUpdaterParent.cpp b/dom/serviceworkers/ServiceWorkerUpdaterParent.cpp
+--- a/dom/serviceworkers/ServiceWorkerUpdaterParent.cpp
++++ b/dom/serviceworkers/ServiceWorkerUpdaterParent.cpp
+@@ -4,17 +4,16 @@
+  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "ServiceWorkerUpdaterParent.h"
+ #include "ServiceWorkerManagerService.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ bool
+ ServiceWorkerUpdaterParent::Proceed(ServiceWorkerManagerService* aService)
+ {
+   if (!SendProceed(true)) {
+     return false;
+   }
+ 
+@@ -25,11 +24,10 @@ ServiceWorkerUpdaterParent::Proceed(Serv
+ void
+ ServiceWorkerUpdaterParent::ActorDestroy(ActorDestroyReason aWhy)
+ {
+   if (mService) {
+     mService->UpdaterActorDestroyed(this);
+   }
+ }
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerUpdaterParent.h b/dom/serviceworkers/ServiceWorkerUpdaterParent.h
+--- a/dom/serviceworkers/ServiceWorkerUpdaterParent.h
++++ b/dom/serviceworkers/ServiceWorkerUpdaterParent.h
+@@ -7,30 +7,28 @@
+ #ifndef mozilla_dom_ServiceWorkerUpdaterParent_h
+ #define mozilla_dom_ServiceWorkerUpdaterParent_h
+ 
+ #include "mozilla/dom/PServiceWorkerUpdaterParent.h"
+ #include "mozilla/BasePrincipal.h"
+ 
+ namespace mozilla {
+ namespace dom {
+-namespace workers {
+ 
+ class ServiceWorkerManagerService;
+ 
+ class ServiceWorkerUpdaterParent final : public PServiceWorkerUpdaterParent
+ {
+ public:
+   void
+   ActorDestroy(ActorDestroyReason aWhy) override;
+ 
+   bool
+   Proceed(ServiceWorkerManagerService* aService);
+ 
+ private:
+   RefPtr<ServiceWorkerManagerService> mService;
+ };
+ 
+-} // namespace workers
+ } // namespace dom
+ } // namespace mozilla
+ 
+ #endif // mozilla_dom_ServiceWorkerUpdaterParent_h
+diff --git a/dom/serviceworkers/moz.build b/dom/serviceworkers/moz.build
+--- a/dom/serviceworkers/moz.build
++++ b/dom/serviceworkers/moz.build
+@@ -4,38 +4,31 @@
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ with Files("**"):
+     BUG_COMPONENT = ("Core", "DOM: Service Workers")
+ 
+ # Public stuff.
+ EXPORTS.mozilla.dom += [
++    'ServiceWorker.h',
+     'ServiceWorkerCommon.h',
+     'ServiceWorkerContainer.h',
+     'ServiceWorkerDescriptor.h',
+     'ServiceWorkerEvents.h',
++    'ServiceWorkerInfo.h',
+     'ServiceWorkerInterceptController.h',
+     'ServiceWorkerIPCUtils.h',
+-    'ServiceWorkerRegistrar.h',
+-    'ServiceWorkerRegistration.h',
+-    'ServiceWorkerUtils.h',
+-]
+-
+-EXPORTS.mozilla.dom.workers += [
+-    'ServiceWorkerInfo.h',
+     'ServiceWorkerManager.h',
+     'ServiceWorkerManagerChild.h',
+     'ServiceWorkerManagerParent.h',
++    'ServiceWorkerRegistrar.h',
++    'ServiceWorkerRegistration.h',
+     'ServiceWorkerRegistrationInfo.h',
+-]
+-
+-# Stuff needed for the bindings, not really public though.
+-EXPORTS.mozilla.dom.workers.bindings += [
+-    'ServiceWorker.h',
++    'ServiceWorkerUtils.h',
+ ]
+ 
+ UNIFIED_SOURCES += [
+     'ServiceWorker.cpp',
+     'ServiceWorkerContainer.cpp',
+     'ServiceWorkerDescriptor.cpp',
+     'ServiceWorkerEvents.cpp',
+     'ServiceWorkerInfo.cpp',
+diff --git a/dom/webidl/FetchEvent.webidl b/dom/webidl/FetchEvent.webidl
+--- a/dom/webidl/FetchEvent.webidl
++++ b/dom/webidl/FetchEvent.webidl
+@@ -3,17 +3,17 @@
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  *
+  * For more information on this interface, please see
+  * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
+  */
+ 
+ [Constructor(DOMString type, FetchEventInit eventInitDict),
+- Func="mozilla::dom::workers::ServiceWorkerVisible",
++ Func="ServiceWorkerVisible",
+  Exposed=(ServiceWorker)]
+ interface FetchEvent : ExtendableEvent {
+   [SameObject] readonly attribute Request request;
+   readonly attribute DOMString? clientId;
+   readonly attribute boolean isReload;
+ 
+   [Throws]
+   void respondWith(Promise<Response> r);
+diff --git a/dom/webidl/ServiceWorker.webidl b/dom/webidl/ServiceWorker.webidl
+--- a/dom/webidl/ServiceWorker.webidl
++++ b/dom/webidl/ServiceWorker.webidl
+@@ -5,17 +5,17 @@
+  *
+  * The origin of this IDL file is
+  * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-obj
+  *
+  */
+ 
+ // Still unclear what should be subclassed.
+ // https://github.com/slightlyoff/ServiceWorker/issues/189
+-[Func="mozilla::dom::workers::ServiceWorkerVisible",
++[Func="ServiceWorkerVisible",
+  // FIXME(nsm): Bug 1113522. This is exposed to satisfy webidl constraints, but it won't actually work.
+  Exposed=(Window,Worker)]
+ interface ServiceWorker : EventTarget {
+   readonly attribute USVString scriptURL;
+   readonly attribute ServiceWorkerState state;
+ 
+   attribute EventHandler onstatechange;
+ 
+diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
+--- a/dom/workers/WorkerPrivate.cpp
++++ b/dom/workers/WorkerPrivate.cpp
+@@ -107,17 +107,17 @@
+ #include "nsThreadManager.h"
+ #endif
+ 
+ #include "Navigator.h"
+ #include "Principal.h"
+ #include "RuntimeService.h"
+ #include "ScriptLoader.h"
+ #include "mozilla/dom/ServiceWorkerEvents.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "SharedWorker.h"
+ #include "WorkerDebuggerManager.h"
+ #include "WorkerHolder.h"
+ #include "WorkerNavigator.h"
+ #include "WorkerRunnable.h"
+ #include "WorkerScope.h"
+ #include "WorkerThread.h"
+ 
+diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp
+--- a/dom/workers/WorkerScope.cpp
++++ b/dom/workers/WorkerScope.cpp
+@@ -41,18 +41,18 @@
+ #endif
+ 
+ #include "Crypto.h"
+ #include "Principal.h"
+ #include "RuntimeService.h"
+ #include "ScriptLoader.h"
+ #include "WorkerPrivate.h"
+ #include "WorkerRunnable.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/dom/ServiceWorkerRegistration.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ 
+ #ifdef XP_WIN
+ #undef PostMessage
+ #endif
+ 
+ extern already_AddRefed<nsIScriptTimeoutHandler>
+ NS_CreateJSTimeoutHandler(JSContext* aCx,
+                           mozilla::dom::workers::WorkerPrivate* aWorkerPrivate,
+diff --git a/image/ImageCacheKey.cpp b/image/ImageCacheKey.cpp
+--- a/image/ImageCacheKey.cpp
++++ b/image/ImageCacheKey.cpp
+@@ -6,17 +6,17 @@
+ #include "ImageCacheKey.h"
+ 
+ #include "mozilla/Move.h"
+ #include "ImageURL.h"
+ #include "nsHostObjectProtocolHandler.h"
+ #include "nsLayoutUtils.h"
+ #include "nsString.h"
+ #include "mozilla/dom/File.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "nsIDocument.h"
+ #include "nsPrintfCString.h"
+ 
+ namespace mozilla {
+ 
+ using namespace dom;
+ 
+ namespace image {
+@@ -159,17 +159,16 @@ ImageCacheKey::ComputeHash(ImageURL* aUR
+ 
+ /* static */ void*
+ ImageCacheKey::GetControlledDocumentToken(nsIDocument* aDocument)
+ {
+   // For non-controlled documents, we just return null.  For controlled
+   // documents, we cast the pointer into a void* to avoid dereferencing
+   // it (since we only use it for comparisons), and return it.
+   void* pointer = nullptr;
+-  using dom::workers::ServiceWorkerManager;
+   RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+   if (aDocument && swm) {
+     ErrorResult rv;
+     if (aDocument->GetController().isSome()) {
+       pointer = aDocument;
+     }
+   }
+   return pointer;
+diff --git a/ipc/glue/BackgroundChildImpl.cpp b/ipc/glue/BackgroundChildImpl.cpp
+--- a/ipc/glue/BackgroundChildImpl.cpp
++++ b/ipc/glue/BackgroundChildImpl.cpp
+@@ -26,19 +26,19 @@
+ #include "mozilla/dom/ipc/PendingIPCBlobChild.h"
+ #include "mozilla/dom/ipc/TemporaryIPCBlobChild.h"
+ #include "mozilla/dom/quota/PQuotaChild.h"
+ #include "mozilla/dom/StorageIPC.h"
+ #include "mozilla/dom/GamepadEventChannelChild.h"
+ #include "mozilla/dom/GamepadTestChannelChild.h"
+ #include "mozilla/dom/LocalStorage.h"
+ #include "mozilla/dom/MessagePortChild.h"
++#include "mozilla/dom/ServiceWorkerManagerChild.h"
+ #include "mozilla/dom/TabChild.h"
+ #include "mozilla/dom/TabGroup.h"
+-#include "mozilla/dom/workers/ServiceWorkerManagerChild.h"
+ #include "mozilla/ipc/IPCStreamAlloc.h"
+ #include "mozilla/ipc/PBackgroundTestChild.h"
+ #include "mozilla/ipc/PChildToParentStreamChild.h"
+ #include "mozilla/ipc/PParentToChildStreamChild.h"
+ #include "mozilla/layout/VsyncChild.h"
+ #include "mozilla/net/HttpBackgroundChannelChild.h"
+ #include "mozilla/net/PUDPSocketChild.h"
+ #include "mozilla/dom/network/UDPSocketChild.h"
+@@ -379,27 +379,27 @@ BackgroundChildImpl::DeallocPCamerasChil
+ 
+ // -----------------------------------------------------------------------------
+ // ServiceWorkerManager
+ // -----------------------------------------------------------------------------
+ 
+ dom::PServiceWorkerManagerChild*
+ BackgroundChildImpl::AllocPServiceWorkerManagerChild()
+ {
+-  RefPtr<dom::workers::ServiceWorkerManagerChild> agent =
+-    new dom::workers::ServiceWorkerManagerChild();
++  RefPtr<dom::ServiceWorkerManagerChild> agent =
++    new dom::ServiceWorkerManagerChild();
+   return agent.forget().take();
+ }
+ 
+ bool
+ BackgroundChildImpl::DeallocPServiceWorkerManagerChild(
+                                              PServiceWorkerManagerChild* aActor)
+ {
+-  RefPtr<dom::workers::ServiceWorkerManagerChild> child =
+-    dont_AddRef(static_cast<dom::workers::ServiceWorkerManagerChild*>(aActor));
++  RefPtr<dom::ServiceWorkerManagerChild> child =
++    dont_AddRef(static_cast<dom::ServiceWorkerManagerChild*>(aActor));
+   MOZ_ASSERT(child);
+   return true;
+ }
+ 
+ // -----------------------------------------------------------------------------
+ // Cache API
+ // -----------------------------------------------------------------------------
+ 
+diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp
+--- a/ipc/glue/BackgroundParentImpl.cpp
++++ b/ipc/glue/BackgroundParentImpl.cpp
+@@ -18,26 +18,26 @@
+ #include "mozilla/dom/DOMTypes.h"
+ #include "mozilla/dom/FileSystemBase.h"
+ #include "mozilla/dom/FileSystemRequestParent.h"
+ #include "mozilla/dom/GamepadEventChannelParent.h"
+ #include "mozilla/dom/GamepadTestChannelParent.h"
+ #include "mozilla/dom/PGamepadEventChannelParent.h"
+ #include "mozilla/dom/PGamepadTestChannelParent.h"
+ #include "mozilla/dom/MessagePortParent.h"
++#include "mozilla/dom/ServiceWorkerManagerParent.h"
+ #include "mozilla/dom/ServiceWorkerRegistrar.h"
+ #include "mozilla/dom/asmjscache/AsmJSCache.h"
+ #include "mozilla/dom/cache/ActorUtils.h"
+ #include "mozilla/dom/indexedDB/ActorsParent.h"
+ #include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
+ #include "mozilla/dom/ipc/PendingIPCBlobParent.h"
+ #include "mozilla/dom/ipc/TemporaryIPCBlobParent.h"
+ #include "mozilla/dom/quota/ActorsParent.h"
+ #include "mozilla/dom/StorageIPC.h"
+-#include "mozilla/dom/workers/ServiceWorkerManagerParent.h"
+ #include "mozilla/ipc/BackgroundParent.h"
+ #include "mozilla/ipc/BackgroundUtils.h"
+ #include "mozilla/ipc/IPCStreamAlloc.h"
+ #include "mozilla/ipc/PBackgroundSharedTypes.h"
+ #include "mozilla/ipc/PBackgroundTestParent.h"
+ #include "mozilla/ipc/PChildToParentStreamParent.h"
+ #include "mozilla/ipc/PParentToChildStreamParent.h"
+ #include "mozilla/layout/VsyncParent.h"
+@@ -102,17 +102,16 @@ public:
+ } // namespace
+ 
+ namespace mozilla {
+ namespace ipc {
+ 
+ using mozilla::dom::ContentParent;
+ using mozilla::dom::BroadcastChannelParent;
+ using mozilla::dom::ServiceWorkerRegistrationData;
+-using mozilla::dom::workers::ServiceWorkerManagerParent;
+ 
+ BackgroundParentImpl::BackgroundParentImpl()
+ {
+   AssertIsInMainProcess();
+   AssertIsOnMainThread();
+ 
+   MOZ_COUNT_CTOR(mozilla::ipc::BackgroundParentImpl);
+ }
+@@ -654,31 +653,31 @@ BackgroundParentImpl::DeallocPBroadcastC
+ }
+ 
+ mozilla::dom::PServiceWorkerManagerParent*
+ BackgroundParentImpl::AllocPServiceWorkerManagerParent()
+ {
+   AssertIsInMainProcess();
+   AssertIsOnBackgroundThread();
+ 
+-  RefPtr<dom::workers::ServiceWorkerManagerParent> agent =
+-    new dom::workers::ServiceWorkerManagerParent();
++  RefPtr<dom::ServiceWorkerManagerParent> agent =
++    new dom::ServiceWorkerManagerParent();
+   return agent.forget().take();
+ }
+ 
+ bool
+ BackgroundParentImpl::DeallocPServiceWorkerManagerParent(
+                                             PServiceWorkerManagerParent* aActor)
+ {
+   AssertIsInMainProcess();
+   AssertIsOnBackgroundThread();
+   MOZ_ASSERT(aActor);
+ 
+-  RefPtr<dom::workers::ServiceWorkerManagerParent> parent =
+-    dont_AddRef(static_cast<dom::workers::ServiceWorkerManagerParent*>(aActor));
++  RefPtr<dom::ServiceWorkerManagerParent> parent =
++    dont_AddRef(static_cast<dom::ServiceWorkerManagerParent*>(aActor));
+   MOZ_ASSERT(parent);
+   return true;
+ }
+ 
+ mozilla::ipc::IPCResult
+ BackgroundParentImpl::RecvShutdownServiceWorkerRegistrar()
+ {
+   AssertIsInMainProcess();
+diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
+--- a/layout/build/nsLayoutModule.cpp
++++ b/layout/build/nsLayoutModule.cpp
+@@ -78,18 +78,18 @@
+ #include "nsJSON.h"
+ #include "nsZipArchive.h"
+ #include "mozilla/Attributes.h"
+ #include "mozilla/dom/DOMException.h"
+ #include "mozilla/dom/DOMRequest.h"
+ #include "mozilla/dom/LocalStorageManager.h"
+ #include "mozilla/dom/network/UDPSocketChild.h"
+ #include "mozilla/dom/quota/QuotaManagerService.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/dom/SessionStorageManager.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
+ #include "mozilla/dom/workers/WorkerDebuggerManager.h"
+ #include "mozilla/dom/Notification.h"
+ #include "mozilla/OSFileConstants.h"
+ #include "mozilla/Services.h"
+ 
+ #ifdef MOZ_WEBSPEECH_TEST_BACKEND
+ #include "mozilla/dom/FakeSpeechRecognitionService.h"
+ #endif
+@@ -169,17 +169,16 @@ static void Shutdown();
+ #include "nsScriptError.h"
+ 
+ #include "mozilla/TextInputProcessor.h"
+ 
+ using namespace mozilla;
+ using namespace mozilla::dom;
+ using mozilla::dom::power::PowerManagerService;
+ using mozilla::dom::quota::QuotaManagerService;
+-using mozilla::dom::workers::ServiceWorkerManager;
+ using mozilla::dom::workers::WorkerDebuggerManager;
+ using mozilla::dom::UDPSocketChild;
+ using mozilla::gmp::GeckoMediaPluginService;
+ 
+ #define NS_EDITORCOMMANDTABLE_CID \
+ { 0x4f5e62b8, 0xd659, 0x4156, \
+   { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 } }
+ 
+diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp
+--- a/netwerk/ipc/NeckoParent.cpp
++++ b/netwerk/ipc/NeckoParent.cpp
+@@ -30,17 +30,17 @@
+ #endif
+ #include "mozilla/dom/ChromeUtils.h"
+ #include "mozilla/dom/ContentParent.h"
+ #include "mozilla/dom/TabContext.h"
+ #include "mozilla/dom/TabParent.h"
+ #include "mozilla/dom/network/TCPSocketParent.h"
+ #include "mozilla/dom/network/TCPServerSocketParent.h"
+ #include "mozilla/dom/network/UDPSocketParent.h"
+-#include "mozilla/dom/workers/ServiceWorkerManager.h"
++#include "mozilla/dom/ServiceWorkerManager.h"
+ #include "mozilla/LoadContext.h"
+ #include "mozilla/MozPromise.h"
+ #include "nsPrintfCString.h"
+ #include "nsHTMLDNSPrefetch.h"
+ #include "nsEscape.h"
+ #include "SerializedLoadContext.h"
+ #include "nsAuthInformationHolder.h"
+ #include "nsIAuthPromptCallback.h"
+@@ -48,25 +48,25 @@
+ #include "nsINetworkPredictor.h"
+ #include "nsINetworkPredictorVerifier.h"
+ #include "nsISpeculativeConnect.h"
+ #include "nsNetUtil.h"
+ 
+ using mozilla::OriginAttributes;
+ using mozilla::dom::ChromeUtils;
+ using mozilla::dom::ContentParent;
++using mozilla::dom::ServiceWorkerManager;
+ using mozilla::dom::TabContext;
+ using mozilla::dom::TabParent;
+ using mozilla::net::PTCPSocketParent;
+ using mozilla::dom::TCPSocketParent;
+ using mozilla::net::PTCPServerSocketParent;
+ using mozilla::dom::TCPServerSocketParent;
+ using mozilla::net::PUDPSocketParent;
+ using mozilla::dom::UDPSocketParent;
+-using mozilla::dom::workers::ServiceWorkerManager;
+ using mozilla::ipc::AutoIPCStream;
+ using mozilla::ipc::OptionalPrincipalInfo;
+ using mozilla::ipc::PrincipalInfo;
+ using mozilla::ipc::LoadInfoArgsToLoadInfo;
+ using IPC::SerializedLoadContext;
+ 
+ namespace mozilla {
+ namespace net {

+ 1693 - 0
mozilla-release/patches/1430139-4-60a1.patch

@@ -0,0 +1,1693 @@
+# HG changeset patch
+# User Ben Kelly <ben@wanderview.com>
+# Date 1517000939 28800
+# Node ID c8f0fb23b6e4156eb684e39456b4ab2e2dd830f2
+# Parent  018285a507a4f64c823f06e181084733b6bb5399
+Bug 1430139 P4 Fix mochitest paths for new dom/serviceworkers location. r=asuth
+
+diff --git a/dom/serviceworkers/test/browser_devtools_serviceworker_interception.js b/dom/serviceworkers/test/browser_devtools_serviceworker_interception.js
+--- a/dom/serviceworkers/test/browser_devtools_serviceworker_interception.js
++++ b/dom/serviceworkers/test/browser_devtools_serviceworker_interception.js
+@@ -1,17 +1,17 @@
+ "use strict";
+ 
+ const BASE_URI =
+-  "http://mochi.test:8888/browser/dom/workers/test/serviceworkers/";
++  "http://mochi.test:8888/browser/dom/serviceworkers/test/";
+ const emptyDoc = BASE_URI + "empty.html";
+ const fakeDoc = BASE_URI + "fake.html";
+ const helloDoc = BASE_URI + "hello.html";
+ 
+-const CROSS_URI = "http://example.com/browser/dom/workers/test/serviceworkers/";
++const CROSS_URI = "http://example.com/browser/dom/serviceworkers/test/";
+ const crossRedirect = CROSS_URI + "redirect";
+ const crossHelloDoc = CROSS_URI + "hello.html";
+ 
+ const sw = BASE_URI + "fetch.js";
+ 
+ // XXXtt: We should be able to move this check to chrome process after we move
+ // the interception logic to chrome process.
+ async function checkObserverInContent(aInput) {
+diff --git a/dom/serviceworkers/test/browser_storage_permission.js b/dom/serviceworkers/test/browser_storage_permission.js
+--- a/dom/serviceworkers/test/browser_storage_permission.js
++++ b/dom/serviceworkers/test/browser_storage_permission.js
+@@ -1,13 +1,13 @@
+ "use strict";
+ 
+ const { interfaces: Ci } = Components;
+ 
+-const BASE_URI = "http://mochi.test:8888/browser/dom/workers/test/serviceworkers/";
++const BASE_URI = "http://mochi.test:8888/browser/dom/serviceworkers/test/";
+ const PAGE_URI = BASE_URI + "empty.html";
+ const SCOPE = PAGE_URI + "?storage_permission";
+ const SW_SCRIPT = BASE_URI + "empty.js";
+ 
+ 
+ add_task(async function setup() {
+   await SpecialPowers.pushPrefEnv({"set": [
+     // Until the e10s refactor is complete, use a single process to avoid
+diff --git a/dom/serviceworkers/test/browser_unregister_with_containers.js b/dom/serviceworkers/test/browser_unregister_with_containers.js
+--- a/dom/serviceworkers/test/browser_unregister_with_containers.js
++++ b/dom/serviceworkers/test/browser_unregister_with_containers.js
+@@ -1,13 +1,13 @@
+ "use strict";
+ 
+ const { interfaces: Ci } = Components;
+ 
+-const BASE_URI = "http://mochi.test:8888/browser/dom/workers/test/serviceworkers/";
++const BASE_URI = "http://mochi.test:8888/browser/dom/serviceworkers/test/";
+ const PAGE_URI = BASE_URI + "empty.html";
+ const SCOPE = PAGE_URI + "?unregister_with_containers";
+ const SW_SCRIPT = BASE_URI + "empty.js";
+ 
+ function doRegister(browser) {
+   return ContentTask.spawn(browser, { script: SW_SCRIPT, scope: SCOPE },
+     async function(opts) {
+       let reg = await content.navigator.serviceWorker.register(opts.script,
+diff --git a/dom/serviceworkers/test/browser_userContextId_openWindow.js b/dom/serviceworkers/test/browser_userContextId_openWindow.js
+--- a/dom/serviceworkers/test/browser_userContextId_openWindow.js
++++ b/dom/serviceworkers/test/browser_userContextId_openWindow.js
+@@ -1,14 +1,14 @@
+ let { classes: Cc, interfaces: Ci, manager: Cm, results: Cr } = Components;
+ 
+ let swm = Cc["@mozilla.org/serviceworkers/manager;1"].
+           getService(Ci.nsIServiceWorkerManager);
+ 
+-const URI = "https://example.com/browser/dom/workers/test/serviceworkers/empty.html";
++const URI = "https://example.com/browser/dom/serviceworkers/test/empty.html";
+ const MOCK_CID = Components.ID("{2a0f83c4-8818-4914-a184-f1172b4eaaa7}");
+ const ALERTS_SERVICE_CONTRACT_ID = "@mozilla.org/alerts-service;1";
+ const USER_CONTEXT_ID = 3
+ 
+ let mockAlertsService = {
+   showAlert: function(alert, alertListener) {
+     ok(true, "Showing alert");
+     setTimeout(function () {
+diff --git a/dom/serviceworkers/test/chrome_helpers.js b/dom/serviceworkers/test/chrome_helpers.js
+--- a/dom/serviceworkers/test/chrome_helpers.js
++++ b/dom/serviceworkers/test/chrome_helpers.js
+@@ -1,12 +1,12 @@
+ let swm = Cc["@mozilla.org/serviceworkers/manager;1"].
+           getService(Ci.nsIServiceWorkerManager);
+ 
+-let EXAMPLE_URL = "https://example.com/chrome/dom/workers/test/serviceworkers/";
++let EXAMPLE_URL = "https://example.com/chrome/dom/serviceworkers/test/";
+ 
+ function waitForIframeLoad(iframe) {
+   return new Promise(function (resolve) {
+     iframe.onload = resolve;
+   });
+ }
+ 
+ function waitForRegister(scope, callback) {
+diff --git a/dom/serviceworkers/test/controller/index.html b/dom/serviceworkers/test/controller/index.html
+--- a/dom/serviceworkers/test/controller/index.html
++++ b/dom/serviceworkers/test/controller/index.html
+@@ -20,17 +20,17 @@
+     parent.postMessage({status: "ok", result: result, message: msg}, "*");
+   }
+ 
+   function finish() {
+     parent.postMessage({status: "done"}, "*");
+   }
+ 
+   navigator.serviceWorker.ready.then(function(swr) {
+-    my_ok(swr.scope.match(/serviceworkers\/control$/),
++    my_ok(swr.scope.match(/serviceworkers\/test\/control$/),
+           "This page should be controlled by upper level registration");
+     my_ok(swr.installing == undefined,
+           "Upper level registration should not have a installing worker.");
+     if (navigator.serviceWorker.controller) {
+       // We are controlled.
+       // Register a new worker for this sub-scope. After that, controller should still be for upper level, but active should change to be this scope's.
+       navigator.serviceWorker.register("../worker2.js", { scope: "./" }).then(function(e) {
+         my_ok("installing" in e, "ServiceWorkerRegistration.installing exists.");
+@@ -39,17 +39,17 @@
+         my_ok("waiting" in e, "ServiceWorkerRegistration.waiting exists.");
+         my_ok("active" in e, "ServiceWorkerRegistration.active exists.");
+ 
+         my_ok(e.installing &&
+               e.installing.scriptURL.match(/worker2.js$/),
+               "Installing is serviceworker/controller");
+ 
+         my_ok("scope" in e, "ServiceWorkerRegistration.scope exists.");
+-        my_ok(e.scope.match(/serviceworkers\/controller\/$/), "Scope is serviceworker/controller " + e.scope);
++        my_ok(e.scope.match(/serviceworkers\/test\/controller\/$/), "Scope is serviceworker/test/controller " + e.scope);
+ 
+         my_ok("unregister" in e, "ServiceWorkerRegistration.unregister exists.");
+ 
+         my_ok(navigator.serviceWorker.controller.scriptURL.match(/worker\.js$/),
+               "Controller is still worker.js");
+ 
+         e.unregister().then(function(result) {
+           my_ok(result, "Unregistering the SW should succeed");
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_cors_response.html b/dom/serviceworkers/test/eventsource/eventsource_cors_response.html
+--- a/dom/serviceworkers/test/eventsource/eventsource_cors_response.html
++++ b/dom/serviceworkers/test/eventsource/eventsource_cors_response.html
+@@ -3,17 +3,17 @@
+   http://creativecommons.org/publicdomain/zero/1.0/
+ -->
+ <!DOCTYPE HTML>
+ <html>
+ <head>
+   <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title>
+   <script type="text/javascript">
+ 
+-  var prefix = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/eventsource/";
++  var prefix = "http://mochi.test:8888/tests/dom/serviceworkers/test/eventsource/";
+ 
+   function ok(aCondition, aMessage) {
+     parent.postMessage({status: "callback", data: "ok", condition: aCondition, message: aMessage}, "*");
+   }
+ 
+   function doUnregister() {
+     navigator.serviceWorker.getRegistration().then(swr => {
+       swr.unregister().then(function(result) {
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js
+--- a/dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js
++++ b/dom/serviceworkers/test/eventsource/eventsource_cors_response_intercept_worker.js
+@@ -1,18 +1,18 @@
+ // Cross origin request
+-var prefix = 'http://example.com/tests/dom/workers/test/serviceworkers/eventsource/';
++var prefix = 'http://example.com/tests/dom/serviceworkers/test/eventsource/';
+ 
+ self.importScripts('eventsource_worker_helper.js');
+ 
+ self.addEventListener('fetch', function (event) {
+   var request = event.request;
+   var url = new URL(request.url);
+ 
+-  if (url.pathname !== '/tests/dom/workers/test/serviceworkers/eventsource/eventsource.resource') {
++  if (url.pathname !== '/tests/dom/serviceworkers/test/eventsource/eventsource.resource') {
+     return;
+   }
+ 
+   ok(request.mode === 'cors', 'EventSource should make a CORS request');
+   ok(request.cache === 'no-store', 'EventSource should make a no-store request');
+   var fetchRequest = new Request(prefix + 'eventsource.resource', { mode: 'cors'});
+   event.respondWith(fetch(fetchRequest).then((fetchResponse) => {
+     return fetchResponse;
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html
+--- a/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html
++++ b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response.html
+@@ -3,17 +3,17 @@
+   http://creativecommons.org/publicdomain/zero/1.0/
+ -->
+ <!DOCTYPE HTML>
+ <html>
+ <head>
+   <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title>
+   <script type="text/javascript">
+ 
+-  var prefix = "https://example.com/tests/dom/workers/test/serviceworkers/eventsource/";
++  var prefix = "https://example.com/tests/dom/serviceworkers/test/eventsource/";
+ 
+   function ok(aCondition, aMessage) {
+     parent.postMessage({status: "callback", data: "ok", condition: aCondition, message: aMessage}, "*");
+   }
+ 
+   function doUnregister() {
+     navigator.serviceWorker.getRegistration().then(swr => {
+       swr.unregister().then(function(result) {
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
+--- a/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
++++ b/dom/serviceworkers/test/eventsource/eventsource_mixed_content_cors_response_intercept_worker.js
+@@ -1,17 +1,17 @@
+-var prefix = 'http://example.com/tests/dom/workers/test/serviceworkers/eventsource/';
++var prefix = 'http://example.com/tests/dom/serviceworkers/test/eventsource/';
+ 
+ self.importScripts('eventsource_worker_helper.js');
+ 
+ self.addEventListener('fetch', function (event) {
+   var request = event.request;
+   var url = new URL(request.url);
+ 
+-  if (url.pathname !== '/tests/dom/workers/test/serviceworkers/eventsource/eventsource.resource') {
++  if (url.pathname !== '/tests/dom/serviceworkers/test/eventsource/eventsource.resource') {
+     return;
+   }
+ 
+   ok(request.mode === 'cors', 'EventSource should make a CORS request');
+   ok(request.cache === 'no-store', 'EventSource should make a no-store request');
+   var fetchRequest = new Request(prefix + 'eventsource.resource', { mode: 'cors'});
+   event.respondWith(fetch(fetchRequest).then((fetchResponse) => {
+     return fetchResponse;
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_opaque_response.html b/dom/serviceworkers/test/eventsource/eventsource_opaque_response.html
+--- a/dom/serviceworkers/test/eventsource/eventsource_opaque_response.html
++++ b/dom/serviceworkers/test/eventsource/eventsource_opaque_response.html
+@@ -3,17 +3,17 @@
+   http://creativecommons.org/publicdomain/zero/1.0/
+ -->
+ <!DOCTYPE HTML>
+ <html>
+ <head>
+   <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title>
+   <script type="text/javascript">
+ 
+-  var prefix = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/eventsource/";
++  var prefix = "http://mochi.test:8888/tests/dom/serviceworkers/test/eventsource/";
+ 
+   function ok(aCondition, aMessage) {
+     parent.postMessage({status: "callback", data: "ok", condition: aCondition, message: aMessage}, "*");
+   }
+ 
+   function doUnregister() {
+     navigator.serviceWorker.getRegistration().then(swr => {
+       swr.unregister().then(function(result) {
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js
+--- a/dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js
++++ b/dom/serviceworkers/test/eventsource/eventsource_opaque_response_intercept_worker.js
+@@ -1,18 +1,18 @@
+ // Cross origin request
+-var prefix = 'http://example.com/tests/dom/workers/test/serviceworkers/eventsource/';
++var prefix = 'http://example.com/tests/dom/serviceworkers/test/eventsource/';
+ 
+ self.importScripts('eventsource_worker_helper.js');
+ 
+ self.addEventListener('fetch', function (event) {
+   var request = event.request;
+   var url = new URL(request.url);
+ 
+-  if (url.pathname !== '/tests/dom/workers/test/serviceworkers/eventsource/eventsource.resource') {
++  if (url.pathname !== '/tests/dom/serviceworkers/test/eventsource/eventsource.resource') {
+     return;
+   }
+ 
+   ok(request.mode === 'cors', 'EventSource should make a CORS request');
+   ok(request.cache === 'no-store', 'EventSource should make a no-store request');
+   var fetchRequest = new Request(prefix + 'eventsource.resource', { mode: 'no-cors'});
+   event.respondWith(fetch(fetchRequest).then((fetchResponse) => {
+     return fetchResponse;
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html
+--- a/dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html
++++ b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response.html
+@@ -3,17 +3,17 @@
+   http://creativecommons.org/publicdomain/zero/1.0/
+ -->
+ <!DOCTYPE HTML>
+ <html>
+ <head>
+   <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title>
+   <script type="text/javascript">
+ 
+-  var prefix = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/eventsource/";
++  var prefix = "http://mochi.test:8888/tests/dom/serviceworkers/test/eventsource/";
+ 
+   function ok(aCondition, aMessage) {
+     parent.postMessage({status: "callback", data: "ok", condition: aCondition, message: aMessage}, "*");
+   }
+ 
+   function doUnregister() {
+     navigator.serviceWorker.getRegistration().then(swr => {
+       swr.unregister().then(function(result) {
+diff --git a/dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js
+--- a/dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js
++++ b/dom/serviceworkers/test/eventsource/eventsource_synthetic_response_intercept_worker.js
+@@ -1,15 +1,15 @@
+ self.importScripts('eventsource_worker_helper.js');
+ 
+ self.addEventListener('fetch', function (event) {
+   var request = event.request;
+   var url = new URL(request.url);
+ 
+-  if (url.pathname !== '/tests/dom/workers/test/serviceworkers/eventsource/eventsource.resource') {
++  if (url.pathname !== '/tests/dom/serviceworkers/test/eventsource/eventsource.resource') {
+     return;
+   }
+ 
+   ok(request.mode === 'cors', 'EventSource should make a CORS request');
+   var headerList = {
+     'Content-Type': 'text/event-stream',
+     'Cache-Control': 'no-cache, must-revalidate'
+   };
+diff --git a/dom/serviceworkers/test/fetch/context/csp-violate.sjs b/dom/serviceworkers/test/fetch/context/csp-violate.sjs
+--- a/dom/serviceworkers/test/fetch/context/csp-violate.sjs
++++ b/dom/serviceworkers/test/fetch/context/csp-violate.sjs
+@@ -1,6 +1,6 @@
+ function handleRequest(request, response)
+ {
+-  response.setHeader("Content-Security-Policy", "default-src 'none'; report-uri /tests/dom/workers/test/serviceworkers/fetch/context/csp-report.sjs", false);
++  response.setHeader("Content-Security-Policy", "default-src 'none'; report-uri /tests/dom/serviceworkers/test/fetch/context/csp-report.sjs", false);
+   response.setHeader("Content-Type", "text/html", false);
+   response.write("<link rel=stylesheet href=style.css>");
+ }
+diff --git a/dom/serviceworkers/test/fetch/hsts/embedder.html b/dom/serviceworkers/test/fetch/hsts/embedder.html
+--- a/dom/serviceworkers/test/fetch/hsts/embedder.html
++++ b/dom/serviceworkers/test/fetch/hsts/embedder.html
+@@ -1,7 +1,7 @@
+ <!DOCTYPE html>
+ <script>
+   window.onmessage = function(e) {
+     window.parent.postMessage(e.data, "*");
+   };
+ </script>
+-<iframe src="http://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/index.html"></iframe>
++<iframe src="http://example.com/tests/dom/serviceworkers/test/fetch/hsts/index.html"></iframe>
+diff --git a/dom/serviceworkers/test/fetch/hsts/image.html b/dom/serviceworkers/test/fetch/hsts/image.html
+--- a/dom/serviceworkers/test/fetch/hsts/image.html
++++ b/dom/serviceworkers/test/fetch/hsts/image.html
+@@ -1,13 +1,13 @@
+ <!DOCTYPE html>
+ <script>
+ onload=function(){
+   var img = new Image();
+-  img.src = "http://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/image-20px.png";
++  img.src = "http://example.com/tests/dom/serviceworkers/test/fetch/hsts/image-20px.png";
+   img.onload = function() {
+     window.parent.postMessage({status: "image", data: img.width}, "*");
+   };
+   img.onerror = function() {
+     window.parent.postMessage({status: "image", data: "error"}, "*");
+   };
+ };
+ </script>
+diff --git a/dom/serviceworkers/test/fetch/origin/https/index-https.sjs b/dom/serviceworkers/test/fetch/origin/https/index-https.sjs
+--- a/dom/serviceworkers/test/fetch/origin/https/index-https.sjs
++++ b/dom/serviceworkers/test/fetch/origin/https/index-https.sjs
+@@ -1,4 +1,4 @@
+ function handleRequest(request, response) {
+   response.setStatusLine(null, 308, "Permanent Redirect");
+-  response.setHeader("Location", "https://example.org/tests/dom/workers/test/serviceworkers/fetch/origin/https/realindex.html", false);
++  response.setHeader("Location", "https://example.org/tests/dom/serviceworkers/test/fetch/origin/https/realindex.html", false);
+ }
+diff --git a/dom/serviceworkers/test/fetch/origin/https/origin_test.js b/dom/serviceworkers/test/fetch/origin/https/origin_test.js
+--- a/dom/serviceworkers/test/fetch/origin/https/origin_test.js
++++ b/dom/serviceworkers/test/fetch/origin/https/origin_test.js
+@@ -1,9 +1,9 @@
+-var prefix = "/tests/dom/workers/test/serviceworkers/fetch/origin/https/";
++var prefix = "/tests/dom/serviceworkers/test/fetch/origin/https/";
+ 
+ function addOpaqueRedirect(cache, file) {
+   return fetch(new Request(prefix + file, { redirect: "manual" })).then(function(response) {
+     return cache.put(prefix + file, response);
+   });
+ }
+ 
+ self.addEventListener("install", function(event) {
+diff --git a/dom/serviceworkers/test/fetch/origin/index-to-https.sjs b/dom/serviceworkers/test/fetch/origin/index-to-https.sjs
+--- a/dom/serviceworkers/test/fetch/origin/index-to-https.sjs
++++ b/dom/serviceworkers/test/fetch/origin/index-to-https.sjs
+@@ -1,4 +1,4 @@
+ function handleRequest(request, response) {
+   response.setStatusLine(null, 308, "Permanent Redirect");
+-  response.setHeader("Location", "https://example.org/tests/dom/workers/test/serviceworkers/fetch/origin/realindex.html", false);
++  response.setHeader("Location", "https://example.org/tests/dom/serviceworkers/test/fetch/origin/realindex.html", false);
+ }
+diff --git a/dom/serviceworkers/test/fetch/origin/index.sjs b/dom/serviceworkers/test/fetch/origin/index.sjs
+--- a/dom/serviceworkers/test/fetch/origin/index.sjs
++++ b/dom/serviceworkers/test/fetch/origin/index.sjs
+@@ -1,4 +1,4 @@
+ function handleRequest(request, response) {
+   response.setStatusLine(null, 308, "Permanent Redirect");
+-  response.setHeader("Location", "http://example.org/tests/dom/workers/test/serviceworkers/fetch/origin/realindex.html", false);
++  response.setHeader("Location", "http://example.org/tests/dom/serviceworkers/test/fetch/origin/realindex.html", false);
+ }
+diff --git a/dom/serviceworkers/test/fetch/origin/origin_test.js b/dom/serviceworkers/test/fetch/origin/origin_test.js
+--- a/dom/serviceworkers/test/fetch/origin/origin_test.js
++++ b/dom/serviceworkers/test/fetch/origin/origin_test.js
+@@ -1,9 +1,9 @@
+-var prefix = "/tests/dom/workers/test/serviceworkers/fetch/origin/";
++var prefix = "/tests/dom/serviceworkers/test/fetch/origin/";
+ 
+ function addOpaqueRedirect(cache, file) {
+   return fetch(new Request(prefix + file, { redirect: "manual" })).then(function(response) {
+     return cache.put(prefix + file, response);
+   });
+ }
+ 
+ self.addEventListener("install", function(event) {
+diff --git a/dom/serviceworkers/test/fetch/requesturl/redirect.sjs b/dom/serviceworkers/test/fetch/requesturl/redirect.sjs
+--- a/dom/serviceworkers/test/fetch/requesturl/redirect.sjs
++++ b/dom/serviceworkers/test/fetch/requesturl/redirect.sjs
+@@ -1,4 +1,4 @@
+ function handleRequest(request, response) {
+   response.setStatusLine(null, 308, "Permanent Redirect");
+-  response.setHeader("Location", "http://example.org/tests/dom/workers/test/serviceworkers/fetch/requesturl/secret.html", false);
++  response.setHeader("Location", "http://example.org/tests/dom/serviceworkers/test/fetch/requesturl/secret.html", false);
+ }
+diff --git a/dom/serviceworkers/test/fetch/requesturl/redirector.html b/dom/serviceworkers/test/fetch/requesturl/redirector.html
+--- a/dom/serviceworkers/test/fetch/requesturl/redirector.html
++++ b/dom/serviceworkers/test/fetch/requesturl/redirector.html
+@@ -1,2 +1,2 @@
+ <!DOCTYPE html>
+-<meta http-equiv="refresh" content="3;URL=/tests/dom/workers/test/serviceworkers/fetch/requesturl/redirect.sjs">
++<meta http-equiv="refresh" content="3;URL=/tests/dom/serviceworkers/test/fetch/requesturl/redirect.sjs">
+diff --git a/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html b/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html
+--- a/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html
++++ b/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html
+@@ -2,9 +2,9 @@
+ <script>
+   window.onmessage = function(e) {
+     window.parent.postMessage(e.data, "*");
+     if (e.data.status == "protocol") {
+       document.querySelector("iframe").src = "image.html";
+     }
+   };
+ </script>
+-<iframe src="http://example.com/tests/dom/workers/test/serviceworkers/fetch/upgrade-insecure/index.html"></iframe>
++<iframe src="http://example.com/tests/dom/serviceworkers/test/fetch/upgrade-insecure/index.html"></iframe>
+diff --git a/dom/serviceworkers/test/fetch/upgrade-insecure/image.html b/dom/serviceworkers/test/fetch/upgrade-insecure/image.html
+--- a/dom/serviceworkers/test/fetch/upgrade-insecure/image.html
++++ b/dom/serviceworkers/test/fetch/upgrade-insecure/image.html
+@@ -1,13 +1,13 @@
+ <!DOCTYPE html>
+ <script>
+ onload=function(){
+   var img = new Image();
+-  img.src = "http://example.com/tests/dom/workers/test/serviceworkers/fetch/upgrade-insecure/image-20px.png";
++  img.src = "http://example.com/tests/dom/serviceworkers/test/fetch/upgrade-insecure/image-20px.png";
+   img.onload = function() {
+     window.parent.postMessage({status: "image", data: img.width}, "*");
+   };
+   img.onerror = function() {
+     window.parent.postMessage({status: "image", data: "error"}, "*");
+   };
+ };
+ </script>
+diff --git a/dom/serviceworkers/test/fetch_event_worker.js b/dom/serviceworkers/test/fetch_event_worker.js
+--- a/dom/serviceworkers/test/fetch_event_worker.js
++++ b/dom/serviceworkers/test/fetch_event_worker.js
+@@ -318,17 +318,17 @@ onfetch = function(ev) {
+   }
+ 
+   else if (ev.request.url.includes('somethingelse.txt')) {
+     ev.respondWith(new Response('something else response body', {}));
+   }
+ 
+   else if (ev.request.url.includes('redirect_serviceworker.sjs')) {
+     // The redirect_serviceworker.sjs server-side JavaScript file redirects to
+-    // 'http://mochi.test:8888/tests/dom/workers/test/serviceworkers/worker.js'
++    // 'http://mochi.test:8888/tests/dom/serviceworkers/test/worker.js'
+     // The redirected fetch should not go through the SW since the original
+     // fetch was initiated from a SW.
+     ev.respondWith(fetch('redirect_serviceworker.sjs'));
+   }
+ 
+   else if (ev.request.url.includes('load_cross_origin_xml_document_synthetic.xml')) {
+     if (ev.request.mode != 'same-origin') {
+       ev.respondWith(Promise.reject());
+diff --git a/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js b/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+--- a/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
++++ b/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+@@ -1,15 +1,15 @@
+ "use strict";
+ 
+ // Testing if 2 child processes are correctly managed when they both try to do
+ // an SW update.
+ 
+ const BASE_URI =
+- "http://mochi.test:8888/browser/dom/workers/test/serviceworkers/isolated/multi-e10s-update/";
++ "http://mochi.test:8888/browser/dom/serviceworkers/test/isolated/multi-e10s-update/";
+ 
+ add_task(async function test_update() {
+   info("Setting the prefs to having multi-e10s enabled");
+   await SpecialPowers.pushPrefEnv({"set": [
+     ["dom.ipc.processCount", 4],
+     ["dom.serviceWorkers.enabled", true],
+     ["dom.serviceWorkers.testing.enabled", true],
+   ]});
+diff --git a/dom/serviceworkers/test/opaque_intercept_worker.js b/dom/serviceworkers/test/opaque_intercept_worker.js
+--- a/dom/serviceworkers/test/opaque_intercept_worker.js
++++ b/dom/serviceworkers/test/opaque_intercept_worker.js
+@@ -1,12 +1,12 @@
+ var name = 'opaqueInterceptCache';
+ 
+ // Cross origin request to ensure that an opaque response is used
+-var prefix = 'http://example.com/tests/dom/workers/test/serviceworkers/'
++var prefix = 'http://example.com/tests/dom/serviceworkers/test/'
+ 
+ self.addEventListener('install', function(event) {
+   var request = new Request(prefix + 'notify_loaded.js', { mode: 'no-cors' });
+   event.waitUntil(
+     Promise.all([caches.open(name), fetch(request)]).then(function(results) {
+       var cache = results[0];
+       var response = results[1];
+       return cache.put('./sw_clients/does_not_exist.js', response);
+diff --git a/dom/serviceworkers/test/openWindow_worker.js b/dom/serviceworkers/test/openWindow_worker.js
+--- a/dom/serviceworkers/test/openWindow_worker.js
++++ b/dom/serviceworkers/test/openWindow_worker.js
+@@ -83,20 +83,20 @@ onmessage = function(event) {
+     }));
+   }
+ }
+ 
+ onnotificationclick = function(e) {
+   var results = [];
+   var promises = [];
+ 
+-  var redirect = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/redirect.sjs?"
+-  var redirect_xorigin = "http://example.com/tests/dom/workers/test/serviceworkers/redirect.sjs?"
+-  var same_origin = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html"
+-  var different_origin = "http://example.com/tests/dom/workers/test/serviceworkers/open_window/client.html"
++  var redirect = "http://mochi.test:8888/tests/dom/serviceworkers/test/redirect.sjs?"
++  var redirect_xorigin = "http://example.com/tests/dom/serviceworkers/test/redirect.sjs?"
++  var same_origin = "http://mochi.test:8888/tests/dom/serviceworkers/test/open_window/client.html"
++  var different_origin = "http://example.com/tests/dom/serviceworkers/test/open_window/client.html"
+ 
+ 
+   promises.push(testForUrl("about:blank", "TypeError", null, results));
+   promises.push(testForUrl(different_origin, null, null, results));
+   promises.push(testForUrl(same_origin, null, {url: same_origin}, results));
+   promises.push(testForUrl("open_window/client.html", null, {url: same_origin}, results));
+ 
+   // redirect tests
+diff --git a/dom/serviceworkers/test/open_window/client.html b/dom/serviceworkers/test/open_window/client.html
+--- a/dom/serviceworkers/test/open_window/client.html
++++ b/dom/serviceworkers/test/open_window/client.html
+@@ -9,17 +9,17 @@
+ </head>
+ <body>
+ <p id="display"></p>
+ <div id="content" style="display: none"></div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   window.onload = function() {
+-    if (window.location == "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html") {
++    if (window.location == "http://mochi.test:8888/tests/dom/serviceworkers/test/open_window/client.html") {
+       navigator.serviceWorker.ready.then(function(result) {
+         navigator.serviceWorker.onmessage = function(event) {
+           if (event.data !== "CLOSE") {
+             dump("ERROR: unexepected reply from the service worker.\n");
+           }
+           if (parent) {
+             parent.postMessage("CLOSE", "*");
+           }
+@@ -31,17 +31,17 @@
+       window.onmessage = function(event) {
+         if (event.data !== "CLOSE") {
+             dump("ERROR: unexepected reply from the iframe.\n");
+         }
+         window.close();
+       }
+ 
+       var iframe = document.createElement('iframe');
+-      iframe.src = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/open_window/client.html";
++      iframe.src = "http://mochi.test:8888/tests/dom/serviceworkers/test/open_window/client.html";
+       document.body.appendChild(iframe);
+     }
+   }
+ 
+ </script>
+ </pre>
+ </body>
+ </html>
+diff --git a/dom/serviceworkers/test/redirect_post.sjs b/dom/serviceworkers/test/redirect_post.sjs
+--- a/dom/serviceworkers/test/redirect_post.sjs
++++ b/dom/serviceworkers/test/redirect_post.sjs
+@@ -18,17 +18,17 @@ function handleRequest(request, response
+ 
+   var body = decodeURIComponent(
+     escape(String.fromCharCode.apply(null, bodyBytes)));
+ 
+   var currentHop = query.hop ? parseInt(query.hop) : 0;
+ 
+   var obj = JSON.parse(body);
+   if (currentHop < obj.hops) {
+-    var newURL = '/tests/dom/workers/test/serviceworkers/redirect_post.sjs?hop=' +
++    var newURL = '/tests/dom/serviceworkers/test/redirect_post.sjs?hop=' +
+                  (1 + currentHop);
+     response.setStatusLine(null, 307, 'redirect');
+     response.setHeader('Location', newURL);
+     return;
+   }
+ 
+   response.setHeader('Content-Type', 'application/json');
+   response.write(body);
+diff --git a/dom/serviceworkers/test/redirect_serviceworker.sjs b/dom/serviceworkers/test/redirect_serviceworker.sjs
+--- a/dom/serviceworkers/test/redirect_serviceworker.sjs
++++ b/dom/serviceworkers/test/redirect_serviceworker.sjs
+@@ -1,4 +1,4 @@
+ function handleRequest(request, response) {
+   response.setStatusLine("1.1", 302, "Found");
+-  response.setHeader("Location", "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/worker.js");
++  response.setHeader("Location", "http://mochi.test:8888/tests/dom/serviceworkers/test/worker.js");
+ }
+diff --git a/dom/serviceworkers/test/simpleregister/index.html b/dom/serviceworkers/test/simpleregister/index.html
+--- a/dom/serviceworkers/test/simpleregister/index.html
++++ b/dom/serviceworkers/test/simpleregister/index.html
+@@ -22,17 +22,17 @@
+               if (a[i].scope.match(/simpleregister\//)) {
+                 a[i].onupdatefound = function(e) {
+                   eventReceived();
+                 }
+               }
+             }
+           });
+ 
+-          navigator.serviceWorker.getRegistration('http://mochi.test:8888/tests/dom/workers/test/serviceworkers/simpleregister/')
++          navigator.serviceWorker.getRegistration('http://mochi.test:8888/tests/dom/serviceworkers/test/simpleregister/')
+             .then(function(a) {
+             window.parent.postMessage({ type: "check", status: a instanceof ServiceWorkerRegistration,
+                                         msg: "getRegistration returns a ServiceWorkerRegistration" }, "*");
+             a.onupdatefound = function(e) {
+               eventReceived();
+             }
+           });
+ 
+diff --git a/dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html b/dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html
+--- a/dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html
++++ b/dom/serviceworkers/test/sw_clients/file_blob_upload_frame.html
+@@ -49,17 +49,17 @@ function makeFileBlob(obj) {
+     };
+   });
+ }
+ 
+ navigator.serviceWorker.ready.then(function() {
+   parent.postMessage({ status: 'READY' }, '*');
+ });
+ 
+-var URL = '/tests/dom/workers/test/serviceworkers/redirect_post.sjs';
++var URL = '/tests/dom/serviceworkers/test/redirect_post.sjs';
+ 
+ addEventListener('message', function(evt) {
+   if (evt.data.type = 'TEST') {
+     makeFileBlob(evt.data.body).then(function(blob) {
+       return fetch(URL, { method: 'POST', body: blob });
+     }).then(function(response) {
+       return response.json();
+     }).then(function(result) {
+diff --git a/dom/serviceworkers/test/swa/worker_scope_precise.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_precise.js^headers^
+--- a/dom/serviceworkers/test/swa/worker_scope_precise.js^headers^
++++ b/dom/serviceworkers/test/swa/worker_scope_precise.js^headers^
+@@ -1,1 +1,1 @@
+-Service-Worker-Allowed: /tests/dom/workers/test/serviceworkers/swa
++Service-Worker-Allowed: /tests/dom/serviceworkers/test/swa
+diff --git a/dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^
+--- a/dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^
++++ b/dom/serviceworkers/test/swa/worker_scope_too_deep.js^headers^
+@@ -1,1 +1,1 @@
+-Service-Worker-Allowed: /tests/dom/workers/test/serviceworkers/swa/deep/way/too/specific
++Service-Worker-Allowed: /tests/dom/serviceworkers/test/swa/deep/way/too/specific
+diff --git a/dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^ b/dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^
+--- a/dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^
++++ b/dom/serviceworkers/test/swa/worker_scope_too_narrow.js^headers^
+@@ -1,1 +1,1 @@
+-Service-Worker-Allowed: /tests/dom/workers
++Service-Worker-Allowed: /tests/dom/serviceworkers
+diff --git a/dom/serviceworkers/test/test_cookie_fetch.html b/dom/serviceworkers/test/test_cookie_fetch.html
+--- a/dom/serviceworkers/test/test_cookie_fetch.html
++++ b/dom/serviceworkers/test/test_cookie_fetch.html
+@@ -15,32 +15,35 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/cookie/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/cookie/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+         // Remove the iframe and recreate a new one to ensure that any traces
+         // of the cookies have been removed from the child process.
+         iframe.remove();
+         iframe = document.createElement("iframe");
+         document.getElementById("content").appendChild(iframe);
+ 
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/cookie/synth.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/cookie/synth.html";
+       } else if (e.data.status == "done") {
+-        is(e.data.cookie, "foo=bar", "The synthesized document has access to its cookies");
++        // Note, we can't do an exact is() comparison here since other
++        // tests can leave cookies on the domain.
++        ok(e.data.cookie.includes("foo=bar"),
++           "The synthesized document has access to its cookies");
+ 
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/cookie/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/cookie/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_cross_origin_url_after_redirect.html b/dom/serviceworkers/test/test_cross_origin_url_after_redirect.html
+--- a/dom/serviceworkers/test/test_cross_origin_url_after_redirect.html
++++ b/dom/serviceworkers/test/test_cross_origin_url_after_redirect.html
+@@ -15,24 +15,24 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/requesturl/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/requesturl/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/requesturl/index.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/requesturl/index.html";
+       } else if (e.data.status == "done") {
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/requesturl/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/requesturl/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html b/dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html
+--- a/dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html
++++ b/dom/serviceworkers/test/test_csp_upgrade-insecure_intercept.html
+@@ -15,27 +15,27 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/upgrade-insecure/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/upgrade-insecure/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/upgrade-insecure/embedder.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/upgrade-insecure/embedder.html";
+       } else if (e.data.status == "protocol") {
+         is(e.data.data, "https:", "Correct protocol expected");
+       } else if (e.data.status == "image") {
+         is(e.data.data, 40, "The image request was upgraded before interception");
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/upgrade-insecure/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/upgrade-insecure/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+   SimpleTest.waitForExplicitFinish();
+diff --git a/dom/serviceworkers/test/test_devtools_track_serviceworker_time.html b/dom/serviceworkers/test/test_devtools_track_serviceworker_time.html
+--- a/dom/serviceworkers/test/test_devtools_track_serviceworker_time.html
++++ b/dom/serviceworkers/test/test_devtools_track_serviceworker_time.html
+@@ -15,17 +15,17 @@ const State = {
+   INSTALLED: Ci.nsIServiceWorkerInfo.STATE_INSTALLED,
+   ACTIVATING: Ci.nsIServiceWorkerInfo.STATE_ACTIVATING,
+   ACTIVATED: Ci.nsIServiceWorkerInfo.STATE_ACTIVATED,
+   REDUNDANT: Ci.nsIServiceWorkerInfo.STATE_REDUNDANT
+ };
+ let swm = Cc["@mozilla.org/serviceworkers/manager;1"].
+           getService(Ci.nsIServiceWorkerManager);
+ 
+-let EXAMPLE_URL = "https://example.com/chrome/dom/workers/test/serviceworkers/";
++let EXAMPLE_URL = "https://example.com/chrome/dom/serviceworkers/test/";
+ 
+ let swrlistener = null;
+ let registrationInfo = null;
+ 
+ // Use it to keep the sw after unregistration.
+ let astrayServiceWorkerInfo = null;
+ 
+ let expectedResults = [
+diff --git a/dom/serviceworkers/test/test_eventsource_intercept.html b/dom/serviceworkers/test/test_eventsource_intercept.html
+--- a/dom/serviceworkers/test/test_eventsource_intercept.html
++++ b/dom/serviceworkers/test/test_eventsource_intercept.html
+@@ -70,22 +70,22 @@
+         return testFrame("eventsource/eventsource_register_worker.html" +
+                          "?script=eventsource_synthetic_response_intercept_worker.js");
+       })
+       .then(() => {
+         return testFrame("eventsource/eventsource_synthetic_response.html");
+       })
+       .then(() => {
+         info("Going to intercept and test mixed content cors responses");
+-        return testFrame("https://example.com/tests/dom/workers/test/serviceworkers/" +
++        return testFrame("https://example.com/tests/dom/serviceworkers/test/" +
+                          "eventsource/eventsource_register_worker.html" +
+                          "?script=eventsource_mixed_content_cors_response_intercept_worker.js");
+       })
+       .then(() => {
+-        return testFrame("https://example.com/tests/dom/workers/test/serviceworkers/" +
++        return testFrame("https://example.com/tests/dom/serviceworkers/test/" +
+                          "eventsource/eventsource_mixed_content_cors_response.html");
+       })
+       .then(SimpleTest.finish)
+       .catch(function(e) {
+         ok(false, "Some test failed with error " + e);
+         SimpleTest.finish();
+       });
+   }
+diff --git a/dom/serviceworkers/test/test_hsts_upgrade_intercept.html b/dom/serviceworkers/test/test_hsts_upgrade_intercept.html
+--- a/dom/serviceworkers/test/test_hsts_upgrade_intercept.html
++++ b/dom/serviceworkers/test/test_hsts_upgrade_intercept.html
+@@ -16,36 +16,36 @@
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   var framesLoaded = 0;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/hsts/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "http://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/index.html";
++        iframe.src = "http://example.com/tests/dom/serviceworkers/test/fetch/hsts/index.html";
+       } else if (e.data.status == "protocol") {
+         is(e.data.data, "https:", "Correct protocol expected");
+         ok(e.data.securityInfoPresent, "Security info present on intercepted value");
+         switch (++framesLoaded) {
+         case 1:
+-          iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/embedder.html";
++          iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/hsts/embedder.html";
+           break;
+         case 2:
+-          iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/image.html";
++          iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/hsts/image.html";
+           break;
+         }
+       } else if (e.data.status == "image") {
+         is(e.data.data, 40, "The image request was upgraded before interception");
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/hsts/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/hsts/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         SpecialPowers.cleanUpSTSData("http://example.com");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_https_fetch.html b/dom/serviceworkers/test/test_https_fetch.html
+--- a/dom/serviceworkers/test/test_https_fetch.html
++++ b/dom/serviceworkers/test/test_https_fetch.html
+@@ -15,35 +15,35 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/register.html";
+     var ios;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+         ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+                            .getService(SpecialPowers.Ci.nsIIOService);
+         ios.offline = true;
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/index.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/index.html";
+       } else if (e.data.status == "done") {
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/synth-sw.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth-sw.html";
+       } else if (e.data.status == "done-synth-sw") {
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/synth-window.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth-window.html";
+       } else if (e.data.status == "done-synth-window") {
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/synth.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth.html";
+       } else if (e.data.status == "done-synth") {
+         ios.offline = false;
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_https_fetch_cloned_response.html b/dom/serviceworkers/test/test_https_fetch_cloned_response.html
+--- a/dom/serviceworkers/test/test_https_fetch_cloned_response.html
++++ b/dom/serviceworkers/test/test_https_fetch_cloned_response.html
+@@ -15,29 +15,29 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/clonedresponse/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/clonedresponse/register.html";
+     var ios;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+         ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+                            .getService(SpecialPowers.Ci.nsIIOService);
+         ios.offline = true;
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/clonedresponse/index.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/clonedresponse/index.html";
+       } else if (e.data.status == "done") {
+         ios.offline = false;
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/clonedresponse/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/clonedresponse/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_https_origin_after_redirect.html b/dom/serviceworkers/test/test_https_origin_after_redirect.html
+--- a/dom/serviceworkers/test/test_https_origin_after_redirect.html
++++ b/dom/serviceworkers/test/test_https_origin_after_redirect.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/index-https.sjs", "mywindow", "width=100,height=100");
++        win = window.open("https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/index-https.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "https://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_https_origin_after_redirect_cached.html b/dom/serviceworkers/test/test_https_origin_after_redirect_cached.html
+--- a/dom/serviceworkers/test/test_https_origin_after_redirect_cached.html
++++ b/dom/serviceworkers/test/test_https_origin_after_redirect_cached.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/index-cached-https.sjs", "mywindow", "width=100,height=100");
++        win = window.open("https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/index-cached-https.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "https://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/origin/https/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/origin/https/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html b/dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html
+--- a/dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html
++++ b/dom/serviceworkers/test/test_https_synth_fetch_from_cached_sw.html
+@@ -15,17 +15,17 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/register.html";
+     var ios;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+         ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+                            .getService(SpecialPowers.Ci.nsIIOService);
+         ios.offline = true;
+@@ -35,22 +35,22 @@
+         // and do a GC to ensure that the SW is destroyed.  This way, when we
+         // load synth.html for the second time, we will first recreate the
+         // service worker from the cache.  This is intended to test that we
+         // properly store and retrieve the security info from the cache.
+         iframe.remove();
+         iframe = null;
+         SpecialPowers.exactGC(function() {
+           iframe = document.createElement("iframe");
+-          iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/synth.html";
++          iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth.html";
+           document.body.appendChild(iframe);
+         });
+       } else if (e.data.status == "done-synth") {
+         ios.offline = false;
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_imagecache.html b/dom/serviceworkers/test/test_imagecache.html
+--- a/dom/serviceworkers/test/test_imagecache.html
++++ b/dom/serviceworkers/test/test_imagecache.html
+@@ -15,28 +15,28 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache/index.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/index.html";
+       } else if (e.data.status == "result") {
+         is(e.data.url, "image-40px.png", "Correct url expected");
+         is(e.data.width, 40, "Correct width expected");
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache/postmortem.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache/postmortem.html";
+       } else if (e.data.status == "postmortem") {
+         is(e.data.width, 20, "Correct width expected");
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+diff --git a/dom/serviceworkers/test/test_imagecache_max_age.html b/dom/serviceworkers/test/test_imagecache_max_age.html
+--- a/dom/serviceworkers/test/test_imagecache_max_age.html
++++ b/dom/serviceworkers/test/test_imagecache_max_age.html
+@@ -16,40 +16,40 @@
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   var framesLoaded = 0;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache-maxage/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache-maxage/index.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/index.html";
+       } else if (e.data.status == "result") {
+         switch (++framesLoaded) {
+         case 1:
+           is(e.data.url, "image-20px.png", "Correct url expected");
+           is(e.data.url2, "image-20px.png", "Correct url expected");
+           is(e.data.width, 20, "Correct width expected");
+           is(e.data.width2, 20, "Correct width expected");
+           // Wait for 100ms so that the image gets expired.
+           setTimeout(function() {
+-            iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache-maxage/index.html?new"
++            iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/index.html?new"
+           }, 100);
+           break;
+         case 2:
+           is(e.data.url, "image-40px.png", "Correct url expected");
+           is(e.data.url2, "image-40px.png", "Correct url expected");
+           is(e.data.width, 40, "Correct width expected");
+           is(e.data.width2, 40, "Correct width expected");
+-          iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/imagecache-maxage/unregister.html";
++          iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/unregister.html";
+           break;
+         default:
+           ok(false, "This should never happen");
+         }
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         SimpleTest.finish();
+       }
+diff --git a/dom/serviceworkers/test/test_importscript_mixedcontent.html b/dom/serviceworkers/test/test_importscript_mixedcontent.html
+--- a/dom/serviceworkers/test/test_importscript_mixedcontent.html
++++ b/dom/serviceworkers/test/test_importscript_mixedcontent.html
+@@ -15,26 +15,26 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/register.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/importscript-mixedcontent/register.html";
+     var ios;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/index.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/importscript-mixedcontent/index.html";
+       } else if (e.data.status == "done") {
+         ok(e.data.data, "good", "Mixed content blocking should work correctly for service workers");
+-        iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/importscript-mixedcontent/unregister.html";
++        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/importscript-mixedcontent/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_origin_after_redirect.html b/dom/serviceworkers/test/test_origin_after_redirect.html
+--- a/dom/serviceworkers/test/test_origin_after_redirect.html
++++ b/dom/serviceworkers/test/test_origin_after_redirect.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("/tests/dom/workers/test/serviceworkers/fetch/origin/index.sjs", "mywindow", "width=100,height=100");
++        win = window.open("/tests/dom/serviceworkers/test/fetch/origin/index.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "http://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_origin_after_redirect_cached.html b/dom/serviceworkers/test/test_origin_after_redirect_cached.html
+--- a/dom/serviceworkers/test/test_origin_after_redirect_cached.html
++++ b/dom/serviceworkers/test/test_origin_after_redirect_cached.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("/tests/dom/workers/test/serviceworkers/fetch/origin/index-cached.sjs", "mywindow", "width=100,height=100");
++        win = window.open("/tests/dom/serviceworkers/test/fetch/origin/index-cached.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "http://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_origin_after_redirect_to_https.html b/dom/serviceworkers/test/test_origin_after_redirect_to_https.html
+--- a/dom/serviceworkers/test/test_origin_after_redirect_to_https.html
++++ b/dom/serviceworkers/test/test_origin_after_redirect_to_https.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("/tests/dom/workers/test/serviceworkers/fetch/origin/index-to-https.sjs", "mywindow", "width=100,height=100");
++        win = window.open("/tests/dom/serviceworkers/test/fetch/origin/index-to-https.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "https://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html b/dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html
+--- a/dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html
++++ b/dom/serviceworkers/test/test_origin_after_redirect_to_https_cached.html
+@@ -15,30 +15,30 @@
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+   function runTest() {
+     iframe = document.querySelector("iframe");
+-    iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/register.html";
++    iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/register.html";
+     var win;
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+-        win = window.open("/tests/dom/workers/test/serviceworkers/fetch/origin/index-to-https-cached.sjs", "mywindow", "width=100,height=100");
++        win = window.open("/tests/dom/serviceworkers/test/fetch/origin/index-to-https-cached.sjs", "mywindow", "width=100,height=100");
+       } else if (e.data.status == "domain") {
+         is(e.data.data, "example.org", "Correct domain expected");
+       } else if (e.data.status == "origin") {
+         is(e.data.data, "https://example.org", "Correct origin expected");
+       } else if (e.data.status == "done") {
+         win.close();
+-        iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/origin/unregister.html";
++        iframe.src = "/tests/dom/serviceworkers/test/fetch/origin/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+ 
+diff --git a/dom/serviceworkers/test/test_privateBrowsing.html b/dom/serviceworkers/test/test_privateBrowsing.html
+--- a/dom/serviceworkers/test/test_privateBrowsing.html
++++ b/dom/serviceworkers/test/test_privateBrowsing.html
+@@ -6,17 +6,17 @@
+ </head>
+ <body>
+ 
+ <script type="application/javascript">
+ 
+ var mainWindow;
+ 
+ var contentPage = "http://mochi.test:8888/chrome/dom/workers/test/empty.html";
+-var workerScope = "http://mochi.test:8888/chrome/dom/workers/test/serviceworkers/";
++var workerScope = "http://mochi.test:8888/chrome/dom/serviceworkers/test/";
+ var workerURL = workerScope + "worker.js";
+ 
+ function testOnWindow(aIsPrivate, aCallback) {
+   var win = mainWindow.OpenBrowserWindow({private: aIsPrivate});
+   win.addEventListener("load", function() {
+     win.addEventListener("DOMContentLoaded", function onInnerLoad() {
+       if (win.content.location.href != contentPage) {
+         win.gBrowser.loadURI(contentPage);
+diff --git a/dom/serviceworkers/test/test_register_base.html b/dom/serviceworkers/test/test_register_base.html
+--- a/dom/serviceworkers/test/test_register_base.html
++++ b/dom/serviceworkers/test/test_register_base.html
+@@ -13,17 +13,17 @@
+ <body>
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   function runTest() {
+-    navigator.serviceWorker.register("http://mochi.test:8888/tests/dom/workers/test/serviceworkers/empty.js")
++    navigator.serviceWorker.register("http://mochi.test:8888/tests/dom/serviceworkers/test/empty.js")
+       .then(reg => {
+         ok(false, "Register should fail");
+         SimpleTest.finish();
+       }, err => {
+         is(err.name, "SecurityError", "Registration should fail with SecurityError");
+         SimpleTest.finish();
+       });
+   }
+diff --git a/dom/serviceworkers/test/test_register_https_in_http.html b/dom/serviceworkers/test/test_register_https_in_http.html
+--- a/dom/serviceworkers/test/test_register_https_in_http.html
++++ b/dom/serviceworkers/test/test_register_https_in_http.html
+@@ -13,17 +13,17 @@
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   function runTest() {
+     var iframe = document.createElement("iframe");
+-    iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/register_https.html";
++    iframe.src = "https://example.com/tests/dom/serviceworkers/test/register_https.html";
+     document.body.appendChild(iframe);
+ 
+     window.onmessage = event => {
+       switch (event.data.type) {
+       case "ok":
+         ok(event.data.status, event.data.msg);
+         break;
+       case "done":
+diff --git a/dom/serviceworkers/test/test_request_context.js b/dom/serviceworkers/test/test_request_context.js
+--- a/dom/serviceworkers/test/test_request_context.js
++++ b/dom/serviceworkers/test/test_request_context.js
+@@ -34,26 +34,26 @@ function isMulet() {
+   } catch(e) {
+     return false;
+   }
+ }
+ 
+ var iframe;
+ function runTest() {
+   iframe = document.querySelector("iframe");
+-  iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/context/register.html";
++  iframe.src = "/tests/dom/serviceworkers/test/fetch/context/register.html";
+   window.onmessage = function(e) {
+     if (e.data.status == "ok") {
+       ok(e.data.result, e.data.message);
+     } else if (e.data.status == "todo") {
+       todo(e.data.result, e.data.message);
+     } else if (e.data.status == "registrationdone") {
+-      iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/context/index.html?" + gTest;
++      iframe.src = "/tests/dom/serviceworkers/test/fetch/context/index.html?" + gTest;
+     } else if (e.data.status == "done") {
+-      iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/context/unregister.html";
++      iframe.src = "/tests/dom/serviceworkers/test/fetch/context/unregister.html";
+     } else if (e.data.status == "unregistrationdone") {
+       window.onmessage = null;
+       ok(true, "Test finished successfully");
+       SimpleTest.finish();
+     }
+   };
+ }
+ 
+diff --git a/dom/serviceworkers/test/test_sandbox_intercept.html b/dom/serviceworkers/test/test_sandbox_intercept.html
+--- a/dom/serviceworkers/test/test_sandbox_intercept.html
++++ b/dom/serviceworkers/test/test_sandbox_intercept.html
+@@ -18,26 +18,26 @@
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var normalFrame;
+   var sandboxFrame;
+   function runTest() {
+     normalFrame = document.getElementById("normal-frame");
+     sandboxFrame = document.getElementById("sandbox-frame");
+-    normalFrame.src = "/tests/dom/workers/test/serviceworkers/fetch/sandbox/register.html";
++    normalFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/register.html";
+     window.onmessage = function(e) {
+       if (e.data.status == "ok") {
+         ok(e.data.result, e.data.message);
+       } else if (e.data.status == "registrationdone") {
+         normalFrame.src = "about:blank";
+-        sandboxFrame.src = "/tests/dom/workers/test/serviceworkers/fetch/sandbox/index.html";
++        sandboxFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/index.html";
+       } else if (e.data.status == "done") {
+         sandboxFrame.src = "about:blank";
+-        normalFrame.src = "/tests/dom/workers/test/serviceworkers/fetch/sandbox/unregister.html";
++        normalFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/unregister.html";
+       } else if (e.data.status == "unregistrationdone") {
+         normalFrame.src = "about:blank";
+         window.onmessage = null;
+         ok(true, "Test finished successfully");
+         SimpleTest.finish();
+       }
+     };
+   }
+diff --git a/dom/serviceworkers/test/test_sanitize_domain.html b/dom/serviceworkers/test/test_sanitize_domain.html
+--- a/dom/serviceworkers/test/test_sanitize_domain.html
++++ b/dom/serviceworkers/test/test_sanitize_domain.html
+@@ -15,31 +15,31 @@
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   function start() {
+     const Cc = SpecialPowers.Cc;
+     const Ci = SpecialPowers.Ci;
+ 
+     function checkDomainRegistration(domain, exists) {
+-      return testFrame("http://" + domain + "/tests/dom/workers/test/serviceworkers/sanitize/example_check_and_unregister.html").then(function(body) {
++      return testFrame("http://" + domain + "/tests/dom/serviceworkers/test/sanitize/example_check_and_unregister.html").then(function(body) {
+         if (body === "FAIL") {
+           ok(false, "Error acquiring registration or unregistering for " + domain);
+         } else {
+           if (exists) {
+             ok(body === true, "Expected " + domain + " to still have a registration.");
+           } else {
+             ok(body === false, "Expected " + domain + " to have no registration.");
+           }
+         }
+       });
+     }
+ 
+     registerSW().then(function() {
+-      return testFrame("http://example.com/tests/dom/workers/test/serviceworkers/sanitize/frame.html").then(function(body) {
++      return testFrame("http://example.com/tests/dom/serviceworkers/test/sanitize/frame.html").then(function(body) {
+         is(body, "intercepted", "Expected serviceworker to intercept request");
+       });
+     }).then(function() {
+       SpecialPowers.removeServiceWorkerDataForExampleDomain();
+     }).then(function() {
+       return checkDomainRegistration("prefixexample.com", true /* exists */)
+         .then(function(e) {
+           return checkDomainRegistration("example.com", false /* exists */);
+@@ -62,20 +62,20 @@
+           resolve(message.data);
+         });
+       };
+       document.body.appendChild(iframe);
+     });
+   }
+ 
+   function registerSW() {
+-    return testFrame("http://example.com/tests/dom/workers/test/serviceworkers/sanitize/register.html")
++    return testFrame("http://example.com/tests/dom/serviceworkers/test/sanitize/register.html")
+            .then(function(e) {
+               // Register for prefixexample.com and then ensure it does not get unregistered.
+-              return testFrame("http://prefixexample.com/tests/dom/workers/test/serviceworkers/sanitize/register.html");
++              return testFrame("http://prefixexample.com/tests/dom/serviceworkers/test/sanitize/register.html");
+             });
+   }
+ 
+   SimpleTest.waitForExplicitFinish();
+ 
+   SpecialPowers.pushPrefEnv({"set": [
+     ["dom.serviceWorkers.exemptFromPerDomainMax", true],
+     ["dom.serviceWorkers.enabled", true],
+diff --git a/dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html b/dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html
+--- a/dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html
++++ b/dom/serviceworkers/test/test_script_loader_intercepted_js_cache.html
+@@ -42,17 +42,17 @@
+             }
+           }
+         },
+         "scriptloader_execute": "bytecode_exec"
+       }
+     };
+ 
+     var gScript = SpecialPowers.
+-      loadChromeScript('http://mochi.test:8888/tests/dom/workers/test/serviceworkers/file_js_cache_cleanup.js');
++      loadChromeScript('http://mochi.test:8888/tests/dom/serviceworkers/test/file_js_cache_cleanup.js');
+ 
+     function WaitForScriptTagEvent(url) {
+       var iframe = document.createElement("iframe");
+       document.body.appendChild(iframe);
+ 
+       var stateMachine = scriptLoaderStateMachine;
+       var stateHistory = [];
+       var stateMachineResolve, stateMachineReject;
+diff --git a/dom/serviceworkers/test/test_serviceworker_header.html b/dom/serviceworkers/test/test_serviceworker_header.html
+--- a/dom/serviceworkers/test/test_serviceworker_header.html
++++ b/dom/serviceworkers/test/test_serviceworker_header.html
+@@ -13,17 +13,17 @@
+ <body>
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   function runTest() {
+-    navigator.serviceWorker.register("http://mochi.test:8888/tests/dom/workers/test/serviceworkers/header_checker.sjs")
++    navigator.serviceWorker.register("http://mochi.test:8888/tests/dom/serviceworkers/test/header_checker.sjs")
+       .then(reg => {
+         ok(true, "Register should succeed");
+         reg.unregister().then(() => SimpleTest.finish());
+       }, err => {
+         ok(false, "Register should not fail");
+         SimpleTest.finish();
+       });
+   }
+diff --git a/dom/serviceworkers/test/test_serviceworker_not_sharedworker.html b/dom/serviceworkers/test/test_serviceworker_not_sharedworker.html
+--- a/dom/serviceworkers/test/test_serviceworker_not_sharedworker.html
++++ b/dom/serviceworkers/test/test_serviceworker_not_sharedworker.html
+@@ -13,17 +13,17 @@
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ <iframe></iframe>
+ </div>
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   var iframe;
+-  const SCOPE = "http://mochi.test:8888/tests/dom/workers/test/serviceworkers/";
++  const SCOPE = "http://mochi.test:8888/tests/dom/serviceworkers/test/";
+   function runTest() {
+     navigator.serviceWorker.ready.then(setupSW);
+     navigator.serviceWorker.register("serviceworker_not_sharedworker.js",
+                                      {scope: SCOPE});
+   }
+ 
+   var sw, worker;
+   function setupSW(registration) {
+diff --git a/dom/serviceworkers/test/test_third_party_iframes.html b/dom/serviceworkers/test/test_third_party_iframes.html
+--- a/dom/serviceworkers/test/test_third_party_iframes.html
++++ b/dom/serviceworkers/test/test_third_party_iframes.html
+@@ -34,17 +34,17 @@ function next() {
+   } catch(ex) {
+     ok(false, "Caught exception", ex);
+   }
+ }
+ 
+ onload = next;
+ 
+ let iframe;
+-let basePath = "/tests/dom/workers/test/serviceworkers/thirdparty/";
++let basePath = "/tests/dom/serviceworkers/test/thirdparty/";
+ let origin = window.location.protocol + "//" + window.location.host;
+ let thirdPartyOrigin = "https://example.com";
+ 
+ function testIframeLoaded() {
+   ok(true, "Iframe loaded");
+   iframe.removeEventListener("load", testIframeLoaded);
+   let message = {
+     source: "parent",
+diff --git a/dom/serviceworkers/test/test_update_missing_imported_script.html b/dom/serviceworkers/test/test_update_missing_imported_script.html
+--- a/dom/serviceworkers/test/test_update_missing_imported_script.html
++++ b/dom/serviceworkers/test/test_update_missing_imported_script.html
+@@ -18,18 +18,18 @@
+ <pre id="test"></pre>
+ <script class="testbody" type="text/javascript">
+ 
+   // We have the iframe register for its own scope so that this page is not
+   // holding any references when we GC.
+   function register() {
+     return Promise.resolve()
+       .then(_ => navigator.serviceWorker.register("http://mochi.test:8888/" +
+-                                                  "tests/dom/workers/test/" +
+-                                                  "serviceworkers/" +
++                                                  "tests/dom/serviceworkers/" +
++                                                  "test/" +
+                                                   "bug1290951_worker_main.sjs"))
+       .then(r => {
+         ok(r, "Should be a registration.");
+ 
+         // Get the newest worker.
+         var worker = r.installing || r.waiting || r.active;
+ 
+         // Wait for the worker becoming active.
+diff --git a/dom/serviceworkers/test/xslt_worker.js b/dom/serviceworkers/test/xslt_worker.js
+--- a/dom/serviceworkers/test/xslt_worker.js
++++ b/dom/serviceworkers/test/xslt_worker.js
+@@ -24,26 +24,26 @@ onfetch = function(event) {
+       ));
+     }
+     else if (testType == 'cors') {
+       if (event.request.mode != 'cors') {
+         event.respondWith(Response.error());
+         return;
+       }
+ 
+-      var url = "http://example.com/tests/dom/workers/test/serviceworkers/xslt/xslt.sjs?" + escape(xslt);
++      var url = "http://example.com/tests/dom/serviceworkers/test/xslt/xslt.sjs?" + escape(xslt);
+       event.respondWith(fetch(url, { mode: 'cors' }));
+     }
+     else if (testType == 'opaque') {
+       if (event.request.mode != 'cors') {
+         event.respondWith(Response.error());
+         return;
+       }
+ 
+-      var url = "http://example.com/tests/dom/workers/test/serviceworkers/xslt/xslt.sjs?" + escape(xslt);
++      var url = "http://example.com/tests/dom/serviceworkers/test/xslt/xslt.sjs?" + escape(xslt);
+       event.respondWith(fetch(url, { mode: 'no-cors' }));
+     }
+     else {
+       event.respondWith(Response.error());
+     }
+   }
+ };
+ 

+ 6 - 6
mozilla-release/patches/1433646-60a1.patch

@@ -2,7 +2,7 @@
 # User Andrew Osmond <aosmond@mozilla.com>
 # Date 1518649673 18000
 # Node ID 82135389f392b0b3f8c50ff03328f1e038650c00
-# Parent  b74e123320764abf97ae2e898c761ed4b13b999f
+# Parent  0b209c4e2d265e288612dc34f2b6165600f9868a
 Bug 1433646 - Allow ContentChild::Recv(Re)InitRendering to fail with the GPU process. r=rhunt
 
 When ContentChild::RecvInitRendering is received, it tries to setup the
@@ -26,12 +26,12 @@ failures. They are not recoverable.
 diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
 --- a/dom/ipc/ContentChild.cpp
 +++ b/dom/ipc/ContentChild.cpp
-@@ -36,16 +36,17 @@
+@@ -37,16 +37,17 @@
  #include "mozilla/dom/MemoryReportRequest.h"
  #include "mozilla/dom/ProcessGlobal.h"
  #include "mozilla/dom/PushNotifier.h"
+ #include "mozilla/dom/ServiceWorkerManager.h"
  #include "mozilla/dom/TabGroup.h"
- #include "mozilla/dom/workers/ServiceWorkerManager.h"
  #include "mozilla/dom/nsIContentChild.h"
  #include "mozilla/dom/URLClassifierChild.h"
  #include "mozilla/gfx/gfxVars.h"
@@ -44,7 +44,7 @@ diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
  #include "mozilla/ipc/GeckoChildProcessHost.h"
  #include "mozilla/ipc/ProcessChild.h"
  #include "mozilla/ipc/PChildToParentStreamChild.h"
-@@ -1265,35 +1266,57 @@ ContentChild::RecvGMPsChanged(nsTArray<G
+@@ -1267,35 +1268,57 @@ ContentChild::RecvGMPsChanged(nsTArray<G
  mozilla::ipc::IPCResult
  ContentChild::RecvInitProcessHangMonitor(Endpoint<PProcessHangMonitorChild>&& aHangMonitor)
  {
@@ -106,7 +106,7 @@ diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
  mozilla::ipc::IPCResult
  ContentChild::RecvReinitRendering(Endpoint<PCompositorManagerChild>&& aCompositor,
                                    Endpoint<PImageBridgeChild>&& aImageBridge,
-@@ -1308,26 +1331,26 @@ ContentChild::RecvReinitRendering(Endpoi
+@@ -1310,26 +1333,26 @@ ContentChild::RecvReinitRendering(Endpoi
    for (const auto& tabChild : tabs) {
      if (tabChild->LayersId()) {
        tabChild->InvalidateLayers();
@@ -163,7 +163,7 @@ diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h
 diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
 --- a/dom/ipc/TabChild.cpp
 +++ b/dom/ipc/TabChild.cpp
-@@ -1128,18 +1128,20 @@ TabChild::ActorDestroy(ActorDestroyReaso
+@@ -1106,18 +1106,20 @@ TabChild::ActorDestroy(ActorDestroyReaso
        // The messageManager relays messages via the TabChild which
        // no longer exists.
        static_cast<nsFrameMessageManager*>

+ 48 - 48
mozilla-release/patches/1434686-4-60a1.patch

@@ -3,7 +3,7 @@
 # Date 1517512874 18000
 #      Thu Feb 01 14:21:14 2018 -0500
 # Node ID a3d5547b0b7f7aa9a3e5eaed7b3151cadff42334
-# Parent  3b69491de4314b34e1def6092f91ce7d06c98389
+# Parent  729abe46846dd59473b06caa9c114f3c6cc02757
 Bug 1434686 part 4.  Use IgnoreErrors() in dom/.  r=mystor
 
 MozReview-Commit-ID: GwVDrTLPTOb
@@ -245,7 +245,7 @@ diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
 diff --git a/dom/clients/manager/ClientSource.cpp b/dom/clients/manager/ClientSource.cpp
 --- a/dom/clients/manager/ClientSource.cpp
 +++ b/dom/clients/manager/ClientSource.cpp
-@@ -406,18 +406,17 @@ ClientSource::SetController(const Servic
+@@ -403,18 +403,17 @@ ClientSource::SetController(const Servic
      if (navigator) {
        swc = navigator->ServiceWorker();
      }
@@ -803,6 +803,52 @@ diff --git a/dom/promise/PromiseDebugging.cpp b/dom/promise/PromiseDebugging.cpp
  
  } // namespace dom
  } // namespace mozilla
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -726,17 +726,17 @@ RespondWithHandler::ResolvedCallback(JSC
+                                                           mScriptSpec,
+                                                           responseURL,
+                                                           Move(closure));
+ 
+   nsCOMPtr<nsIInputStream> body;
+   ir->GetUnfilteredBody(getter_AddRefs(body));
+   // Errors and redirects may not have a body.
+   if (body) {
+-    IgnoredErrorResult error;
++    ErrorResult error;
+     response->SetBodyUsed(aCx, error);
+     if (NS_WARN_IF(error.Failed())) {
+       autoCancel.SetCancelErrorResult(aCx, error);
+       return;
+     }
+   }
+ 
+   MOZ_ALWAYS_SUCCEEDS(worker->DispatchToMainThread(startRunnable.forget()));
+diff --git a/dom/serviceworkers/ServiceWorkerScriptCache.cpp b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+--- a/dom/serviceworkers/ServiceWorkerScriptCache.cpp
++++ b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+@@ -613,19 +613,18 @@ private:
+     ir->SetURLList(aCN->URLList());
+ 
+     ir->InitChannelInfo(aCN->GetChannelInfo());
+     UniquePtr<PrincipalInfo> principalInfo = aCN->TakePrincipalInfo();
+     if (principalInfo) {
+       ir->SetPrincipalInfo(Move(principalInfo));
+     }
+ 
+-    IgnoredErrorResult ignored;
+     RefPtr<InternalHeaders> internalHeaders = aCN->GetInternalHeaders();
+-    ir->Headers()->Fill(*(internalHeaders.get()), ignored);
++    ir->Headers()->Fill(*(internalHeaders.get()), IgnoreErrors());
+ 
+     RefPtr<Response> response =
+       new Response(aCache->GetGlobalObject(), ir, nullptr);
+ 
+     RequestOrUSVString request;
+     request.SetAsUSVString().Rebind(aCN->URL().Data(), aCN->URL().Length());
+ 
+     // For now we have to wait until the Put Promise is fulfilled before we can
 diff --git a/dom/svg/SVGAnimationElement.cpp b/dom/svg/SVGAnimationElement.cpp
 --- a/dom/svg/SVGAnimationElement.cpp
 +++ b/dom/svg/SVGAnimationElement.cpp
@@ -1034,52 +1080,6 @@ diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
    if (pInfo) {
      mPrincipalInfo = mozilla::MakeUnique<PrincipalInfo>(*pInfo);
    }
-diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
---- a/dom/workers/ServiceWorkerEvents.cpp
-+++ b/dom/workers/ServiceWorkerEvents.cpp
-@@ -723,17 +723,17 @@ RespondWithHandler::ResolvedCallback(JSC
-                                                           mScriptSpec,
-                                                           responseURL,
-                                                           Move(closure));
- 
-   nsCOMPtr<nsIInputStream> body;
-   ir->GetUnfilteredBody(getter_AddRefs(body));
-   // Errors and redirects may not have a body.
-   if (body) {
--    IgnoredErrorResult error;
-+    ErrorResult error;
-     response->SetBodyUsed(aCx, error);
-     if (NS_WARN_IF(error.Failed())) {
-       autoCancel.SetCancelErrorResult(aCx, error);
-       return;
-     }
-   }
- 
-   MOZ_ALWAYS_SUCCEEDS(worker->DispatchToMainThread(startRunnable.forget()));
-diff --git a/dom/workers/ServiceWorkerScriptCache.cpp b/dom/workers/ServiceWorkerScriptCache.cpp
---- a/dom/workers/ServiceWorkerScriptCache.cpp
-+++ b/dom/workers/ServiceWorkerScriptCache.cpp
-@@ -612,19 +612,18 @@ private:
-     ir->SetURLList(aCN->URLList());
- 
-     ir->InitChannelInfo(aCN->GetChannelInfo());
-     UniquePtr<PrincipalInfo> principalInfo = aCN->TakePrincipalInfo();
-     if (principalInfo) {
-       ir->SetPrincipalInfo(Move(principalInfo));
-     }
- 
--    IgnoredErrorResult ignored;
-     RefPtr<InternalHeaders> internalHeaders = aCN->GetInternalHeaders();
--    ir->Headers()->Fill(*(internalHeaders.get()), ignored);
-+    ir->Headers()->Fill(*(internalHeaders.get()), IgnoreErrors());
- 
-     RefPtr<Response> response =
-       new Response(aCache->GetGlobalObject(), ir, nullptr);
- 
-     RequestOrUSVString request;
-     request.SetAsUSVString().Rebind(aCN->URL().Data(), aCN->URL().Length());
- 
-     // For now we have to wait until the Put Promise is fulfilled before we can
 diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp
 --- a/dom/xbl/nsXBLBinding.cpp
 +++ b/dom/xbl/nsXBLBinding.cpp

+ 6 - 6
mozilla-release/patches/1435910-0_2-60a1.patch

@@ -2,7 +2,7 @@
 # User Tooru Fujisawa <arai_a@mac.com>
 # Date 1519781802 -32400
 # Node ID 6331c25d7425cc1f1fdf72aa96376d26e503e3e5
-# Parent  278d965eb75f50ca057fef4c11ee1f28df1fa85e
+# Parent  7482d7958f47168569767d1228a91e3deac000e0
 Bug 1435910 - Part 0.2: Add BrowserTestUtils.{promiseAlertDialogOpen,promiseAlertDialog}. r=Gijs
 
 diff --git a/browser/components/downloads/test/browser/browser_confirm_unblock_download.js b/browser/components/downloads/test/browser/browser_confirm_unblock_download.js
@@ -145,9 +145,9 @@ diff --git a/browser/components/preferences/in-content/tests/head.js b/browser/c
    let settingsBtn = doc.getElementById("siteDataSettings");
    let dialogOverlay = win.gSubDialog._preloadDialog._overlay;
    let dialogLoadPromise = promiseLoadSubDialog("chrome://browser/content/preferences/siteDataSettings.xul");
-diff --git a/dom/workers/test/serviceworkers/browser_download_canceled.js b/dom/workers/test/serviceworkers/browser_download_canceled.js
---- a/dom/workers/test/serviceworkers/browser_download_canceled.js
-+++ b/dom/workers/test/serviceworkers/browser_download_canceled.js
+diff --git a/dom/serviceworkers/test/browser_download_canceled.js b/dom/serviceworkers/test/browser_download_canceled.js
+--- a/dom/serviceworkers/test/browser_download_canceled.js
++++ b/dom/serviceworkers/test/browser_download_canceled.js
 @@ -28,54 +28,35 @@ const { Downloads } = Cu.import("resourc
  async function clearDownloads() {
    const downloads = await Downloads.getList(Downloads.ALL);
@@ -234,7 +234,7 @@ diff --git a/dom/workers/test/serviceworkers/browser_download_canceled.js b/dom/
 diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
 +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
-@@ -555,20 +555,20 @@ var BrowserTestUtils = {
+@@ -558,20 +558,20 @@ var BrowserTestUtils = {
     *        and observing should continue. If not specified, the first window
     *        resolves the returned promise.
     * @return {Promise}
@@ -257,7 +257,7 @@ diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/m
        }
        Services.ww.registerNotification(observer);
      });
-@@ -1538,16 +1538,71 @@ var BrowserTestUtils = {
+@@ -1503,16 +1503,71 @@ var BrowserTestUtils = {
    async _removeAboutPageRegistrations() {
      for (let aboutModule of this._knownAboutPages) {
        await this.unregisterAboutPage(aboutModule);

+ 7 - 7
mozilla-release/patches/1437760-1-60a1.patch

@@ -2,13 +2,13 @@
 # User Ben Kelly <ben@wanderview.com>
 # Date 1519226912 28800
 # Node ID c6b9c2cb220d504dd68263f8d7291d4cdaa0f54c
-# Parent  17f688152743607ec7cdcbb007a00ac3f86f1854
+# Parent  455bf9aa65fa749d8780c2965b6bd36c2a00e18c
 Bug 1437760 P1 Propagate the FetchEvent.request.url fragment to the synthesized Response.url. r=asuth
 
-diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
---- a/dom/workers/ServiceWorkerEvents.cpp
-+++ b/dom/workers/ServiceWorkerEvents.cpp
-@@ -387,41 +387,44 @@ class RespondWithHandler final : public 
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -412,41 +412,44 @@ class RespondWithHandler final : public 
    nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo> mRegistration;
    const RequestMode mRequestMode;
    const RequestRedirect mRequestRedirectMode;
@@ -53,7 +53,7 @@ diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEven
    }
  
    void ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
-@@ -681,16 +684,28 @@ RespondWithHandler::ResolvedCallback(JSC
+@@ -706,16 +709,28 @@ RespondWithHandler::ResolvedCallback(JSC
    }
  
    // Propagate the URL to the content if the request mode is not "navigate".
@@ -82,7 +82,7 @@ diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEven
                                                                 mRespondWithScriptSpec,
                                                                 mRespondWithLineNumber,
                                                                 mRespondWithColumnNumber));
-@@ -781,17 +796,17 @@ FetchEvent::RespondWith(JSContext* aCx, 
+@@ -806,17 +821,17 @@ FetchEvent::RespondWith(JSContext* aCx, 
    ir->GetURL(requestURL);
  
    StopImmediatePropagation();

+ 291 - 292
mozilla-release/patches/1442465-4_2-61a1.patch

@@ -2,7 +2,7 @@
 # User Tooru Fujisawa <arai_a@mac.com>
 # Date 1521425805 -32400
 # Node ID ba58e9052ab972dfad832bb33d35652500fbe54c
-# Parent  2276e8d385b418cff768d6e4e7eb90dc9b5cafcb
+# Parent  d44f5ede6a3b32c1918fcf4d4c7916b64e815a14
 Bug 1442465 - Part 4.2: Stop unnecessarily awaiting on BrowserTestUtils.removeTab (simple part). r=dao
 
 diff --git a/accessible/tests/browser/general/browser_test_doc_creation.js b/accessible/tests/browser/general/browser_test_doc_creation.js
@@ -5409,7 +5409,7 @@ new file mode 100644
 diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_discarded.js b/browser/components/extensions/test/browser/browser_ext_tabs_discarded.js
 --- a/browser/components/extensions/test/browser/browser_ext_tabs_discarded.js
 +++ b/browser/components/extensions/test/browser/browser_ext_tabs_discarded.js
-@@ -55,12 +55,12 @@ add_task(async function test_discarded()
+@@ -58,12 +58,12 @@ add_task(async function test_discarded()
    let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
  
    let tab2 = BrowserTestUtils.addTab(gBrowser, "about:blank", {createLazyBrowser: true});
@@ -5701,7 +5701,7 @@ diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_insertC
 diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_lazy.js b/browser/components/extensions/test/browser/browser_ext_tabs_lazy.js
 --- a/browser/components/extensions/test/browser/browser_ext_tabs_lazy.js
 +++ b/browser/components/extensions/test/browser/browser_ext_tabs_lazy.js
-@@ -31,10 +31,10 @@ add_task(async function() {
+@@ -34,10 +34,10 @@ add_task(async function() {
  
    await extension.startup();
    await extension.awaitFinish("lazy");
@@ -10502,6 +10502,294 @@ diff --git a/dom/security/test/general/browser_test_toplevel_data_navigations.js
         "data: URI navigation after meta redirect should be blocked");
    });
  });
+diff --git a/dom/serviceworkers/test/browser_download_canceled.js b/dom/serviceworkers/test/browser_download_canceled.js
+--- a/dom/serviceworkers/test/browser_download_canceled.js
++++ b/dom/serviceworkers/test/browser_download_canceled.js
+@@ -137,11 +137,11 @@ add_task(async function interruptedDownl
+ 
+   // Cleanup
+   await ContentTask.spawn(
+     tab.linkedBrowser,
+     null,
+     function() {
+       return content.wrappedJSObject.registration.unregister();
+     });
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+   await clearDownloads();
+ });
+diff --git a/dom/serviceworkers/test/browser_force_refresh.js b/dom/serviceworkers/test/browser_force_refresh.js
+--- a/dom/serviceworkers/test/browser_force_refresh.js
++++ b/dom/serviceworkers/test/browser_force_refresh.js
+@@ -45,17 +45,17 @@ function test() {
+     async function done() {
+       tab.linkedBrowser.messageManager.removeMessageListener("test:event", eventHandler);
+ 
+       await ContentTask.spawn(tabBrowser, null, async function() {
+         const swr = await content.navigator.serviceWorker.getRegistration();
+         await swr.unregister();
+       });
+ 
+-      await BrowserTestUtils.removeTab(tab);
++      BrowserTestUtils.removeTab(tab);
+       executeSoon(finish);
+     }
+ 
+     var maxCacheLoadCount = 3;
+     var cachedLoadCount = 0;
+     var baseLoadCount = 0;
+ 
+     function eventHandler(msg) {
+diff --git a/dom/serviceworkers/test/browser_storage_permission.js b/dom/serviceworkers/test/browser_storage_permission.js
+--- a/dom/serviceworkers/test/browser_storage_permission.js
++++ b/dom/serviceworkers/test/browser_storage_permission.js
+@@ -36,51 +36,51 @@ add_task(async function setup() {
+             worker.removeEventListener("statechange", onStateChange);
+             resolve();
+           }
+         });
+       });
+     }
+   );
+ 
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+ });
+ 
+ add_task(async function test_allow_permission() {
+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
+                      Ci.nsICookiePermission.ACCESS_ALLOW);
+ 
+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
+   let browser = gBrowser.getBrowserForTab(tab);
+   await BrowserTestUtils.browserLoaded(browser);
+ 
+   let controller = await ContentTask.spawn(browser, null, async function() {
+     return content.navigator.serviceWorker.controller;
+   });
+ 
+   ok(!!controller, "page should be controlled with storage allowed");
+ 
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+ });
+ 
+ add_task(async function test_deny_permission() {
+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
+                      Ci.nsICookiePermission.ACCESS_DENY);
+ 
+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
+   let browser = gBrowser.getBrowserForTab(tab);
+   await BrowserTestUtils.browserLoaded(browser);
+ 
+   let controller = await ContentTask.spawn(browser, null, async function() {
+     return content.navigator.serviceWorker.controller;
+   });
+ 
+   is(controller, null, "page should be not controlled with storage denied");
+ 
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
+ });
+ 
+ add_task(async function test_session_permission() {
+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
+                      Ci.nsICookiePermission.ACCESS_SESSION);
+ 
+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
+@@ -88,17 +88,17 @@ add_task(async function test_session_per
+   await BrowserTestUtils.browserLoaded(browser);
+ 
+   let controller = await ContentTask.spawn(browser, null, async function() {
+     return content.navigator.serviceWorker.controller;
+   });
+ 
+   is(controller, null, "page should be not controlled with session storage");
+ 
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
+ });
+ 
+ add_task(async function cleanup() {
+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
+ 
+   let tab = BrowserTestUtils.addTab(gBrowser, PAGE_URI);
+   let browser = gBrowser.getBrowserForTab(tab);
+@@ -117,10 +117,10 @@ add_task(async function cleanup() {
+         if (worker.state === "redundant") {
+           worker.removeEventListener("statechange", onStateChange);
+           resolve();
+         }
+       });
+     });
+   });
+ 
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(tab);
+ });
+diff --git a/dom/serviceworkers/test/browser_storage_permission.js.1442465-4_2.later b/dom/serviceworkers/test/browser_storage_permission.js.1442465-4_2.later
+new file mode 100644
+--- /dev/null
++++ b/dom/serviceworkers/test/browser_storage_permission.js.1442465-4_2.later
+@@ -0,0 +1,59 @@
++--- browser_storage_permission.js
+++++ browser_storage_permission.js
++@@ -129,17 +129,17 @@ add_task(async function test_block_stora
++     content.document.body.appendChild(f);
++     await new Promise(resolve => f.onload = resolve);
++     return !!f.contentWindow.navigator.serviceWorker.controller;
++   });
++ 
++   ok(!!controller3, "page should be controlled with storage allowed");
++ 
++   await SpecialPowers.popPrefEnv();
++-  await BrowserTestUtils.removeTab(tab);
+++  BrowserTestUtils.removeTab(tab);
++ });
++ 
++ // Test to verify a blob URL iframe successfully inherits the
++ // parent's controller when storage is blocked between opening the
++ // parent page and creating the iframe.
++ add_task(async function test_block_storage_before_blob_iframe() {
++   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
++ 
++@@ -177,17 +177,17 @@ add_task(async function test_block_stora
++     content.document.body.appendChild(f);
++     await new Promise(resolve => f.onload = resolve);
++     return !!f.contentWindow.navigator.serviceWorker.controller;
++   });
++ 
++   ok(!!controller3, "page should be controlled with storage allowed");
++ 
++   await SpecialPowers.popPrefEnv();
++-  await BrowserTestUtils.removeTab(tab);
+++  BrowserTestUtils.removeTab(tab);
++ });
++ 
++ // Test to verify a blob worker script does not hit our service
++ // worker storage assertions when storage is blocked between opening
++ // the parent page and creating the worker.  Note, we cannot
++ // explicitly check if the worker is controlled since we don't expose
++ // WorkerNavigator.serviceWorkers.controller yet.
++ add_task(async function test_block_storage_before_blob_worker() {
++@@ -229,17 +229,17 @@ add_task(async function test_block_stora
++     return await new Promise(resolve => {
++       w.onmessage = e => resolve(e.data);
++     });
++   });
++ 
++   ok(scriptURL2.startsWith("blob:"), "blob URL worker should run");
++ 
++   await SpecialPowers.popPrefEnv();
++-  await BrowserTestUtils.removeTab(tab);
+++  BrowserTestUtils.removeTab(tab);
++ });
++ 
++ add_task(async function cleanup() {
++   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
++ 
++   let tab = BrowserTestUtils.addTab(gBrowser, PAGE_URI);
++   let browser = gBrowser.getBrowserForTab(tab);
++   await BrowserTestUtils.browserLoaded(browser);
+diff --git a/dom/serviceworkers/test/browser_unregister_with_containers.js b/dom/serviceworkers/test/browser_unregister_with_containers.js
+--- a/dom/serviceworkers/test/browser_unregister_with_containers.js
++++ b/dom/serviceworkers/test/browser_unregister_with_containers.js
+@@ -86,53 +86,53 @@ add_task(async function test() {
+   await doRegister(containerBrowser1);
+   await doRegister(containerBrowser2);
+ 
+   await checkUncontrolled(containerBrowser1);
+   await checkUncontrolled(containerBrowser2);
+ 
+   // Close the tabs we used to register the service workers.  These are not
+   // controlled.
+-  await BrowserTestUtils.removeTab(containerTab1);
+-  await BrowserTestUtils.removeTab(containerTab2);
++  BrowserTestUtils.removeTab(containerTab1);
++  BrowserTestUtils.removeTab(containerTab2);
+ 
+   // Open a controlled tab in each container.
+   containerTab1 = BrowserTestUtils.addTab(gBrowser, SCOPE, { userContextId: 1 });
+   containerBrowser1 = gBrowser.getBrowserForTab(containerTab1);
+   await BrowserTestUtils.browserLoaded(containerBrowser1);
+ 
+   containerTab2 = BrowserTestUtils.addTab(gBrowser, SCOPE, { userContextId: 2 });
+   containerBrowser2 = gBrowser.getBrowserForTab(containerTab2);
+   await BrowserTestUtils.browserLoaded(containerBrowser2);
+ 
+   await checkControlled(containerBrowser1);
+   await checkControlled(containerBrowser2);
+ 
+   // Remove the first container's controlled tab
+-  await BrowserTestUtils.removeTab(containerTab1);
++  BrowserTestUtils.removeTab(containerTab1);
+ 
+   // Create a new uncontrolled tab for the first container and use it to
+   // unregister the service worker.
+   containerTab1 = BrowserTestUtils.addTab(gBrowser, PAGE_URI, { userContextId: 1 });
+   containerBrowser1 = gBrowser.getBrowserForTab(containerTab1);
+   await BrowserTestUtils.browserLoaded(containerBrowser1);
+   await doUnregister(containerBrowser1);
+ 
+   await checkUncontrolled(containerBrowser1);
+   await checkControlled(containerBrowser2);
+ 
+   // Remove the second container's controlled tab
+-  await BrowserTestUtils.removeTab(containerTab2);
++  BrowserTestUtils.removeTab(containerTab2);
+ 
+   // Create a new uncontrolled tab for the second container and use it to
+   // unregister the service worker.
+   containerTab2 = BrowserTestUtils.addTab(gBrowser, PAGE_URI, { userContextId: 2 });
+   containerBrowser2 = gBrowser.getBrowserForTab(containerTab2);
+   await BrowserTestUtils.browserLoaded(containerBrowser2);
+   await doUnregister(containerBrowser2);
+ 
+   await checkUncontrolled(containerBrowser1);
+   await checkUncontrolled(containerBrowser2);
+ 
+   // Close the two tabs we used to unregister the service worker.
+-  await BrowserTestUtils.removeTab(containerTab1);
+-  await BrowserTestUtils.removeTab(containerTab2);
++  BrowserTestUtils.removeTab(containerTab1);
++  BrowserTestUtils.removeTab(containerTab2);
+ });
+diff --git a/dom/serviceworkers/test/browser_userContextId_openWindow.js b/dom/serviceworkers/test/browser_userContextId_openWindow.js
+--- a/dom/serviceworkers/test/browser_userContextId_openWindow.js
++++ b/dom/serviceworkers/test/browser_userContextId_openWindow.js
+@@ -121,11 +121,11 @@ add_task(async function test() {
+     })
+     .then(() => {
+       return uci;
+     });
+   });
+ 
+   is(uci, USER_CONTEXT_ID, "Tab runs with UCI " + USER_CONTEXT_ID);
+ 
+-  await BrowserTestUtils.removeTab(newTab);
+-  await BrowserTestUtils.removeTab(tab);
++  BrowserTestUtils.removeTab(newTab);
++  BrowserTestUtils.removeTab(tab);
+ });
+diff --git a/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js b/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+--- a/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
++++ b/dom/serviceworkers/test/isolated/multi-e10s-update/browser_multie10s_update.js
+@@ -123,11 +123,11 @@ add_task(async function test_update() {
+     // accesss content without using wrappedJSObject.
+     await content.registration.unregister();
+     const { count } =
+       await content.fetch(url + "?get-and-clear-count").then(r => r.json());
+     return count;
+   });
+   is(count, 2, "SW should have been fetched only twice");
+ 
+-  await BrowserTestUtils.removeTab(tab1);
+-  await BrowserTestUtils.removeTab(tab2);
++  BrowserTestUtils.removeTab(tab1);
++  BrowserTestUtils.removeTab(tab2);
+ });
 diff --git a/dom/tests/browser/browser_autofocus_background.js b/dom/tests/browser/browser_autofocus_background.js
 --- a/dom/tests/browser/browser_autofocus_background.js
 +++ b/dom/tests/browser/browser_autofocus_background.js
@@ -10853,295 +11141,6 @@ diff --git a/dom/webauthn/tests/browser/browser_fido_appid_extension.js b/dom/we
    Services.prefs.clearUserPref("security.webauth.webauthn_enable_softtoken");
    Services.prefs.clearUserPref("security.webauth.webauthn_enable_usbtoken");
  });
-diff --git a/dom/workers/test/serviceworkers/browser_download_canceled.js b/dom/workers/test/serviceworkers/browser_download_canceled.js
---- a/dom/workers/test/serviceworkers/browser_download_canceled.js
-+++ b/dom/workers/test/serviceworkers/browser_download_canceled.js
-@@ -137,11 +137,11 @@ add_task(async function interruptedDownl
- 
-   // Cleanup
-   await ContentTask.spawn(
-     tab.linkedBrowser,
-     null,
-     function() {
-       return content.wrappedJSObject.registration.unregister();
-     });
--  await BrowserTestUtils.removeTab(tab);
-+  BrowserTestUtils.removeTab(tab);
-   await clearDownloads();
- });
-diff --git a/dom/workers/test/serviceworkers/browser_force_refresh.js b/dom/workers/test/serviceworkers/browser_force_refresh.js
---- a/dom/workers/test/serviceworkers/browser_force_refresh.js
-+++ b/dom/workers/test/serviceworkers/browser_force_refresh.js
-@@ -45,17 +45,17 @@ function test() {
-     async function done() {
-       tab.linkedBrowser.messageManager.removeMessageListener("test:event", eventHandler);
- 
-       await ContentTask.spawn(tabBrowser, null, async function() {
-         const swr = await content.navigator.serviceWorker.getRegistration();
-         await swr.unregister();
-       });
- 
--      await BrowserTestUtils.removeTab(tab);
-+      BrowserTestUtils.removeTab(tab);
-       executeSoon(finish);
-     }
- 
-     var maxCacheLoadCount = 3;
-     var cachedLoadCount = 0;
-     var baseLoadCount = 0;
- 
-     function eventHandler(msg) {
-diff --git a/dom/workers/test/serviceworkers/browser_storage_permission.js.1442465-4_2.later b/dom/workers/test/serviceworkers/browser_storage_permission.js.1442465-4_2.later
-new file mode 100644
---- /dev/null
-+++ b/dom/workers/test/serviceworkers/browser_storage_permission.js.1442465-4_2.later
-@@ -0,0 +1,145 @@
-+--- browser_storage_permission.js
-++++ browser_storage_permission.js
-+@@ -34,51 +34,51 @@ add_task(async function setup() {
-+             worker.removeEventListener("statechange", onStateChange);
-+             resolve();
-+           }
-+         });
-+       });
-+     }
-+   );
-+ 
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-+ 
-+ add_task(async function test_allow_permission() {
-+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
-+                      Ci.nsICookiePermission.ACCESS_ALLOW);
-+ 
-+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-+   let browser = gBrowser.getBrowserForTab(tab);
-+   await BrowserTestUtils.browserLoaded(browser);
-+ 
-+   let controller = await ContentTask.spawn(browser, null, async function() {
-+     return content.navigator.serviceWorker.controller;
-+   });
-+ 
-+   ok(!!controller, "page should be controlled with storage allowed");
-+ 
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-+ 
-+ add_task(async function test_deny_permission() {
-+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
-+                      Ci.nsICookiePermission.ACCESS_DENY);
-+ 
-+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-+   let browser = gBrowser.getBrowserForTab(tab);
-+   await BrowserTestUtils.browserLoaded(browser);
-+ 
-+   let controller = await ContentTask.spawn(browser, null, async function() {
-+     return content.navigator.serviceWorker.controller;
-+   });
-+ 
-+   is(controller, null, "page should be not controlled with storage denied");
-+ 
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-+ });
-+ 
-+ add_task(async function test_session_permission() {
-+   Services.perms.add(Services.io.newURI(PAGE_URI), "cookie",
-+                      Ci.nsICookiePermission.ACCESS_SESSION);
-+ 
-+   let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-+@@ -86,17 +86,17 @@ add_task(async function test_session_per
-+   await BrowserTestUtils.browserLoaded(browser);
-+ 
-+   let controller = await ContentTask.spawn(browser, null, async function() {
-+     return content.navigator.serviceWorker.controller;
-+   });
-+ 
-+   is(controller, null, "page should be not controlled with session storage");
-+ 
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-+ });
-+ 
-+ // Test to verify an about:blank iframe successfully inherits the
-+ // parent's controller when storage is blocked between opening the
-+ // parent page and creating the iframe.
-+ add_task(async function test_block_storage_before_blank_iframe() {
-+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-+@@ -129,17 +129,17 @@ add_task(async function test_block_stora
-+     content.document.body.appendChild(f);
-+     await new Promise(resolve => f.onload = resolve);
-+     return !!f.contentWindow.navigator.serviceWorker.controller;
-+   });
-+ 
-+   ok(!!controller3, "page should be controlled with storage allowed");
-+ 
-+   await SpecialPowers.popPrefEnv();
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-+ 
-+ // Test to verify a blob URL iframe successfully inherits the
-+ // parent's controller when storage is blocked between opening the
-+ // parent page and creating the iframe.
-+ add_task(async function test_block_storage_before_blob_iframe() {
-+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-+ 
-+@@ -177,17 +177,17 @@ add_task(async function test_block_stora
-+     content.document.body.appendChild(f);
-+     await new Promise(resolve => f.onload = resolve);
-+     return !!f.contentWindow.navigator.serviceWorker.controller;
-+   });
-+ 
-+   ok(!!controller3, "page should be controlled with storage allowed");
-+ 
-+   await SpecialPowers.popPrefEnv();
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-+ 
-+ // Test to verify a blob worker script does not hit our service
-+ // worker storage assertions when storage is blocked between opening
-+ // the parent page and creating the worker.  Note, we cannot
-+ // explicitly check if the worker is controlled since we don't expose
-+ // WorkerNavigator.serviceWorkers.controller yet.
-+ add_task(async function test_block_storage_before_blob_worker() {
-+@@ -229,17 +229,17 @@ add_task(async function test_block_stora
-+     return await new Promise(resolve => {
-+       w.onmessage = e => resolve(e.data);
-+     });
-+   });
-+ 
-+   ok(scriptURL2.startsWith("blob:"), "blob URL worker should run");
-+ 
-+   await SpecialPowers.popPrefEnv();
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-+ 
-+ add_task(async function cleanup() {
-+   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-+ 
-+   let tab = BrowserTestUtils.addTab(gBrowser, PAGE_URI);
-+   let browser = gBrowser.getBrowserForTab(tab);
-+   await BrowserTestUtils.browserLoaded(browser);
-+@@ -257,10 +257,10 @@ add_task(async function cleanup() {
-+         if (worker.state === "redundant") {
-+           worker.removeEventListener("statechange", onStateChange);
-+           resolve();
-+         }
-+       });
-+     });
-+   });
-+ 
-+-  await BrowserTestUtils.removeTab(tab);
-++  BrowserTestUtils.removeTab(tab);
-+ });
-diff --git a/dom/workers/test/serviceworkers/browser_unregister_with_containers.js.1442465-4_2.later b/dom/workers/test/serviceworkers/browser_unregister_with_containers.js.1442465-4_2.later
-new file mode 100644
---- /dev/null
-+++ b/dom/workers/test/serviceworkers/browser_unregister_with_containers.js.1442465-4_2.later
-@@ -0,0 +1,62 @@
-+--- browser_unregister_with_containers.js
-++++ browser_unregister_with_containers.js
-+@@ -84,53 +84,53 @@ add_task(async function test() {
-+   await doRegister(containerBrowser1);
-+   await doRegister(containerBrowser2);
-+ 
-+   await checkUncontrolled(containerBrowser1);
-+   await checkUncontrolled(containerBrowser2);
-+ 
-+   // Close the tabs we used to register the service workers.  These are not
-+   // controlled.
-+-  await BrowserTestUtils.removeTab(containerTab1);
-+-  await BrowserTestUtils.removeTab(containerTab2);
-++  BrowserTestUtils.removeTab(containerTab1);
-++  BrowserTestUtils.removeTab(containerTab2);
-+ 
-+   // Open a controlled tab in each container.
-+   containerTab1 = BrowserTestUtils.addTab(gBrowser, SCOPE, { userContextId: 1 });
-+   containerBrowser1 = gBrowser.getBrowserForTab(containerTab1);
-+   await BrowserTestUtils.browserLoaded(containerBrowser1);
-+ 
-+   containerTab2 = BrowserTestUtils.addTab(gBrowser, SCOPE, { userContextId: 2 });
-+   containerBrowser2 = gBrowser.getBrowserForTab(containerTab2);
-+   await BrowserTestUtils.browserLoaded(containerBrowser2);
-+ 
-+   await checkControlled(containerBrowser1);
-+   await checkControlled(containerBrowser2);
-+ 
-+   // Remove the first container's controlled tab
-+-  await BrowserTestUtils.removeTab(containerTab1);
-++  BrowserTestUtils.removeTab(containerTab1);
-+ 
-+   // Create a new uncontrolled tab for the first container and use it to
-+   // unregister the service worker.
-+   containerTab1 = BrowserTestUtils.addTab(gBrowser, PAGE_URI, { userContextId: 1 });
-+   containerBrowser1 = gBrowser.getBrowserForTab(containerTab1);
-+   await BrowserTestUtils.browserLoaded(containerBrowser1);
-+   await doUnregister(containerBrowser1);
-+ 
-+   await checkUncontrolled(containerBrowser1);
-+   await checkControlled(containerBrowser2);
-+ 
-+   // Remove the second container's controlled tab
-+-  await BrowserTestUtils.removeTab(containerTab2);
-++  BrowserTestUtils.removeTab(containerTab2);
-+ 
-+   // Create a new uncontrolled tab for the second container and use it to
-+   // unregister the service worker.
-+   containerTab2 = BrowserTestUtils.addTab(gBrowser, PAGE_URI, { userContextId: 2 });
-+   containerBrowser2 = gBrowser.getBrowserForTab(containerTab2);
-+   await BrowserTestUtils.browserLoaded(containerBrowser2);
-+   await doUnregister(containerBrowser2);
-+ 
-+   await checkUncontrolled(containerBrowser1);
-+   await checkUncontrolled(containerBrowser2);
-+ 
-+   // Close the two tabs we used to unregister the service worker.
-+-  await BrowserTestUtils.removeTab(containerTab1);
-+-  await BrowserTestUtils.removeTab(containerTab2);
-++  BrowserTestUtils.removeTab(containerTab1);
-++  BrowserTestUtils.removeTab(containerTab2);
-+ });
-diff --git a/dom/workers/test/serviceworkers/browser_userContextId_openWindow.js b/dom/workers/test/serviceworkers/browser_userContextId_openWindow.js
---- a/dom/workers/test/serviceworkers/browser_userContextId_openWindow.js
-+++ b/dom/workers/test/serviceworkers/browser_userContextId_openWindow.js
-@@ -121,11 +121,11 @@ add_task(async function test() {
-     })
-     .then(() => {
-       return uci;
-     });
-   });
- 
-   is(uci, USER_CONTEXT_ID, "Tab runs with UCI " + USER_CONTEXT_ID);
- 
--  await BrowserTestUtils.removeTab(newTab);
--  await BrowserTestUtils.removeTab(tab);
-+  BrowserTestUtils.removeTab(newTab);
-+  BrowserTestUtils.removeTab(tab);
- });
-diff --git a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js b/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js
---- a/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js
-+++ b/dom/workers/test/serviceworkers/isolated/multi-e10s-update/browser_multie10s_update.js
-@@ -123,11 +123,11 @@ add_task(async function test_update() {
-     // accesss content without using wrappedJSObject.
-     await content.registration.unregister();
-     const { count } =
-       await content.fetch(url + "?get-and-clear-count").then(r => r.json());
-     return count;
-   });
-   is(count, 2, "SW should have been fetched only twice");
- 
--  await BrowserTestUtils.removeTab(tab1);
--  await BrowserTestUtils.removeTab(tab2);
-+  BrowserTestUtils.removeTab(tab1);
-+  BrowserTestUtils.removeTab(tab2);
- });
 diff --git a/dom/xhr/tests/browser_xhr_onchange_leak.js b/dom/xhr/tests/browser_xhr_onchange_leak.js
 --- a/dom/xhr/tests/browser_xhr_onchange_leak.js
 +++ b/dom/xhr/tests/browser_xhr_onchange_leak.js

+ 5 - 5
mozilla-release/patches/1443850-1-61a1.patch

@@ -2,13 +2,13 @@
 # User Ben Kelly <ben@wanderview.com>
 # Date 1521458940 -7200
 # Node ID a17d9a6aee914f7737a949bbd3fdc738c357c549
-# Parent  a5e7168378fe25ab203b93594c6119996d8fe19c
+# Parent  29a88d958a6bd7d02181f5d663908c616d9d1195
 Bug 1443850 P1 Don't try to apply the request fragment to an empty response URL when perform service worker interception. r=asuth
 
-diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
---- a/dom/workers/ServiceWorkerEvents.cpp
-+++ b/dom/workers/ServiceWorkerEvents.cpp
-@@ -691,17 +691,17 @@ RespondWithHandler::ResolvedCallback(JSC
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -716,17 +716,17 @@ RespondWithHandler::ResolvedCallback(JSC
      responseURL = ir->GetUnfilteredURL();
  
      // Similar to how we apply the request fragment to redirects automatically

+ 7 - 78
mozilla-release/patches/1461181-62a1.patch

@@ -2,84 +2,13 @@
 # User Ben Kelly <ben@wanderview.com>
 # Date 1526919227 25200
 # Node ID d5ec7b9c344ae2475ff6c411c3776c7c33353ec5
-# Parent  a89976be25c1dfc643b5067084d34cae0ece1e60
+# Parent  8de806ff35346971b1fb89ed836cc33501b9233d
 Bug 1461181 Don't call ServiceWorkerManager::StartControllingClient() if there is no active worker. r=asuth
 
-diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp.1461181.later b/dom/serviceworkers/ServiceWorkerManager.cpp.1461181.later
-new file mode 100644
---- /dev/null
-+++ b/dom/serviceworkers/ServiceWorkerManager.cpp.1461181.later
-@@ -0,0 +1,66 @@
-+--- ServiceWorkerManager.cpp
-++++ ServiceWorkerManager.cpp
-+@@ -307,17 +307,17 @@ ServiceWorkerManager::Init(ServiceWorker
-+ 
-+   mActor = static_cast<ServiceWorkerManagerChild*>(actor);
-+ }
-+ 
-+ RefPtr<GenericPromise>
-+ ServiceWorkerManager::StartControllingClient(const ClientInfo& aClientInfo,
-+                                              ServiceWorkerRegistrationInfo* aRegistrationInfo)
-+ {
-+-  MOZ_DIAGNOSTIC_ASSERT(aRegistrationInfo->GetActive());
-++  MOZ_RELEASE_ASSERT(aRegistrationInfo->GetActive());
-+ 
-+   RefPtr<GenericPromise> ref;
-+ 
-+   const ServiceWorkerDescriptor& active =
-+     aRegistrationInfo->GetActive()->Descriptor();
-+ 
-+   auto entry = mControlledClients.LookupForAdd(aClientInfo.Id());
-+   if (entry) {
-+@@ -1877,16 +1877,17 @@ ServiceWorkerManager::StartControlling(c
-+   nsCOMPtr<nsIURI> scope;
-+   nsresult rv =
-+     NS_NewURI(getter_AddRefs(scope), aServiceWorker.Scope(), nullptr, nullptr);
-+   NS_ENSURE_SUCCESS(rv, false);
-+ 
-+   RefPtr<ServiceWorkerRegistrationInfo> registration =
-+     GetServiceWorkerRegistrationInfo(principal, scope);
-+   NS_ENSURE_TRUE(registration, false);
-++  NS_ENSURE_TRUE(registration->GetActive(), false);
-+ 
-+   StartControllingClient(aClientInfo, registration);
-+ 
-+   return true;
-+ }
-+ 
-+ void
-+ ServiceWorkerManager::MaybeCheckNavigationUpdate(const ClientInfo& aClientInfo)
-+@@ -2552,20 +2553,25 @@ ServiceWorkerManager::UpdateInternal(nsI
-+   queue->ScheduleJob(job);
-+ }
-+ 
-+ already_AddRefed<GenericPromise>
-+ ServiceWorkerManager::MaybeClaimClient(nsIDocument* aDocument,
-+                                        ServiceWorkerRegistrationInfo* aWorkerRegistration)
-+ {
-+   MOZ_DIAGNOSTIC_ASSERT(aWorkerRegistration);
-+-  MOZ_DIAGNOSTIC_ASSERT(aWorkerRegistration->GetActive());
-+ 
-+   RefPtr<GenericPromise> ref;
-+ 
-++  if (!aWorkerRegistration->GetActive()) {
-++    ref = GenericPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
-++                                          __func__);
-++    return ref.forget();
-++  }
-++
-+   // Same origin check
-+   if (!aWorkerRegistration->Principal()->Equals(aDocument->NodePrincipal())) {
-+     ref = GenericPromise::CreateAndReject(NS_ERROR_DOM_SECURITY_ERR, __func__);
-+     return ref.forget();
-+   }
-+ 
-+   Maybe<ClientInfo> clientInfo(aDocument->GetClientInfo());
-+   if (NS_WARN_IF(clientInfo.isNothing())) {
-diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
---- a/dom/workers/ServiceWorkerManager.cpp
-+++ b/dom/workers/ServiceWorkerManager.cpp
-@@ -307,17 +307,17 @@ ServiceWorkerManager::Init(ServiceWorker
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
+@@ -308,17 +308,17 @@ ServiceWorkerManager::Init(ServiceWorker
  
    mActor = static_cast<ServiceWorkerManagerChild*>(actor);
  }
@@ -98,7 +27,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
  
    auto entry = mControlledClients.LookupForAdd(aClientInfo.Id());
    if (entry) {
-@@ -2152,16 +2152,17 @@ ServiceWorkerManager::StartControlling(c
+@@ -2172,16 +2172,17 @@ ServiceWorkerManager::StartControlling(c
    nsCOMPtr<nsIURI> scope;
    nsresult rv =
      NS_NewURI(getter_AddRefs(scope), aServiceWorker.Scope(), nullptr, nullptr);
@@ -116,7 +45,7 @@ diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerMan
  
  void
  ServiceWorkerManager::MaybeCheckNavigationUpdate(const ClientInfo& aClientInfo)
-@@ -2948,20 +2949,25 @@ ServiceWorkerManager::UpdateInternal(nsI
+@@ -2920,20 +2921,25 @@ ServiceWorkerManager::UpdateInternal(nsI
    queue->ScheduleJob(job);
  }
  

+ 31 - 31
mozilla-release/patches/1465060-1-std-62a1.patch

@@ -2,7 +2,7 @@
 # User Miko Mynttinen <mikokm@gmail.com>
 # Date 1527868747 -7200
 # Node ID a0d11b55d5957a488b41420c4f6cc178df7cd2e7
-# Parent  5dc997a8ba29c97bb16163afe843ff7488892fa7
+# Parent  6c7be6261c6a2811dcc547aeb244dd0bfc3375cf
 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
 
 MozReview-Commit-ID: HpdFXqQdIOO
@@ -56,7 +56,7 @@ diff --git a/devtools/shared/heapsnapshot/DeserializedNode.cpp b/devtools/shared
 diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
 --- a/docshell/base/nsDocShell.cpp
 +++ b/docshell/base/nsDocShell.cpp
-@@ -3479,17 +3479,17 @@ nsDocShell::MaybeCreateInitialClientSour
+@@ -2876,17 +2876,17 @@ nsDocShell::MaybeCreateInitialClientSour
  }
  
  Maybe<ClientInfo>
@@ -75,7 +75,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
  
    if (!doc || !doc->IsInitialDocument()) {
      return Maybe<ClientInfo>();
-@@ -15073,20 +15073,20 @@ nsDocShell::NotifyJSRunToCompletionStart
+@@ -14173,20 +14173,20 @@ nsDocShell::NotifyJSRunToCompletionStart
                                           const uint32_t aLineNumber,
                                           JS::Handle<JS::Value> aAsyncStack,
                                           const char* aAsyncCause)
@@ -264,7 +264,7 @@ diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissi
 diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
 --- a/dom/base/nsDocument.cpp
 +++ b/dom/base/nsDocument.cpp
-@@ -5670,39 +5670,39 @@ nsIDocument::GetAnonRootIfInAnonymousCon
+@@ -5671,39 +5671,39 @@ nsIDocument::GetAnonRootIfInAnonymousCon
    return nullptr;
  }
  
@@ -316,7 +316,7 @@ diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
 diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
 --- a/dom/base/nsGlobalWindow.cpp
 +++ b/dom/base/nsGlobalWindow.cpp
-@@ -4454,29 +4454,29 @@ void
+@@ -4488,29 +4488,29 @@ void
  nsPIDOMWindowInner::SyncStateFromParentWindow()
  {
    nsGlobalWindow::Cast(this)->SyncStateFromParentWindow();
@@ -349,7 +349,7 @@ diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
    nsGlobalWindow::Cast(this)->NoteCalledRegisterForServiceWorkerScope(aScope);
  }
  
-@@ -11924,17 +11924,17 @@ nsGlobalWindow::ShowSlowScriptDialog(con
+@@ -11958,17 +11958,17 @@ nsGlobalWindow::ShowSlowScriptDialog(con
    auto getString = [&] (const char* name,
                          nsContentUtils::PropertiesFile propFile = nsContentUtils::eDOM_PROPERTIES) {
      nsAutoString result;
@@ -368,7 +368,7 @@ diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
    // Get localizable strings
  
    nsAutoString title, checkboxMsg, debugButton, msg;
-@@ -12778,43 +12778,43 @@ nsGlobalWindow::CallOnChildren(Method aM
+@@ -12812,43 +12812,43 @@ nsGlobalWindow::CallOnChildren(Method aM
  Maybe<ClientInfo>
  nsGlobalWindow::GetClientInfo() const
  {
@@ -418,7 +418,7 @@ diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
 diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp
 --- a/dom/canvas/ImageBitmap.cpp
 +++ b/dom/canvas/ImageBitmap.cpp
-@@ -791,17 +791,17 @@ ImageBitmap::ToCloneData() const
+@@ -792,17 +792,17 @@ ImageBitmap::ToCloneData() const
    UniquePtr<ImageBitmapCloneData> result(new ImageBitmapCloneData());
    result->mPictureRect = mPictureRect;
    result->mAlphaType = mAlphaType;
@@ -751,7 +751,7 @@ diff --git a/dom/geolocation/nsGeolocation.cpp b/dom/geolocation/nsGeolocation.c
 diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
 --- a/dom/ipc/ContentParent.cpp
 +++ b/dom/ipc/ContentParent.cpp
-@@ -4310,18 +4310,18 @@ ContentParent::RecvNotifyTabDestroying(c
+@@ -4322,18 +4322,18 @@ ContentParent::RecvNotifyTabDestroying(c
  {
    NotifyTabDestroying(aTabId, aCpId);
    return IPC_OK();
@@ -1215,6 +1215,28 @@ diff --git a/dom/media/platforms/omx/OmxPlatformLayer.cpp b/dom/media/platforms/
    MOZ_ASSERT(mInfo);
  
    OMX_PORT_PARAM_TYPE portParam;
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrar.cpp b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistrar.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+@@ -1174,17 +1174,17 @@ ServiceWorkerRegistrar::GetShutdownPhase
+   // memory), and there's no point in continuing startup. Include as much
+   // information as possible in the crash report.
+   RELEASE_ASSERT_SUCCEEDED(rv, "async shutdown service");
+ 
+ 
+   nsCOMPtr<nsIAsyncShutdownClient> client;
+   rv = svc->GetProfileBeforeChange(getter_AddRefs(client));
+   RELEASE_ASSERT_SUCCEEDED(rv, "profileBeforeChange shutdown blocker");
+-  return std::move(client);
++  return client;
+ }
+ 
+ #undef RELEASE_ASSERT_SUCCEEDED
+ 
+ void
+ ServiceWorkerRegistrar::Shutdown()
+ {
+   AssertIsOnBackgroundThread();
 diff --git a/dom/u2f/U2F.cpp b/dom/u2f/U2F.cpp
 --- a/dom/u2f/U2F.cpp
 +++ b/dom/u2f/U2F.cpp
@@ -1256,28 +1278,6 @@ diff --git a/dom/u2f/U2F.cpp b/dom/u2f/U2F.cpp
                          const WebAuthnGetAssertionResult& aResult)
  {
    MOZ_ASSERT(NS_IsMainThread());
-diff --git a/dom/workers/ServiceWorkerRegistrar.cpp b/dom/workers/ServiceWorkerRegistrar.cpp
---- a/dom/workers/ServiceWorkerRegistrar.cpp
-+++ b/dom/workers/ServiceWorkerRegistrar.cpp
-@@ -1174,17 +1174,17 @@ ServiceWorkerRegistrar::GetShutdownPhase
-   // memory), and there's no point in continuing startup. Include as much
-   // information as possible in the crash report.
-   RELEASE_ASSERT_SUCCEEDED(rv, "async shutdown service");
- 
- 
-   nsCOMPtr<nsIAsyncShutdownClient> client;
-   rv = svc->GetProfileBeforeChange(getter_AddRefs(client));
-   RELEASE_ASSERT_SUCCEEDED(rv, "profileBeforeChange shutdown blocker");
--  return std::move(client);
-+  return client;
- }
- 
- #undef RELEASE_ASSERT_SUCCEEDED
- 
- void
- ServiceWorkerRegistrar::Shutdown()
- {
-   AssertIsOnBackgroundThread();
 diff --git a/editor/libeditor/HTMLAnonymousNodeEditor.cpp b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
 --- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
 +++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp

+ 951 - 951
mozilla-release/patches/1465585-3-std-62a1.patch

@@ -2,7 +2,7 @@
 # User Emilio Cobos Alvarez <emilio@crisal.io>
 # Date 1527707735 -7200
 # Node ID b54db66223586b4e04f5cb926fccdacf8a176b91
-# Parent  919c7003dd683c6a68b292c50f36af6b8ae78b64
+# Parent  3a90e5f2ced4661fc09496c916df4ea570033039
 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
 
 This was done automatically replacing:
@@ -1280,7 +1280,7 @@ diff --git a/devtools/shared/heapsnapshot/tests/gtest/DevTools.h b/devtools/shar
 diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
 --- a/docshell/base/nsDocShell.cpp
 +++ b/docshell/base/nsDocShell.cpp
-@@ -2877,17 +2877,17 @@ nsDocShell::MaybeCreateInitialClientSour
+@@ -2876,17 +2876,17 @@ nsDocShell::MaybeCreateInitialClientSour
  }
  
  Maybe<ClientInfo>
@@ -1299,7 +1299,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
  
    if (!doc || !doc->IsInitialDocument()) {
      return Maybe<ClientInfo>();
-@@ -5075,17 +5075,17 @@ nsDocShell::Reload(uint32_t aReloadFlags
+@@ -5074,17 +5074,17 @@ nsDocShell::Reload(uint32_t aReloadFlags
      // Stack variables to ensure changes to the member variables don't affect to
      // the call.
      nsCOMPtr<nsIURI> currentURI = mCurrentURI;
@@ -1318,7 +1318,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
                        referrerURI,
                        referrerPolicy,
                        triggeringPrincipal,
-@@ -11190,17 +11190,17 @@ nsDocShell::DoChannelLoad(nsIChannel* aC
+@@ -11189,17 +11189,17 @@ nsDocShell::DoChannelLoad(nsIChannel* aC
  
    // Since we are loading a document we need to make sure the proper reserved
    // and initial client data is stored on the nsILoadInfo.  The
@@ -1337,7 +1337,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
    NS_ENSURE_SUCCESS(rv, rv);
  
    // We're about to load a new page and it may take time before necko
-@@ -12376,17 +12376,17 @@ nsDocShell::LoadHistoryEntry(nsISHEntry*
+@@ -12375,17 +12375,17 @@ nsDocShell::LoadHistoryEntry(nsISHEntry*
      return NS_ERROR_FAILURE;
    }
  
@@ -1356,7 +1356,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
                      referrerURI,
                      referrerPolicy,
                      triggeringPrincipal,
-@@ -14174,17 +14174,17 @@ nsDocShell::NotifyJSRunToCompletionStart
+@@ -14173,17 +14173,17 @@ nsDocShell::NotifyJSRunToCompletionStart
                                           const uint32_t aLineNumber,
                                           JS::Handle<JS::Value> aAsyncStack,
                                           const char* aAsyncCause)
@@ -1375,7 +1375,7 @@ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
  
    mJSRunToCompletionDepth++;
  }
-@@ -14262,17 +14262,17 @@ nsDocShell::InFrameSwap()
+@@ -14261,17 +14261,17 @@ nsDocShell::InFrameSwap()
      shell = shell->GetParentDocshell();
    } while (shell);
    return false;
@@ -2923,7 +2923,7 @@ diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissi
 diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
 --- a/dom/base/nsContentUtils.cpp
 +++ b/dom/base/nsContentUtils.cpp
-@@ -548,17 +548,17 @@ StableStateEventTarget::IsOnCurrentThrea
+@@ -547,17 +547,17 @@ StableStateEventTarget::IsOnCurrentThrea
  }
  
  NS_IMETHODIMP
@@ -2942,7 +2942,7 @@ diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
  {
    return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
  }
-@@ -5883,25 +5883,25 @@ nsContentUtils::AddScriptRunner(nsIRunna
+@@ -5882,25 +5882,25 @@ nsContentUtils::AddScriptRunner(nsIRunna
    AddScriptRunner(runnable.forget());
  }
  
@@ -5292,7 +5292,7 @@ diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h
 diff --git a/dom/clients/api/Clients.cpp b/dom/clients/api/Clients.cpp
 --- a/dom/clients/api/Clients.cpp
 +++ b/dom/clients/api/Clients.cpp
-@@ -85,17 +85,17 @@ Clients::Get(const nsAString& aClientID,
+@@ -84,17 +84,17 @@ Clients::Get(const nsAString& aClientID,
  
    nsCOMPtr<nsIGlobalObject> global = mGlobal;
    nsCString scope = workerPrivate->ServiceWorkerScope();
@@ -5311,7 +5311,7 @@ diff --git a/dom/clients/api/Clients.cpp b/dom/clients/api/Clients.cpp
            ServiceWorkerManager::LocalizeAndReportToAllClients(
              scope, "ServiceWorkerGetClientStorageError", nsTArray<nsString>());
          });
-@@ -171,17 +171,17 @@ Clients::MatchAll(const ClientQueryOptio
+@@ -170,17 +170,17 @@ Clients::MatchAll(const ClientQueryOptio
        nsTArray<RefPtr<Client>> clientList;
        bool storageDenied = false;
        for (const ClientInfoAndState& value : aResult.get_ClientList().values()) {
@@ -17226,1133 +17226,1133 @@ diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp
        NS_ASSERTION(false, "cannot find directive to convert CSP to JSON");
    }
  }
-diff --git a/dom/smil/nsSMILAnimationFunction.cpp b/dom/smil/nsSMILAnimationFunction.cpp
---- a/dom/smil/nsSMILAnimationFunction.cpp
-+++ b/dom/smil/nsSMILAnimationFunction.cpp
-@@ -264,17 +264,17 @@ nsSMILAnimationFunction::ComposeResult(c
-       return;
+diff --git a/dom/serviceworkers/ServiceWorkerDescriptor.cpp b/dom/serviceworkers/ServiceWorkerDescriptor.cpp
+--- a/dom/serviceworkers/ServiceWorkerDescriptor.cpp
++++ b/dom/serviceworkers/ServiceWorkerDescriptor.cpp
+@@ -40,25 +40,25 @@ ServiceWorkerDescriptor&
+ ServiceWorkerDescriptor::operator=(const ServiceWorkerDescriptor& aRight)
+ {
+   mData.reset();
+   mData = MakeUnique<IPCServiceWorkerDescriptor>(*aRight.mData);
+   return *this;
+ }
  
-     if (NS_FAILED(AccumulateResult(values, result)))
-       return;
-   }
+ ServiceWorkerDescriptor::ServiceWorkerDescriptor(ServiceWorkerDescriptor&& aRight)
+-  : mData(Move(aRight.mData))
++  : mData(std::move(aRight.mData))
+ {
+ }
  
-   // If additive animation isn't required or isn't supported, set the value.
-   if (!isAdditive || NS_FAILED(aResult.SandwichAdd(result))) {
--    aResult = Move(result);
-+    aResult = std::move(result);
-   }
+ ServiceWorkerDescriptor&
+ ServiceWorkerDescriptor::operator=(ServiceWorkerDescriptor&& aRight)
+ {
+   mData.reset();
+-  mData = Move(aRight.mData);
++  mData = std::move(aRight.mData);
+   return *this;
  }
  
- int8_t
- nsSMILAnimationFunction::CompareTo(const nsSMILAnimationFunction* aOther) const
+ ServiceWorkerDescriptor::~ServiceWorkerDescriptor()
  {
-   NS_ENSURE_TRUE(aOther, 0);
+ }
  
-diff --git a/dom/smil/nsSMILCSSValueType.cpp b/dom/smil/nsSMILCSSValueType.cpp
---- a/dom/smil/nsSMILCSSValueType.cpp
-+++ b/dom/smil/nsSMILCSSValueType.cpp
-@@ -608,17 +608,17 @@ InterpolateForServo(const ValueWrapper* 
-       Servo_AnimationValues_Interpolate(*startValue,
-                                         *endValue,
-                                         aUnitDistance).Consume();
-     if (!result) {
-       return NS_ERROR_FAILURE;
-     }
-     results.AppendElement(result);
+ bool
+diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp
+--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
++++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
+@@ -230,17 +230,17 @@ class BodyCopyHandle final : public nsII
+   ~BodyCopyHandle()
+   {
    }
--  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, Move(results));
-+  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, std::move(results));
  
-   return NS_OK;
- }
+ public:
+   NS_DECL_THREADSAFE_ISUPPORTS
  
- nsresult
- nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
-                                 const nsSMILValue& aEndVal,
-                                 double aUnitDistance,
-@@ -800,17 +800,17 @@ nsSMILCSSValueType::ValueFromString(nsCS
-     if (aIsContextSensitive) {
-       // FIXME: Bug 1358955 - detect context-sensitive values and set this value
-       // appropriately.
-       *aIsContextSensitive = false;
-     }
+   explicit BodyCopyHandle(UniquePtr<RespondWithClosure>&& aClosure)
+-    : mClosure(Move(aClosure))
++    : mClosure(std::move(aClosure))
+   {
+   }
  
-     if (!parsedValues.IsEmpty()) {
-       sSingleton.Init(aValue);
--      aValue.mU.mPtr = new ValueWrapper(aPropID, Move(parsedValues));
-+      aValue.mU.mPtr = new ValueWrapper(aPropID, std::move(parsedValues));
-     }
-     return;
+   NS_IMETHOD
+   BodyComplete(nsresult aRv) override
+   {
+     MOZ_ASSERT(NS_IsMainThread());
+ 
+@@ -285,17 +285,17 @@ public:
+                 const nsACString& aResponseURLSpec,
+                 UniquePtr<RespondWithClosure>&& aClosure)
+     : Runnable("dom::StartResponse")
+     , mChannel(aChannel)
+     , mInternalResponse(aInternalResponse)
+     , mWorkerChannelInfo(aWorkerChannelInfo)
+     , mScriptSpec(aScriptSpec)
+     , mResponseURLSpec(aResponseURLSpec)
+-    , mClosure(Move(aClosure))
++    , mClosure(std::move(aClosure))
+   {
    }
  
- #ifdef MOZ_OLD_STYLE
-   StyleAnimationValue parsedValue;
-   if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
-                             styleContext->AsGecko(), aString, parsedValue,
-@@ -935,20 +935,20 @@ nsSMILCSSValueType::FinalizeValue(nsSMIL
-     zeroValues.SetCapacity(valueToMatchWrapper->mServoValues.Length());
+   NS_IMETHOD
+   Run() override
+   {
+     MOZ_ASSERT(NS_IsMainThread());
  
-     for (auto& valueToMatch : valueToMatchWrapper->mServoValues) {
-       RefPtr<RawServoAnimationValue> zeroValue =
-         Servo_AnimationValues_GetZeroValue(valueToMatch).Consume();
-       if (!zeroValue) {
-         return;
-       }
--      zeroValues.AppendElement(Move(zeroValue));
-+      zeroValues.AppendElement(std::move(zeroValue));
+@@ -359,17 +359,17 @@ public:
+     if (preferredAltDataType.Equals(altDataType)) {
+       body = mInternalResponse->TakeAlternativeBody();
      }
-     aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
--                                      Move(zeroValues));
-+                                      std::move(zeroValues));
-   } else {
- #ifdef MOZ_OLD_STYLE
-     const StyleAnimationValue* zeroValue =
-       GetZeroValueForUnit(valueToMatchWrapper->mGeckoValue.GetUnit());
-     if (!zeroValue) {
-       return;
+     if (!body) {
+       mInternalResponse->GetUnfilteredBody(getter_AddRefs(body));
      }
-     aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
-diff --git a/dom/smil/nsSMILCompositor.h b/dom/smil/nsSMILCompositor.h
---- a/dom/smil/nsSMILCompositor.h
-+++ b/dom/smil/nsSMILCompositor.h
-@@ -30,18 +30,18 @@ public:
-   typedef const KeyType& KeyTypeRef;
-   typedef const KeyType* KeyTypePointer;
  
-   explicit nsSMILCompositor(KeyTypePointer aKey)
-    : mKey(*aKey),
-      mForceCompositing(false)
-   { }
-   nsSMILCompositor(nsSMILCompositor&& toMove)
--    : mKey(mozilla::Move(toMove.mKey)),
--      mAnimationFunctions(mozilla::Move(toMove.mAnimationFunctions)),
-+    : mKey(std::move(toMove.mKey)),
-+      mAnimationFunctions(std::move(toMove.mAnimationFunctions)),
-       mForceCompositing(false)
-   { }
-   ~nsSMILCompositor() { }
+     RefPtr<BodyCopyHandle> copyHandle;
+-    copyHandle = new BodyCopyHandle(Move(mClosure));
++    copyHandle = new BodyCopyHandle(std::move(mClosure));
  
-   // PLDHashEntryHdr methods
-   KeyTypeRef GetKey() const { return mKey; }
-   bool KeyEquals(KeyTypePointer aKey) const;
-   static KeyTypePointer KeyToPointer(KeyTypeRef aKey) { return &aKey; }
-@@ -64,17 +64,17 @@ public:
-   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
+     rv = mChannel->StartSynthesizedResponse(body, copyHandle, cacheInfoChannel,
+                                             mResponseURLSpec,
+                                             mInternalResponse->IsRedirected());
+     if (NS_WARN_IF(NS_FAILED(rv))) {
+       mChannel->CancelInterception(NS_ERROR_INTERCEPTION_FAILED);
+       return NS_OK;
+     }
+@@ -735,17 +735,17 @@ RespondWithHandler::ResolvedCallback(JSC
+                                                                mRespondWithLineNumber,
+                                                                mRespondWithColumnNumber));
  
-   // Toggles a bit that will force us to composite (bypassing early-return
-   // optimizations) when we hit ComposeAttribute.
-   void ToggleForceCompositing() { mForceCompositing = true; }
+   nsCOMPtr<nsIRunnable> startRunnable = new StartResponse(mInterceptedChannel,
+                                                           ir,
+                                                           worker->GetChannelInfo(),
+                                                           mScriptSpec,
+                                                           responseURL,
+-                                                          Move(closure));
++                                                          std::move(closure));
  
-   // Transfers |aOther|'s mCachedBaseValue to |this|
-   void StealCachedBaseValue(nsSMILCompositor* aOther) {
--    mCachedBaseValue = mozilla::Move(aOther->mCachedBaseValue);
-+    mCachedBaseValue = std::move(aOther->mCachedBaseValue);
+   nsCOMPtr<nsIInputStream> body;
+   ir->GetUnfilteredBody(getter_AddRefs(body));
+   // Errors and redirects may not have a body.
+   if (body) {
+     ErrorResult error;
+     response->SetBodyUsed(aCx, error);
+     if (NS_WARN_IF(error.Failed())) {
+@@ -1067,17 +1067,17 @@ ExtractBytesFromData(const OwningArrayBu
    }
+   NS_NOTREACHED("Unexpected push message data");
+   return NS_ERROR_FAILURE;
+ }
+ }
  
-  private:
-   // Create a nsISMILAttr for my target, on the heap.
-   //
-   // @param aBaseStyleContext  An optional style context which, if set, will be
-   //                           used when fetching the base style.
-   mozilla::UniquePtr<nsISMILAttr>
-diff --git a/dom/smil/nsSMILTimedElement.h b/dom/smil/nsSMILTimedElement.h
---- a/dom/smil/nsSMILTimedElement.h
-+++ b/dom/smil/nsSMILTimedElement.h
-@@ -552,17 +552,17 @@ protected:
+ PushMessageData::PushMessageData(nsISupports* aOwner,
+                                  nsTArray<uint8_t>&& aBytes)
+-  : mOwner(aOwner), mBytes(Move(aBytes)) {}
++  : mOwner(aOwner), mBytes(std::move(aBytes)) {}
  
-   // Reset the current interval by first passing ownership to a temporary
-   // variable so that if Unlink() results in us receiving a callback,
-   // mCurrentInterval will be nullptr and we will be in a consistent state.
-   void ResetCurrentInterval()
-   {
-     if (mCurrentInterval) {
-       // Transfer ownership to temp var. (This sets mCurrentInterval to null.)
--      nsAutoPtr<nsSMILInterval> interval(mozilla::Move(mCurrentInterval));
-+      nsAutoPtr<nsSMILInterval> interval(std::move(mCurrentInterval));
-       interval->Unlink();
+ PushMessageData::~PushMessageData()
+ {
+ }
+ 
+ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PushMessageData, mOwner)
+ 
+ NS_IMPL_CYCLE_COLLECTING_ADDREF(PushMessageData)
+@@ -1186,17 +1186,17 @@ PushEvent::Constructor(mozilla::dom::Eve
+   e->SetComposed(aOptions.mComposed);
+   if(aOptions.mData.WasPassed()){
+     nsTArray<uint8_t> bytes;
+     nsresult rv = ExtractBytesFromData(aOptions.mData.Value(), bytes);
+     if (NS_FAILED(rv)) {
+       aRv.Throw(rv);
+       return nullptr;
      }
+-    e->mData = new PushMessageData(aOwner, Move(bytes));
++    e->mData = new PushMessageData(aOwner, std::move(bytes));
    }
+   return e.forget();
+ }
  
-   //
-   // Members
-   //
-   mozilla::dom::SVGAnimationElement* mAnimationElement; // [weak] won't outlive
-diff --git a/dom/svg/SVGAnimatedLengthList.cpp b/dom/svg/SVGAnimatedLengthList.cpp
---- a/dom/svg/SVGAnimatedLengthList.cpp
-+++ b/dom/svg/SVGAnimatedLengthList.cpp
-@@ -136,17 +136,17 @@ SVGAnimatedLengthList::
-                                nsSMILValue& aValue,
-                                bool& aPreventCachingOfSandwich) const
- {
-   nsSMILValue val(&SVGLengthListSMILType::sSingleton);
-   SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo*>(val.mU.mPtr);
-   nsresult rv = llai->SetValueFromString(aStr);
-   if (NS_SUCCEEDED(rv)) {
-     llai->SetInfo(mElement, mAxis, mCanZeroPadList);
--    aValue = Move(val);
-+    aValue = std::move(val);
+ NS_IMPL_ADDREF_INHERITED(PushEvent, ExtendableEvent)
+ NS_IMPL_RELEASE_INHERITED(PushEvent, ExtendableEvent)
  
-     // If any of the lengths in the list depend on their context, then we must
-     // prevent caching of the entire animation sandwich. This is because the
-     // units of a length at a given index can change from sandwich layer to
-     // layer, and indeed even be different within a single sandwich layer. If
-     // any length in the result of an animation sandwich is the result of the
-     // addition of lengths where one or more of those lengths is context
-     // dependent, then naturally the resultant length is also context
-@@ -179,17 +179,17 @@ SVGAnimatedLengthList::SMILAnimatedLengt
-   // from ALL return points. This function must only return THIS variable:
-   nsSMILValue val;
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushEvent)
+diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp
+--- a/dom/serviceworkers/ServiceWorkerManager.cpp
++++ b/dom/serviceworkers/ServiceWorkerManager.cpp
+@@ -320,51 +320,51 @@ ServiceWorkerManager::StartControllingCl
+   const ServiceWorkerDescriptor& active =
+     aRegistrationInfo->GetActive()->Descriptor();
  
-   nsSMILValue tmp(&SVGLengthListSMILType::sSingleton);
-   SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo*>(tmp.mU.mPtr);
-   nsresult rv = llai->CopyFrom(mVal->mBaseVal);
-   if (NS_SUCCEEDED(rv)) {
-     llai->SetInfo(mElement, mAxis, mCanZeroPadList);
--    val = Move(tmp);
-+    val = std::move(tmp);
-   }
-   return val;
- }
+   auto entry = mControlledClients.LookupForAdd(aClientInfo.Id());
+   if (entry) {
+     RefPtr<ServiceWorkerRegistrationInfo> old =
+       entry.Data()->mRegistrationInfo.forget();
  
- nsresult
- SVGAnimatedLengthList::SMILAnimatedLengthList::SetAnimValue(const nsSMILValue& aValue)
- {
-   NS_ASSERTION(aValue.mType == &SVGLengthListSMILType::sSingleton,
-diff --git a/dom/svg/SVGAnimatedNumberList.cpp b/dom/svg/SVGAnimatedNumberList.cpp
---- a/dom/svg/SVGAnimatedNumberList.cpp
-+++ b/dom/svg/SVGAnimatedNumberList.cpp
-@@ -135,17 +135,17 @@ SVGAnimatedNumberList::
-                                nsSMILValue& aValue,
-                                bool& aPreventCachingOfSandwich) const
- {
-   nsSMILValue val(&SVGNumberListSMILType::sSingleton);
-   SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo*>(val.mU.mPtr);
-   nsresult rv = nlai->SetValueFromString(aStr);
-   if (NS_SUCCEEDED(rv)) {
-     nlai->SetInfo(mElement);
--    aValue = Move(val);
-+    aValue = std::move(val);
-   }
-   aPreventCachingOfSandwich = false;
-   return rv;
- }
+-    ref = Move(entry.Data()->mClientHandle->Control(active));
++    ref = std::move(entry.Data()->mClientHandle->Control(active));
+     entry.Data()->mRegistrationInfo = aRegistrationInfo;
  
- nsSMILValue
- SVGAnimatedNumberList::SMILAnimatedNumberList::GetBaseValue() const
- {
-diff --git a/dom/svg/SVGAnimatedPathSegList.cpp b/dom/svg/SVGAnimatedPathSegList.cpp
---- a/dom/svg/SVGAnimatedPathSegList.cpp
-+++ b/dom/svg/SVGAnimatedPathSegList.cpp
-@@ -163,17 +163,17 @@ SVGAnimatedPathSegList::
-                                nsSMILValue& aValue,
-                                bool& aPreventCachingOfSandwich) const
- {
-   nsSMILValue val(SVGPathSegListSMILType::Singleton());
-   SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo*>(val.mU.mPtr);
-   nsresult rv = list->SetValueFromString(aStr);
-   if (NS_SUCCEEDED(rv)) {
-     list->SetElement(mElement);
--    aValue = Move(val);
-+    aValue = std::move(val);
+     if (old != aRegistrationInfo) {
+       StopControllingRegistration(old);
+       aRegistrationInfo->StartControllingClient();
+     }
+ 
+     Telemetry::Accumulate(Telemetry::SERVICE_WORKER_CONTROLLED_DOCUMENTS, 1);
+ 
+-    return Move(ref);
++    return std::move(ref);
    }
-   aPreventCachingOfSandwich = false;
-   return rv;
+ 
+   RefPtr<ClientHandle> clientHandle =
+     ClientManager::CreateHandle(aClientInfo,
+                                 SystemGroup::EventTargetFor(TaskCategory::Other));
+ 
+-  ref = Move(clientHandle->Control(active));
++  ref = std::move(clientHandle->Control(active));
+ 
+   aRegistrationInfo->StartControllingClient();
+ 
+   entry.OrInsert([&] {
+     return new ControlledClientData(clientHandle, aRegistrationInfo);
+   });
+ 
+   RefPtr<ServiceWorkerManager> self(this);
+   clientHandle->OnDetach()->Then(
+     SystemGroup::EventTargetFor(TaskCategory::Other), __func__,
+-    [self = Move(self), aClientInfo] {
++    [self = std::move(self), aClientInfo] {
+       self->StopControllingClient(aClientInfo);
+     });
+ 
+   Telemetry::Accumulate(Telemetry::SERVICE_WORKER_CONTROLLED_DOCUMENTS, 1);
+ 
+-  return Move(ref);
++  return std::move(ref);
  }
  
- nsSMILValue
- SVGAnimatedPathSegList::SMILAnimatedPathSegList::GetBaseValue() const
+ void
+ ServiceWorkerManager::StopControllingClient(const ClientInfo& aClientInfo)
  {
-@@ -182,17 +182,17 @@ SVGAnimatedPathSegList::SMILAnimatedPath
-   // from ALL return points. This function must only return THIS variable:
-   nsSMILValue val;
+   auto entry = mControlledClients.Lookup(aClientInfo.Id());
+   if (!entry) {
+     return;
+diff --git a/dom/serviceworkers/ServiceWorkerRegistrar.cpp b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+--- a/dom/serviceworkers/ServiceWorkerRegistrar.cpp
++++ b/dom/serviceworkers/ServiceWorkerRegistrar.cpp
+@@ -1174,17 +1174,17 @@ ServiceWorkerRegistrar::GetShutdownPhase
+   // memory), and there's no point in continuing startup. Include as much
+   // information as possible in the crash report.
+   RELEASE_ASSERT_SUCCEEDED(rv, "async shutdown service");
  
-   nsSMILValue tmp(SVGPathSegListSMILType::Singleton());
-   SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo*>(tmp.mU.mPtr);
-   nsresult rv = list->CopyFrom(mVal->mBaseVal);
-   if (NS_SUCCEEDED(rv)) {
-     list->SetElement(mElement);
--    val = Move(tmp);
-+    val = std::move(tmp);
-   }
-   return val;
+ 
+   nsCOMPtr<nsIAsyncShutdownClient> client;
+   rv = svc->GetProfileBeforeChange(getter_AddRefs(client));
+   RELEASE_ASSERT_SUCCEEDED(rv, "profileBeforeChange shutdown blocker");
+-  return Move(client);
++  return std::move(client);
  }
  
- nsresult
- SVGAnimatedPathSegList::SMILAnimatedPathSegList::SetAnimValue(const nsSMILValue& aValue)
- {
-   NS_ASSERTION(aValue.mType == SVGPathSegListSMILType::Singleton(),
-diff --git a/dom/svg/SVGAnimatedPointList.cpp b/dom/svg/SVGAnimatedPointList.cpp
---- a/dom/svg/SVGAnimatedPointList.cpp
-+++ b/dom/svg/SVGAnimatedPointList.cpp
-@@ -160,17 +160,17 @@ SVGAnimatedPointList::
-                                nsSMILValue& aValue,
-                                bool& aPreventCachingOfSandwich) const
+ #undef RELEASE_ASSERT_SUCCEEDED
+ 
+ void
+ ServiceWorkerRegistrar::Shutdown()
  {
-   nsSMILValue val(&SVGPointListSMILType::sSingleton);
-   SVGPointListAndInfo *list = static_cast<SVGPointListAndInfo*>(val.mU.mPtr);
-   nsresult rv = list->SetValueFromString(aStr);
-   if (NS_SUCCEEDED(rv)) {
-     list->SetInfo(mElement);
--    aValue = Move(val);
-+    aValue = std::move(val);
+   AssertIsOnBackgroundThread();
+diff --git a/dom/serviceworkers/ServiceWorkerScriptCache.cpp b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+--- a/dom/serviceworkers/ServiceWorkerScriptCache.cpp
++++ b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
+@@ -151,17 +151,17 @@ public:
+   {
+     RefPtr<InternalHeaders> internalHeaders = mInternalHeaders;
+     return internalHeaders.forget();
    }
-   aPreventCachingOfSandwich = false;
-   return rv;
- }
  
- nsSMILValue
- SVGAnimatedPointList::SMILAnimatedPointList::GetBaseValue() const
- {
-diff --git a/dom/svg/SVGElementFactory.cpp b/dom/svg/SVGElementFactory.cpp
---- a/dom/svg/SVGElementFactory.cpp
-+++ b/dom/svg/SVGElementFactory.cpp
-@@ -27,17 +27,17 @@ static PLHashTable* sTagAtomTable = null
-     nsIContent** aResult,                                                      \
-     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);                     \
-                                                                                \
-   nsresult NS_NewSVG##_classname##Element(                                     \
-     nsIContent** aResult,                                                      \
-     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,                      \
-     FromParser aFromParser)                                                    \
-   {                                                                            \
--    return NS_NewSVG##_classname##Element(aResult, mozilla::Move(aNodeInfo));  \
-+    return NS_NewSVG##_classname##Element(aResult, std::move(aNodeInfo));  \
+   UniquePtr<PrincipalInfo>
+   TakePrincipalInfo()
+   {
+-    return Move(mPrincipalInfo);
++    return std::move(mPrincipalInfo);
    }
  
- #define SVG_FROM_PARSER_TAG(_tag, _classname)
+   bool
+   Succeeded() const
+   {
+     return NS_SUCCEEDED(mNetworkResult);
+   }
  
- #include "SVGTagList.h"
- #undef SVG_TAG
- #undef SVG_FROM_PARSER_TAG
+@@ -610,17 +610,17 @@ private:
+     RefPtr<InternalResponse> ir =
+       new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
+     ir->SetBody(body, aCN->Buffer().Length());
+     ir->SetURLList(aCN->URLList());
  
-diff --git a/dom/svg/nsSVGAngle.cpp b/dom/svg/nsSVGAngle.cpp
---- a/dom/svg/nsSVGAngle.cpp
-+++ b/dom/svg/nsSVGAngle.cpp
-@@ -374,17 +374,17 @@ nsSVGAngle::SMILOrient::ValueFromString(
-     uint16_t unitType;
-     if (!GetValueFromString(aStr, value, &unitType)) {
-       return NS_ERROR_DOM_SYNTAX_ERR;
+     ir->InitChannelInfo(aCN->GetChannelInfo());
+     UniquePtr<PrincipalInfo> principalInfo = aCN->TakePrincipalInfo();
+     if (principalInfo) {
+-      ir->SetPrincipalInfo(Move(principalInfo));
++      ir->SetPrincipalInfo(std::move(principalInfo));
      }
-     val.mU.mOrient.mAngle = value;
-     val.mU.mOrient.mUnit = unitType;
-     val.mU.mOrient.mOrientType = SVG_MARKER_ORIENT_ANGLE;
+ 
+     RefPtr<InternalHeaders> internalHeaders = aCN->GetInternalHeaders();
+     ir->Headers()->Fill(*(internalHeaders.get()), IgnoreErrors());
+ 
+     RefPtr<Response> response =
+       new Response(aCache->GetGlobalObject(), ir, nullptr);
+ 
+@@ -917,17 +917,17 @@ CompareNetwork::SetPrincipalInfo(nsIChan
+ 
+   UniquePtr<PrincipalInfo> principalInfo = MakeUnique<PrincipalInfo>();
+   rv = PrincipalToPrincipalInfo(channelPrincipal, principalInfo.get());
+ 
+   if (NS_WARN_IF(NS_FAILED(rv))) {
+     return rv;
    }
--  aValue = Move(val);
-+  aValue = std::move(val);
-   aPreventCachingOfSandwich = false;
  
+-  mPrincipalInfo = Move(principalInfo);
++  mPrincipalInfo = std::move(principalInfo);
    return NS_OK;
  }
  
- nsSMILValue
- nsSVGAngle::SMILOrient::GetBaseValue() const
+ NS_IMETHODIMP
+ CompareNetwork::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
+                               nsresult aStatusCode)
  {
-diff --git a/dom/svg/nsSVGAnimatedTransformList.cpp b/dom/svg/nsSVGAnimatedTransformList.cpp
---- a/dom/svg/nsSVGAnimatedTransformList.cpp
-+++ b/dom/svg/nsSVGAnimatedTransformList.cpp
-@@ -256,17 +256,17 @@ nsSVGAnimatedTransformList::SMILAnimated
+   // Nothing to do here!
+diff --git a/dom/smil/nsSMILAnimationFunction.cpp b/dom/smil/nsSMILAnimationFunction.cpp
+--- a/dom/smil/nsSMILAnimationFunction.cpp
++++ b/dom/smil/nsSMILAnimationFunction.cpp
+@@ -264,17 +264,17 @@ nsSMILAnimationFunction::ComposeResult(c
+       return;
  
-   nsSMILValue val(SVGTransformListSMILType::Singleton());
-   SVGTransformSMILData transform(transformType, params);
-   if (NS_FAILED(SVGTransformListSMILType::AppendTransform(transform, val))) {
-     return; // OOM
+     if (NS_FAILED(AccumulateResult(values, result)))
+       return;
    }
  
-   // Success! Populate our outparam with parsed value.
--  aResult = Move(val);
-+  aResult = std::move(val);
+   // If additive animation isn't required or isn't supported, set the value.
+   if (!isAdditive || NS_FAILED(aResult.SandwichAdd(result))) {
+-    aResult = Move(result);
++    aResult = std::move(result);
+   }
  }
  
- int32_t
- nsSVGAnimatedTransformList::SMILAnimatedTransformList::ParseParameterList(
-   const nsAString& aSpec,
-   float* aVars,
-   int32_t aNVars)
- {
-diff --git a/dom/svg/nsSVGClass.cpp b/dom/svg/nsSVGClass.cpp
---- a/dom/svg/nsSVGClass.cpp
-+++ b/dom/svg/nsSVGClass.cpp
-@@ -127,17 +127,17 @@ nsresult
- nsSVGClass::SMILString::ValueFromString(const nsAString& aStr,
-                                         const dom::SVGAnimationElement* /*aSrcElement*/,
-                                         nsSMILValue& aValue,
-                                         bool& aPreventCachingOfSandwich) const
- {
-   nsSMILValue val(SMILStringType::Singleton());
- 
-   *static_cast<nsAString*>(val.mU.mPtr) = aStr;
--  aValue = Move(val);
-+  aValue = std::move(val);
-   aPreventCachingOfSandwich = false;
-   return NS_OK;
- }
- 
- nsSMILValue
- nsSVGClass::SMILString::GetBaseValue() const
- {
-   nsSMILValue val(SMILStringType::Singleton());
-diff --git a/dom/svg/nsSVGString.cpp b/dom/svg/nsSVGString.cpp
---- a/dom/svg/nsSVGString.cpp
-+++ b/dom/svg/nsSVGString.cpp
-@@ -107,17 +107,17 @@ nsresult
- nsSVGString::SMILString::ValueFromString(const nsAString& aStr,
-                                          const dom::SVGAnimationElement* /*aSrcElement*/,
-                                          nsSMILValue& aValue,
-                                          bool& aPreventCachingOfSandwich) const
+ int8_t
+ nsSMILAnimationFunction::CompareTo(const nsSMILAnimationFunction* aOther) const
  {
-   nsSMILValue val(SMILStringType::Singleton());
- 
-   *static_cast<nsAString*>(val.mU.mPtr) = aStr;
--  aValue = Move(val);
-+  aValue = std::move(val);
-   aPreventCachingOfSandwich = false;
-   return NS_OK;
- }
+   NS_ENSURE_TRUE(aOther, 0);
  
- nsSMILValue
- nsSVGString::SMILString::GetBaseValue() const
- {
-   nsSMILValue val(SMILStringType::Singleton());
-diff --git a/dom/svg/nsSVGViewBox.cpp b/dom/svg/nsSVGViewBox.cpp
---- a/dom/svg/nsSVGViewBox.cpp
-+++ b/dom/svg/nsSVGViewBox.cpp
-@@ -318,17 +318,17 @@ nsSVGViewBox::SMILViewBox
- {
-   nsSVGViewBoxRect viewBox;
-   nsresult res = nsSVGViewBoxRect::FromString(aStr, &viewBox);
-   if (NS_FAILED(res)) {
-     return res;
+diff --git a/dom/smil/nsSMILCSSValueType.cpp b/dom/smil/nsSMILCSSValueType.cpp
+--- a/dom/smil/nsSMILCSSValueType.cpp
++++ b/dom/smil/nsSMILCSSValueType.cpp
+@@ -608,17 +608,17 @@ InterpolateForServo(const ValueWrapper* 
+       Servo_AnimationValues_Interpolate(*startValue,
+                                         *endValue,
+                                         aUnitDistance).Consume();
+     if (!result) {
+       return NS_ERROR_FAILURE;
+     }
+     results.AppendElement(result);
    }
-   nsSMILValue val(&SVGViewBoxSMILType::sSingleton);
-   *static_cast<nsSVGViewBoxRect*>(val.mU.mPtr) = viewBox;
--  aValue = Move(val);
-+  aValue = std::move(val);
-   aPreventCachingOfSandwich = false;
+-  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, Move(results));
++  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, std::move(results));
  
    return NS_OK;
  }
  
- nsSMILValue
- nsSVGViewBox::SMILViewBox::GetBaseValue() const
- {
-diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp
---- a/dom/system/OSFileConstants.cpp
-+++ b/dom/system/OSFileConstants.cpp
-@@ -298,17 +298,17 @@ OSFileConstantsService::InitOSFileConsta
- #endif // defined(XP_WIN)
- 
- #if defined(XP_MACOSX)
-   GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
-   GetPathToSpecialDir(NS_OSX_LOCAL_APPLICATIONS_DIR, paths->macLocalApplicationsDir);
-   GetPathToSpecialDir(NS_MAC_TRASH_DIR, paths->macTrashDir);
- #endif // defined(XP_MACOSX)
- 
--  mPaths = Move(paths);
-+  mPaths = std::move(paths);
- 
-   // Get the umask from the system-info service.
-   // The property will always be present, but it will be zero on
-   // non-Unix systems.
-   // nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM2 so we don't need
-   // to initialize the service.
-   mUserUmask = nsSystemInfo::gUserUmask;
- 
-diff --git a/dom/u2f/U2F.cpp b/dom/u2f/U2F.cpp
---- a/dom/u2f/U2F.cpp
-+++ b/dom/u2f/U2F.cpp
-@@ -345,17 +345,17 @@ U2F::Register(const nsAString& aAppId,
-   WebAuthnMakeCredentialInfo info(rpIdHash,
-                                   clientDataHash,
-                                   adjustedTimeoutMillis,
-                                   excludeList,
-                                   extensions,
-                                   authSelection);
- 
-   MOZ_ASSERT(mTransaction.isNothing());
--  mTransaction = Some(U2FTransaction(clientData, Move(AsVariant(callback))));
-+  mTransaction = Some(U2FTransaction(clientData, std::move(AsVariant(callback))));
-   mChild->SendRequestRegister(mTransaction.ref().mId, info);
- }
- 
- void
- U2F::FinishMakeCredential(const uint64_t& aTransactionId,
-                           const WebAuthnMakeCredentialResult& aResult)
- {
-   MOZ_ASSERT(NS_IsMainThread());
-@@ -486,17 +486,17 @@ U2F::Sign(const nsAString& aAppId,
-   WebAuthnGetAssertionInfo info(rpIdHash,
-                                 clientDataHash,
-                                 adjustedTimeoutMillis,
-                                 permittedList,
-                                 false, /* requireUserVerification */
-                                 extensions);
- 
-   MOZ_ASSERT(mTransaction.isNothing());
--  mTransaction = Some(U2FTransaction(clientData, Move(AsVariant(callback))));
-+  mTransaction = Some(U2FTransaction(clientData, std::move(AsVariant(callback))));
-   mChild->SendRequestSign(mTransaction.ref().mId, info);
- }
+ nsresult
+ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
+                                 const nsSMILValue& aEndVal,
+                                 double aUnitDistance,
+@@ -800,17 +800,17 @@ nsSMILCSSValueType::ValueFromString(nsCS
+     if (aIsContextSensitive) {
+       // FIXME: Bug 1358955 - detect context-sensitive values and set this value
+       // appropriately.
+       *aIsContextSensitive = false;
+     }
  
- void
- U2F::FinishGetAssertion(const uint64_t& aTransactionId,
-                         const WebAuthnGetAssertionResult& aResult)
- {
-   MOZ_ASSERT(NS_IsMainThread());
-@@ -573,17 +573,17 @@ U2F::RejectTransaction(const nsresult& a
-   if (NS_WARN_IF(mTransaction.isNothing())) {
+     if (!parsedValues.IsEmpty()) {
+       sSingleton.Init(aValue);
+-      aValue.mU.mPtr = new ValueWrapper(aPropID, Move(parsedValues));
++      aValue.mU.mPtr = new ValueWrapper(aPropID, std::move(parsedValues));
+     }
      return;
    }
  
-   StopListeningForVisibilityEvents();
- 
-   // Clear out mTransaction before calling ExecuteCallback() below to allow
-   // reentrancy from microtask checkpoints.
--  Maybe<U2FTransaction> maybeTransaction(Move(mTransaction));
-+  Maybe<U2FTransaction> maybeTransaction(std::move(mTransaction));
-   MOZ_ASSERT(mTransaction.isNothing() && maybeTransaction.isSome());
+ #ifdef MOZ_OLD_STYLE
+   StyleAnimationValue parsedValue;
+   if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
+                             styleContext->AsGecko(), aString, parsedValue,
+@@ -935,20 +935,20 @@ nsSMILCSSValueType::FinalizeValue(nsSMIL
+     zeroValues.SetCapacity(valueToMatchWrapper->mServoValues.Length());
  
-   U2FTransaction& transaction = maybeTransaction.ref();
-   ErrorCode code = ConvertNSResultToErrorCode(aError);
+     for (auto& valueToMatch : valueToMatchWrapper->mServoValues) {
+       RefPtr<RawServoAnimationValue> zeroValue =
+         Servo_AnimationValues_GetZeroValue(valueToMatch).Consume();
+       if (!zeroValue) {
+         return;
+       }
+-      zeroValues.AppendElement(Move(zeroValue));
++      zeroValues.AppendElement(std::move(zeroValue));
+     }
+     aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
+-                                      Move(zeroValues));
++                                      std::move(zeroValues));
+   } else {
+ #ifdef MOZ_OLD_STYLE
+     const StyleAnimationValue* zeroValue =
+       GetZeroValueForUnit(valueToMatchWrapper->mGeckoValue.GetUnit());
+     if (!zeroValue) {
+       return;
+     }
+     aValue.mU.mPtr = new ValueWrapper(valueToMatchWrapper->mPropID,
+diff --git a/dom/smil/nsSMILCompositor.h b/dom/smil/nsSMILCompositor.h
+--- a/dom/smil/nsSMILCompositor.h
++++ b/dom/smil/nsSMILCompositor.h
+@@ -30,18 +30,18 @@ public:
+   typedef const KeyType& KeyTypeRef;
+   typedef const KeyType* KeyTypePointer;
  
-   if (transaction.HasRegisterCallback()) {
-     RegisterResponse response;
-     response.mErrorCode.Construct(static_cast<uint32_t>(code));
-diff --git a/dom/u2f/U2F.h b/dom/u2f/U2F.h
---- a/dom/u2f/U2F.h
-+++ b/dom/u2f/U2F.h
-@@ -36,17 +36,17 @@ class U2FTransaction
- {
-   typedef Variant<nsMainThreadPtrHandle<U2FRegisterCallback>,
-                   nsMainThreadPtrHandle<U2FSignCallback>> U2FCallback;
+   explicit nsSMILCompositor(KeyTypePointer aKey)
+    : mKey(*aKey),
+      mForceCompositing(false)
+   { }
+   nsSMILCompositor(nsSMILCompositor&& toMove)
+-    : mKey(mozilla::Move(toMove.mKey)),
+-      mAnimationFunctions(mozilla::Move(toMove.mAnimationFunctions)),
++    : mKey(std::move(toMove.mKey)),
++      mAnimationFunctions(std::move(toMove.mAnimationFunctions)),
+       mForceCompositing(false)
+   { }
+   ~nsSMILCompositor() { }
  
- public:
-   explicit U2FTransaction(const nsCString& aClientData,
-                           const U2FCallback&& aCallback)
-     : mClientData(aClientData)
--    , mCallback(Move(aCallback))
-+    , mCallback(std::move(aCallback))
-     , mId(NextId())
-   {
-     MOZ_ASSERT(mId > 0);
-   }
+   // PLDHashEntryHdr methods
+   KeyTypeRef GetKey() const { return mKey; }
+   bool KeyEquals(KeyTypePointer aKey) const;
+   static KeyTypePointer KeyToPointer(KeyTypeRef aKey) { return &aKey; }
+@@ -64,17 +64,17 @@ public:
+   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
  
-   bool HasRegisterCallback() {
-     return mCallback.is<nsMainThreadPtrHandle<U2FRegisterCallback>>();
-   }
-diff --git a/dom/webauthn/U2FHIDTokenManager.cpp b/dom/webauthn/U2FHIDTokenManager.cpp
---- a/dom/webauthn/U2FHIDTokenManager.cpp
-+++ b/dom/webauthn/U2FHIDTokenManager.cpp
-@@ -22,17 +22,17 @@ u2f_register_callback(uint64_t aTransact
+   // Toggles a bit that will force us to composite (bypassing early-return
+   // optimizations) when we hit ComposeAttribute.
+   void ToggleForceCompositing() { mForceCompositing = true; }
  
-   StaticMutexAutoLock lock(gInstanceMutex);
-   if (!gInstance || NS_WARN_IF(!gPBackgroundThread)) {
-     return;
+   // Transfers |aOther|'s mCachedBaseValue to |this|
+   void StealCachedBaseValue(nsSMILCompositor* aOther) {
+-    mCachedBaseValue = mozilla::Move(aOther->mCachedBaseValue);
++    mCachedBaseValue = std::move(aOther->mCachedBaseValue);
    }
  
-   nsCOMPtr<nsIRunnable> r(NewRunnableMethod<UniquePtr<U2FResult>&&>(
-       "U2FHIDTokenManager::HandleRegisterResult", gInstance,
--      &U2FHIDTokenManager::HandleRegisterResult, Move(rv)));
-+      &U2FHIDTokenManager::HandleRegisterResult, std::move(rv)));
+  private:
+   // Create a nsISMILAttr for my target, on the heap.
+   //
+   // @param aBaseStyleContext  An optional style context which, if set, will be
+   //                           used when fetching the base style.
+   mozilla::UniquePtr<nsISMILAttr>
+diff --git a/dom/smil/nsSMILTimedElement.h b/dom/smil/nsSMILTimedElement.h
+--- a/dom/smil/nsSMILTimedElement.h
++++ b/dom/smil/nsSMILTimedElement.h
+@@ -552,17 +552,17 @@ protected:
  
-   MOZ_ALWAYS_SUCCEEDS(gPBackgroundThread->Dispatch(r.forget(),
-                                                    NS_DISPATCH_NORMAL));
- }
+   // Reset the current interval by first passing ownership to a temporary
+   // variable so that if Unlink() results in us receiving a callback,
+   // mCurrentInterval will be nullptr and we will be in a consistent state.
+   void ResetCurrentInterval()
+   {
+     if (mCurrentInterval) {
+       // Transfer ownership to temp var. (This sets mCurrentInterval to null.)
+-      nsAutoPtr<nsSMILInterval> interval(mozilla::Move(mCurrentInterval));
++      nsAutoPtr<nsSMILInterval> interval(std::move(mCurrentInterval));
+       interval->Unlink();
+     }
+   }
  
- static void
- u2f_sign_callback(uint64_t aTransactionId, rust_u2f_result* aResult)
+   //
+   // Members
+   //
+   mozilla::dom::SVGAnimationElement* mAnimationElement; // [weak] won't outlive
+diff --git a/dom/svg/SVGAnimatedLengthList.cpp b/dom/svg/SVGAnimatedLengthList.cpp
+--- a/dom/svg/SVGAnimatedLengthList.cpp
++++ b/dom/svg/SVGAnimatedLengthList.cpp
+@@ -136,17 +136,17 @@ SVGAnimatedLengthList::
+                                nsSMILValue& aValue,
+                                bool& aPreventCachingOfSandwich) const
  {
-@@ -40,17 +40,17 @@ u2f_sign_callback(uint64_t aTransactionI
- 
-   StaticMutexAutoLock lock(gInstanceMutex);
-   if (!gInstance || NS_WARN_IF(!gPBackgroundThread)) {
-     return;
-   }
+   nsSMILValue val(&SVGLengthListSMILType::sSingleton);
+   SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo*>(val.mU.mPtr);
+   nsresult rv = llai->SetValueFromString(aStr);
+   if (NS_SUCCEEDED(rv)) {
+     llai->SetInfo(mElement, mAxis, mCanZeroPadList);
+-    aValue = Move(val);
++    aValue = std::move(val);
  
-   nsCOMPtr<nsIRunnable> r(NewRunnableMethod<UniquePtr<U2FResult>&&>(
-       "U2FHIDTokenManager::HandleSignResult", gInstance,
--      &U2FHIDTokenManager::HandleSignResult, Move(rv)));
-+      &U2FHIDTokenManager::HandleSignResult, std::move(rv)));
+     // If any of the lengths in the list depend on their context, then we must
+     // prevent caching of the entire animation sandwich. This is because the
+     // units of a length at a given index can change from sandwich layer to
+     // layer, and indeed even be different within a single sandwich layer. If
+     // any length in the result of an animation sandwich is the result of the
+     // addition of lengths where one or more of those lengths is context
+     // dependent, then naturally the resultant length is also context
+@@ -179,17 +179,17 @@ SVGAnimatedLengthList::SMILAnimatedLengt
+   // from ALL return points. This function must only return THIS variable:
+   nsSMILValue val;
  
-   MOZ_ALWAYS_SUCCEEDS(gPBackgroundThread->Dispatch(r.forget(),
-                                                    NS_DISPATCH_NORMAL));
+   nsSMILValue tmp(&SVGLengthListSMILType::sSingleton);
+   SVGLengthListAndInfo *llai = static_cast<SVGLengthListAndInfo*>(tmp.mU.mPtr);
+   nsresult rv = llai->CopyFrom(mVal->mBaseVal);
+   if (NS_SUCCEEDED(rv)) {
+     llai->SetInfo(mElement, mAxis, mCanZeroPadList);
+-    val = Move(tmp);
++    val = std::move(tmp);
+   }
+   return val;
  }
  
- U2FHIDTokenManager::U2FHIDTokenManager() : mTransactionId(0)
+ nsresult
+ SVGAnimatedLengthList::SMILAnimatedLengthList::SetAnimValue(const nsSMILValue& aValue)
  {
-   StaticMutexAutoLock lock(gInstanceMutex);
-@@ -227,17 +227,17 @@ U2FHIDTokenManager::HandleRegisterResult
- 
-   nsTArray<uint8_t> registration;
-   if (!aResult->CopyRegistration(registration)) {
-     mRegisterPromise.Reject(NS_ERROR_DOM_UNKNOWN_ERR, __func__);
-     return;
+   NS_ASSERTION(aValue.mType == &SVGLengthListSMILType::sSingleton,
+diff --git a/dom/svg/SVGAnimatedNumberList.cpp b/dom/svg/SVGAnimatedNumberList.cpp
+--- a/dom/svg/SVGAnimatedNumberList.cpp
++++ b/dom/svg/SVGAnimatedNumberList.cpp
+@@ -135,17 +135,17 @@ SVGAnimatedNumberList::
+                                nsSMILValue& aValue,
+                                bool& aPreventCachingOfSandwich) const
+ {
+   nsSMILValue val(&SVGNumberListSMILType::sSingleton);
+   SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo*>(val.mU.mPtr);
+   nsresult rv = nlai->SetValueFromString(aStr);
+   if (NS_SUCCEEDED(rv)) {
+     nlai->SetInfo(mElement);
+-    aValue = Move(val);
++    aValue = std::move(val);
    }
- 
-   WebAuthnMakeCredentialResult result(registration);
--  mRegisterPromise.Resolve(Move(result), __func__);
-+  mRegisterPromise.Resolve(std::move(result), __func__);
+   aPreventCachingOfSandwich = false;
+   return rv;
  }
  
- void
- U2FHIDTokenManager::HandleSignResult(UniquePtr<U2FResult>&& aResult)
+ nsSMILValue
+ SVGAnimatedNumberList::SMILAnimatedNumberList::GetBaseValue() const
  {
-   mozilla::ipc::AssertIsOnBackgroundThread();
- 
-   if (aResult->GetTransactionId() != mTransactionId) {
-@@ -272,13 +272,13 @@ U2FHIDTokenManager::HandleSignResult(Uni
-   nsTArray<WebAuthnExtensionResult> extensions;
- 
-   if (appId != mCurrentAppId) {
-     // Indicate to the RP that we used the FIDO appId.
-     extensions.AppendElement(WebAuthnExtensionResultAppId(true));
+diff --git a/dom/svg/SVGAnimatedPathSegList.cpp b/dom/svg/SVGAnimatedPathSegList.cpp
+--- a/dom/svg/SVGAnimatedPathSegList.cpp
++++ b/dom/svg/SVGAnimatedPathSegList.cpp
+@@ -163,17 +163,17 @@ SVGAnimatedPathSegList::
+                                nsSMILValue& aValue,
+                                bool& aPreventCachingOfSandwich) const
+ {
+   nsSMILValue val(SVGPathSegListSMILType::Singleton());
+   SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo*>(val.mU.mPtr);
+   nsresult rv = list->SetValueFromString(aStr);
+   if (NS_SUCCEEDED(rv)) {
+     list->SetElement(mElement);
+-    aValue = Move(val);
++    aValue = std::move(val);
    }
- 
-   WebAuthnGetAssertionResult result(appId, keyHandle, signature, extensions);
--  mSignPromise.Resolve(Move(result), __func__);
-+  mSignPromise.Resolve(std::move(result), __func__);
- }
- 
- }
- }
-diff --git a/dom/webauthn/U2FSoftTokenManager.cpp b/dom/webauthn/U2FSoftTokenManager.cpp
---- a/dom/webauthn/U2FSoftTokenManager.cpp
-+++ b/dom/webauthn/U2FSoftTokenManager.cpp
-@@ -684,17 +684,17 @@ U2FSoftTokenManager::Register(const WebA
-   registrationBuf.AppendElement(0x05, mozilla::fallible);
-   registrationBuf.AppendSECItem(pubKey->u.ec.publicValue);
-   registrationBuf.AppendElement(keyHandleItem->len, mozilla::fallible);
-   registrationBuf.AppendSECItem(keyHandleItem.get());
-   registrationBuf.AppendSECItem(attestCert.get()->derCert);
-   registrationBuf.AppendSECItem(signatureItem);
- 
-   WebAuthnMakeCredentialResult result((nsTArray<uint8_t>(registrationBuf)));
--  return U2FRegisterPromise::CreateAndResolve(Move(result), __func__);
-+  return U2FRegisterPromise::CreateAndResolve(std::move(result), __func__);
+   aPreventCachingOfSandwich = false;
+   return rv;
  }
  
- bool
- U2FSoftTokenManager::FindRegisteredKeyHandle(const nsTArray<nsTArray<uint8_t>>& aAppIds,
-                                              const nsTArray<WebAuthnScopedCredential>& aCredentials,
-                                              /*out*/ nsTArray<uint8_t>& aKeyHandle,
-                                              /*out*/ nsTArray<uint8_t>& aAppId)
+ nsSMILValue
+ SVGAnimatedPathSegList::SMILAnimatedPathSegList::GetBaseValue() const
  {
-@@ -860,17 +860,17 @@ U2FSoftTokenManager::Sign(const WebAuthn
-   nsTArray<WebAuthnExtensionResult> extensions;
+@@ -182,17 +182,17 @@ SVGAnimatedPathSegList::SMILAnimatedPath
+   // from ALL return points. This function must only return THIS variable:
+   nsSMILValue val;
  
-   if (chosenAppId != aInfo.RpIdHash()) {
-     // Indicate to the RP that we used the FIDO appId.
-     extensions.AppendElement(WebAuthnExtensionResultAppId(true));
+   nsSMILValue tmp(SVGPathSegListSMILType::Singleton());
+   SVGPathDataAndInfo *list = static_cast<SVGPathDataAndInfo*>(tmp.mU.mPtr);
+   nsresult rv = list->CopyFrom(mVal->mBaseVal);
+   if (NS_SUCCEEDED(rv)) {
+     list->SetElement(mElement);
+-    val = Move(tmp);
++    val = std::move(tmp);
    }
- 
-   WebAuthnGetAssertionResult result(chosenAppId, keyHandle, signature, extensions);
--  return U2FSignPromise::CreateAndResolve(Move(result), __func__);
-+  return U2FSignPromise::CreateAndResolve(std::move(result), __func__);
+   return val;
  }
  
- void
- U2FSoftTokenManager::Cancel()
+ nsresult
+ SVGAnimatedPathSegList::SMILAnimatedPathSegList::SetAnimValue(const nsSMILValue& aValue)
  {
-   // This implementation is sync, requests can't be aborted.
- }
- 
-diff --git a/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp b/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
---- a/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
-+++ b/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
-@@ -98,17 +98,17 @@ WebBrowserPersistSerializeChild::Write(c
-     const char* buf = aBuf;
-     uint32_t count = aCount;
-     *aWritten = 0;
-     while (count > 0) {
-         uint32_t toWrite = std::min(IPC::MAX_MESSAGE_SIZE, count);
-         nsTArray<uint8_t> arrayBuf;
-         // It would be nice if this extra copy could be avoided.
-         arrayBuf.AppendElements(buf, toWrite);
--        SendWriteData(Move(arrayBuf));
-+        SendWriteData(std::move(arrayBuf));
-         *aWritten += toWrite;
-         buf += toWrite;
-         count -= toWrite;
-     }
-     return NS_OK;
- }
- 
- NS_IMETHODIMP
-diff --git a/dom/webbrowserpersist/nsWebBrowserPersist.cpp b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
---- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
-+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
-@@ -1811,17 +1811,17 @@ nsWebBrowserPersist::FinishSaveDocumentI
-         mWalkStack.TruncateLength(mWalkStack.Length() - 1);
-         // Bounce this off the event loop to avoid stack overflow.
-         typedef StoreCopyPassByRRef<decltype(toWalk)> WalkStorage;
-         auto saveMethod = &nsWebBrowserPersist::SaveDocumentDeferred;
-         nsCOMPtr<nsIRunnable> saveLater = NewRunnableMethod<WalkStorage>(
-           "nsWebBrowserPersist::FinishSaveDocumentInternal",
-           this,
-           saveMethod,
--          mozilla::Move(toWalk));
-+          std::move(toWalk));
-         NS_DispatchToCurrentThread(saveLater);
-     } else {
-         // Done walking DOMs; on to the serialization phase.
-         SerializeNextFile();
-     }
- }
- 
- void nsWebBrowserPersist::Cleanup()
-@@ -2718,17 +2718,17 @@ nsWebBrowserPersist::SaveSubframeContent
- 
-     // We shouldn't use SaveDocumentInternal for the contents
-     // of frames that are not documents, e.g. images.
-     if (DocumentEncoderExists(contentType.get())) {
-         auto toWalk = mozilla::MakeUnique<WalkData>();
-         toWalk->mDocument = aFrameContent;
-         toWalk->mFile = frameURI;
-         toWalk->mDataPath = frameDataURI;
--        mWalkStack.AppendElement(mozilla::Move(toWalk));
-+        mWalkStack.AppendElement(std::move(toWalk));
-     } else {
-         rv = StoreURI(aURISpec.get());
-     }
-     NS_ENSURE_SUCCESS(rv, rv);
- 
-     // Store the updated uri to the frame
-     aData->mFile = frameURI;
-     aData->mSubFrameExt.Truncate(); // we already put this in frameURI
-diff --git a/dom/websocket/WebSocket.cpp b/dom/websocket/WebSocket.cpp
---- a/dom/websocket/WebSocket.cpp
-+++ b/dom/websocket/WebSocket.cpp
-@@ -2822,17 +2822,17 @@ class WorkerRunnableDispatcher final : p
+   NS_ASSERTION(aValue.mType == SVGPathSegListSMILType::Singleton(),
+diff --git a/dom/svg/SVGAnimatedPointList.cpp b/dom/svg/SVGAnimatedPointList.cpp
+--- a/dom/svg/SVGAnimatedPointList.cpp
++++ b/dom/svg/SVGAnimatedPointList.cpp
+@@ -160,17 +160,17 @@ SVGAnimatedPointList::
+                                nsSMILValue& aValue,
+                                bool& aPreventCachingOfSandwich) const
  {
-   RefPtr<WebSocketImpl> mWebSocketImpl;
- 
- public:
-   WorkerRunnableDispatcher(WebSocketImpl* aImpl, WorkerPrivate* aWorkerPrivate,
-                            already_AddRefed<nsIRunnable> aEvent)
-     : WorkerRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount)
-     , mWebSocketImpl(aImpl)
--    , mEvent(Move(aEvent))
-+    , mEvent(std::move(aEvent))
-   {
+   nsSMILValue val(&SVGPointListSMILType::sSingleton);
+   SVGPointListAndInfo *list = static_cast<SVGPointListAndInfo*>(val.mU.mPtr);
+   nsresult rv = list->SetValueFromString(aStr);
+   if (NS_SUCCEEDED(rv)) {
+     list->SetInfo(mElement);
+-    aValue = Move(val);
++    aValue = std::move(val);
    }
- 
-   bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
-   {
-     aWorkerPrivate->AssertIsOnWorkerThread();
- 
-     // No messages when disconnected.
-diff --git a/dom/workers/FileReaderSync.cpp b/dom/workers/FileReaderSync.cpp
---- a/dom/workers/FileReaderSync.cpp
-+++ b/dom/workers/FileReaderSync.cpp
-@@ -474,17 +474,17 @@ FileReaderSync::SyncRead(nsIInputStream*
-   return SyncRead(aStream, aBuffer, aBufferSize, aRead);
+   aPreventCachingOfSandwich = false;
+   return rv;
  }
  
- nsresult
- FileReaderSync::ConvertAsyncToSyncStream(uint64_t aStreamSize,
-                                          already_AddRefed<nsIInputStream> aAsyncStream,
-                                          nsIInputStream** aSyncStream)
+ nsSMILValue
+ SVGAnimatedPointList::SMILAnimatedPointList::GetBaseValue() const
  {
--  nsCOMPtr<nsIInputStream> asyncInputStream = Move(aAsyncStream);
-+  nsCOMPtr<nsIInputStream> asyncInputStream = std::move(aAsyncStream);
- 
-   // If the stream is not async, we just need it to be bufferable.
-   nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(asyncInputStream);
-   if (!asyncStream) {
-     return NS_NewBufferedInputStream(aSyncStream, asyncInputStream.forget(), 4096);
+diff --git a/dom/svg/SVGElementFactory.cpp b/dom/svg/SVGElementFactory.cpp
+--- a/dom/svg/SVGElementFactory.cpp
++++ b/dom/svg/SVGElementFactory.cpp
+@@ -27,17 +27,17 @@ static PLHashTable* sTagAtomTable = null
+     nsIContent** aResult,                                                      \
+     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);                     \
+                                                                                \
+   nsresult NS_NewSVG##_classname##Element(                                     \
+     nsIContent** aResult,                                                      \
+     already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,                      \
+     FromParser aFromParser)                                                    \
+   {                                                                            \
+-    return NS_NewSVG##_classname##Element(aResult, mozilla::Move(aNodeInfo));  \
++    return NS_NewSVG##_classname##Element(aResult, std::move(aNodeInfo));  \
    }
  
-   nsAutoCString buffer;
-diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
---- a/dom/workers/RuntimeService.cpp
-+++ b/dom/workers/RuntimeService.cpp
-@@ -1585,17 +1585,17 @@ RuntimeService::RegisterWorker(WorkerPri
-            MOZ_CRASH("We should not instantiate a new SharedWorker!");
-          }
-       }
- #endif
- 
-       UniquePtr<SharedWorkerInfo> sharedWorkerInfo(
-         new SharedWorkerInfo(aWorkerPrivate, sharedWorkerScriptSpec,
-                              aWorkerPrivate->WorkerName()));
--      domainInfo->mSharedWorkerInfos.AppendElement(Move(sharedWorkerInfo));
-+      domainInfo->mSharedWorkerInfos.AppendElement(std::move(sharedWorkerInfo));
-     }
-   }
+ #define SVG_FROM_PARSER_TAG(_tag, _classname)
  
-   // From here on out we must call UnregisterWorker if something fails!
-   if (parent) {
-     if (!parent->AddChildWorker(aWorkerPrivate)) {
-       UnregisterWorker(aWorkerPrivate);
-       return false;
-diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
---- a/dom/workers/ScriptLoader.cpp
-+++ b/dom/workers/ScriptLoader.cpp
-@@ -749,17 +749,17 @@ private:
+ #include "SVGTagList.h"
+ #undef SVG_TAG
+ #undef SVG_FROM_PARSER_TAG
  
-     UniquePtr<PrincipalInfo> principalInfo(new PrincipalInfo());
-     rv = PrincipalToPrincipalInfo(channelPrincipal, principalInfo.get());
-     if (NS_WARN_IF(NS_FAILED(rv))) {
-       channel->Cancel(rv);
-       return rv;
+diff --git a/dom/svg/nsSVGAngle.cpp b/dom/svg/nsSVGAngle.cpp
+--- a/dom/svg/nsSVGAngle.cpp
++++ b/dom/svg/nsSVGAngle.cpp
+@@ -374,17 +374,17 @@ nsSVGAngle::SMILOrient::ValueFromString(
+     uint16_t unitType;
+     if (!GetValueFromString(aStr, value, &unitType)) {
+       return NS_ERROR_DOM_SYNTAX_ERR;
      }
+     val.mU.mOrient.mAngle = value;
+     val.mU.mOrient.mUnit = unitType;
+     val.mU.mOrient.mOrientType = SVG_MARKER_ORIENT_ANGLE;
+   }
+-  aValue = Move(val);
++  aValue = std::move(val);
+   aPreventCachingOfSandwich = false;
  
--    ir->SetPrincipalInfo(Move(principalInfo));
-+    ir->SetPrincipalInfo(std::move(principalInfo));
-     ir->Headers()->FillResponseHeaders(loadInfo.mChannel);
- 
-     RefPtr<mozilla::dom::Response> response =
-       new mozilla::dom::Response(mCacheCreator->Global(), ir, nullptr);
- 
-     mozilla::dom::RequestOrUSVString request;
- 
-     MOZ_ASSERT(!loadInfo.mFullURL.IsEmpty());
-@@ -1025,17 +1025,17 @@ private:
-     rv = NS_NewStreamLoader(getter_AddRefs(loader), listener);
-     if (NS_WARN_IF(NS_FAILED(rv))) {
-       return rv;
-     }
+   return NS_OK;
+ }
  
-     if (IsMainWorkerScript()) {
-       MOZ_DIAGNOSTIC_ASSERT(loadInfo.mReservedClientInfo.isSome());
-       rv = AddClientChannelHelper(channel,
--                                  Move(loadInfo.mReservedClientInfo),
-+                                  std::move(loadInfo.mReservedClientInfo),
-                                   Maybe<ClientInfo>(),
-                                   mWorkerPrivate->HybridEventTarget());
-       if (NS_WARN_IF(NS_FAILED(rv))) {
-         return rv;
-       }
-     }
+ nsSMILValue
+ nsSVGAngle::SMILOrient::GetBaseValue() const
+ {
+diff --git a/dom/svg/nsSVGAnimatedTransformList.cpp b/dom/svg/nsSVGAnimatedTransformList.cpp
+--- a/dom/svg/nsSVGAnimatedTransformList.cpp
++++ b/dom/svg/nsSVGAnimatedTransformList.cpp
+@@ -256,17 +256,17 @@ nsSVGAnimatedTransformList::SMILAnimated
  
-     if (loadInfo.mCacheStatus != ScriptLoadInfo::ToBeCached) {
-@@ -1794,17 +1794,17 @@ CacheScriptLoader::ResolvedCallback(JSCo
-   const UniquePtr<PrincipalInfo>& pInfo = response->GetPrincipalInfo();
-   if (pInfo) {
-     mPrincipalInfo = mozilla::MakeUnique<PrincipalInfo>(*pInfo);
+   nsSMILValue val(SVGTransformListSMILType::Singleton());
+   SVGTransformSMILData transform(transformType, params);
+   if (NS_FAILED(SVGTransformListSMILType::AppendTransform(transform, val))) {
+     return; // OOM
    }
  
-   if (!inputStream) {
-     mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
-     mRunnable->DataReceivedFromCache(mIndex, (uint8_t*)"", 0, mChannelInfo,
--                                     Move(mPrincipalInfo), mCSPHeaderValue,
-+                                     std::move(mPrincipalInfo), mCSPHeaderValue,
-                                      mCSPReportOnlyHeaderValue,
-                                      mReferrerPolicyHeaderValue);
-     return;
-   }
+   // Success! Populate our outparam with parsed value.
+-  aResult = Move(val);
++  aResult = std::move(val);
+ }
  
-   MOZ_ASSERT(!mPump);
-   rv = NS_NewInputStreamPump(getter_AddRefs(mPump),
-                              inputStream.forget(),
-@@ -1861,17 +1861,17 @@ CacheScriptLoader::OnStreamComplete(nsIS
-     return NS_OK;
-   }
+ int32_t
+ nsSVGAnimatedTransformList::SMILAnimatedTransformList::ParseParameterList(
+   const nsAString& aSpec,
+   float* aVars,
+   int32_t aNVars)
+ {
+diff --git a/dom/svg/nsSVGClass.cpp b/dom/svg/nsSVGClass.cpp
+--- a/dom/svg/nsSVGClass.cpp
++++ b/dom/svg/nsSVGClass.cpp
+@@ -127,17 +127,17 @@ nsresult
+ nsSVGClass::SMILString::ValueFromString(const nsAString& aStr,
+                                         const dom::SVGAnimationElement* /*aSrcElement*/,
+                                         nsSMILValue& aValue,
+                                         bool& aPreventCachingOfSandwich) const
+ {
+   nsSMILValue val(SMILStringType::Singleton());
  
-   MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::ReadingFromCache);
-   mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
+   *static_cast<nsAString*>(val.mU.mPtr) = aStr;
+-  aValue = Move(val);
++  aValue = std::move(val);
+   aPreventCachingOfSandwich = false;
+   return NS_OK;
+ }
  
-   MOZ_ASSERT(mPrincipalInfo);
-   mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mChannelInfo,
--                                   Move(mPrincipalInfo), mCSPHeaderValue,
-+                                   std::move(mPrincipalInfo), mCSPHeaderValue,
-                                    mCSPReportOnlyHeaderValue,
-                                    mReferrerPolicyHeaderValue);
+ nsSMILValue
+ nsSVGClass::SMILString::GetBaseValue() const
+ {
+   nsSMILValue val(SMILStringType::Singleton());
+diff --git a/dom/svg/nsSVGString.cpp b/dom/svg/nsSVGString.cpp
+--- a/dom/svg/nsSVGString.cpp
++++ b/dom/svg/nsSVGString.cpp
+@@ -107,17 +107,17 @@ nsresult
+ nsSVGString::SMILString::ValueFromString(const nsAString& aStr,
+                                          const dom::SVGAnimationElement* /*aSrcElement*/,
+                                          nsSMILValue& aValue,
+                                          bool& aPreventCachingOfSandwich) const
+ {
+   nsSMILValue val(SMILStringType::Singleton());
+ 
+   *static_cast<nsAString*>(val.mU.mPtr) = aStr;
+-  aValue = Move(val);
++  aValue = std::move(val);
+   aPreventCachingOfSandwich = false;
    return NS_OK;
  }
  
- class ChannelGetterRunnable final : public WorkerMainThreadRunnable
+ nsSMILValue
+ nsSVGString::SMILString::GetBaseValue() const
  {
-   const nsAString& mScriptURL;
-diff --git a/dom/workers/ServiceWorkerDescriptor.cpp b/dom/workers/ServiceWorkerDescriptor.cpp
---- a/dom/workers/ServiceWorkerDescriptor.cpp
-+++ b/dom/workers/ServiceWorkerDescriptor.cpp
-@@ -40,25 +40,25 @@ ServiceWorkerDescriptor&
- ServiceWorkerDescriptor::operator=(const ServiceWorkerDescriptor& aRight)
+   nsSMILValue val(SMILStringType::Singleton());
+diff --git a/dom/svg/nsSVGViewBox.cpp b/dom/svg/nsSVGViewBox.cpp
+--- a/dom/svg/nsSVGViewBox.cpp
++++ b/dom/svg/nsSVGViewBox.cpp
+@@ -318,17 +318,17 @@ nsSVGViewBox::SMILViewBox
  {
-   mData.reset();
-   mData = MakeUnique<IPCServiceWorkerDescriptor>(*aRight.mData);
-   return *this;
+   nsSVGViewBoxRect viewBox;
+   nsresult res = nsSVGViewBoxRect::FromString(aStr, &viewBox);
+   if (NS_FAILED(res)) {
+     return res;
+   }
+   nsSMILValue val(&SVGViewBoxSMILType::sSingleton);
+   *static_cast<nsSVGViewBoxRect*>(val.mU.mPtr) = viewBox;
+-  aValue = Move(val);
++  aValue = std::move(val);
+   aPreventCachingOfSandwich = false;
+ 
+   return NS_OK;
  }
  
- ServiceWorkerDescriptor::ServiceWorkerDescriptor(ServiceWorkerDescriptor&& aRight)
--  : mData(Move(aRight.mData))
-+  : mData(std::move(aRight.mData))
+ nsSMILValue
+ nsSVGViewBox::SMILViewBox::GetBaseValue() const
  {
+diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp
+--- a/dom/system/OSFileConstants.cpp
++++ b/dom/system/OSFileConstants.cpp
+@@ -298,17 +298,17 @@ OSFileConstantsService::InitOSFileConsta
+ #endif // defined(XP_WIN)
+ 
+ #if defined(XP_MACOSX)
+   GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
+   GetPathToSpecialDir(NS_OSX_LOCAL_APPLICATIONS_DIR, paths->macLocalApplicationsDir);
+   GetPathToSpecialDir(NS_MAC_TRASH_DIR, paths->macTrashDir);
+ #endif // defined(XP_MACOSX)
+ 
+-  mPaths = Move(paths);
++  mPaths = std::move(paths);
+ 
+   // Get the umask from the system-info service.
+   // The property will always be present, but it will be zero on
+   // non-Unix systems.
+   // nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM2 so we don't need
+   // to initialize the service.
+   mUserUmask = nsSystemInfo::gUserUmask;
+ 
+diff --git a/dom/u2f/U2F.cpp b/dom/u2f/U2F.cpp
+--- a/dom/u2f/U2F.cpp
++++ b/dom/u2f/U2F.cpp
+@@ -345,17 +345,17 @@ U2F::Register(const nsAString& aAppId,
+   WebAuthnMakeCredentialInfo info(rpIdHash,
+                                   clientDataHash,
+                                   adjustedTimeoutMillis,
+                                   excludeList,
+                                   extensions,
+                                   authSelection);
+ 
+   MOZ_ASSERT(mTransaction.isNothing());
+-  mTransaction = Some(U2FTransaction(clientData, Move(AsVariant(callback))));
++  mTransaction = Some(U2FTransaction(clientData, std::move(AsVariant(callback))));
+   mChild->SendRequestRegister(mTransaction.ref().mId, info);
  }
  
- ServiceWorkerDescriptor&
- ServiceWorkerDescriptor::operator=(ServiceWorkerDescriptor&& aRight)
+ void
+ U2F::FinishMakeCredential(const uint64_t& aTransactionId,
+                           const WebAuthnMakeCredentialResult& aResult)
  {
-   mData.reset();
--  mData = Move(aRight.mData);
-+  mData = std::move(aRight.mData);
-   return *this;
- }
+   MOZ_ASSERT(NS_IsMainThread());
+@@ -486,17 +486,17 @@ U2F::Sign(const nsAString& aAppId,
+   WebAuthnGetAssertionInfo info(rpIdHash,
+                                 clientDataHash,
+                                 adjustedTimeoutMillis,
+                                 permittedList,
+                                 false, /* requireUserVerification */
+                                 extensions);
  
- ServiceWorkerDescriptor::~ServiceWorkerDescriptor()
- {
+   MOZ_ASSERT(mTransaction.isNothing());
+-  mTransaction = Some(U2FTransaction(clientData, Move(AsVariant(callback))));
++  mTransaction = Some(U2FTransaction(clientData, std::move(AsVariant(callback))));
+   mChild->SendRequestSign(mTransaction.ref().mId, info);
  }
  
- bool
-diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
---- a/dom/workers/ServiceWorkerEvents.cpp
-+++ b/dom/workers/ServiceWorkerEvents.cpp
-@@ -227,17 +227,17 @@ class BodyCopyHandle final : public nsII
-   ~BodyCopyHandle()
-   {
+ void
+ U2F::FinishGetAssertion(const uint64_t& aTransactionId,
+                         const WebAuthnGetAssertionResult& aResult)
+ {
+   MOZ_ASSERT(NS_IsMainThread());
+@@ -573,17 +573,17 @@ U2F::RejectTransaction(const nsresult& a
+   if (NS_WARN_IF(mTransaction.isNothing())) {
+     return;
    }
  
- public:
-   NS_DECL_THREADSAFE_ISUPPORTS
+   StopListeningForVisibilityEvents();
  
-   explicit BodyCopyHandle(UniquePtr<RespondWithClosure>&& aClosure)
--    : mClosure(Move(aClosure))
-+    : mClosure(std::move(aClosure))
-   {
-   }
+   // Clear out mTransaction before calling ExecuteCallback() below to allow
+   // reentrancy from microtask checkpoints.
+-  Maybe<U2FTransaction> maybeTransaction(Move(mTransaction));
++  Maybe<U2FTransaction> maybeTransaction(std::move(mTransaction));
+   MOZ_ASSERT(mTransaction.isNothing() && maybeTransaction.isSome());
  
-   NS_IMETHOD
-   BodyComplete(nsresult aRv) override
-   {
-     MOZ_ASSERT(NS_IsMainThread());
+   U2FTransaction& transaction = maybeTransaction.ref();
+   ErrorCode code = ConvertNSResultToErrorCode(aError);
  
-@@ -282,17 +282,17 @@ public:
-                 const nsACString& aResponseURLSpec,
-                 UniquePtr<RespondWithClosure>&& aClosure)
-     : Runnable("dom::workers::StartResponse")
-     , mChannel(aChannel)
-     , mInternalResponse(aInternalResponse)
-     , mWorkerChannelInfo(aWorkerChannelInfo)
-     , mScriptSpec(aScriptSpec)
-     , mResponseURLSpec(aResponseURLSpec)
--    , mClosure(Move(aClosure))
-+    , mClosure(std::move(aClosure))
+   if (transaction.HasRegisterCallback()) {
+     RegisterResponse response;
+     response.mErrorCode.Construct(static_cast<uint32_t>(code));
+diff --git a/dom/u2f/U2F.h b/dom/u2f/U2F.h
+--- a/dom/u2f/U2F.h
++++ b/dom/u2f/U2F.h
+@@ -36,17 +36,17 @@ class U2FTransaction
+ {
+   typedef Variant<nsMainThreadPtrHandle<U2FRegisterCallback>,
+                   nsMainThreadPtrHandle<U2FSignCallback>> U2FCallback;
+ 
+ public:
+   explicit U2FTransaction(const nsCString& aClientData,
+                           const U2FCallback&& aCallback)
+     : mClientData(aClientData)
+-    , mCallback(Move(aCallback))
++    , mCallback(std::move(aCallback))
+     , mId(NextId())
    {
+     MOZ_ASSERT(mId > 0);
    }
  
-   NS_IMETHOD
-   Run() override
-   {
-     AssertIsOnMainThread();
+   bool HasRegisterCallback() {
+     return mCallback.is<nsMainThreadPtrHandle<U2FRegisterCallback>>();
+   }
+diff --git a/dom/webauthn/U2FHIDTokenManager.cpp b/dom/webauthn/U2FHIDTokenManager.cpp
+--- a/dom/webauthn/U2FHIDTokenManager.cpp
++++ b/dom/webauthn/U2FHIDTokenManager.cpp
+@@ -22,17 +22,17 @@ u2f_register_callback(uint64_t aTransact
  
-@@ -356,17 +356,17 @@ public:
-     if (preferredAltDataType.Equals(altDataType)) {
-       body = mInternalResponse->TakeAlternativeBody();
-     }
-     if (!body) {
-       mInternalResponse->GetUnfilteredBody(getter_AddRefs(body));
-     }
+   StaticMutexAutoLock lock(gInstanceMutex);
+   if (!gInstance || NS_WARN_IF(!gPBackgroundThread)) {
+     return;
+   }
  
-     RefPtr<BodyCopyHandle> copyHandle;
--    copyHandle = new BodyCopyHandle(Move(mClosure));
-+    copyHandle = new BodyCopyHandle(std::move(mClosure));
+   nsCOMPtr<nsIRunnable> r(NewRunnableMethod<UniquePtr<U2FResult>&&>(
+       "U2FHIDTokenManager::HandleRegisterResult", gInstance,
+-      &U2FHIDTokenManager::HandleRegisterResult, Move(rv)));
++      &U2FHIDTokenManager::HandleRegisterResult, std::move(rv)));
  
-     rv = mChannel->StartSynthesizedResponse(body, copyHandle, cacheInfoChannel,
-                                             mResponseURLSpec,
-                                             mInternalResponse->IsRedirected());
-     if (NS_WARN_IF(NS_FAILED(rv))) {
-       mChannel->CancelInterception(NS_ERROR_INTERCEPTION_FAILED);
-       return NS_OK;
-     }
-@@ -732,17 +732,17 @@ RespondWithHandler::ResolvedCallback(JSC
-                                                                mRespondWithLineNumber,
-                                                                mRespondWithColumnNumber));
+   MOZ_ALWAYS_SUCCEEDS(gPBackgroundThread->Dispatch(r.forget(),
+                                                    NS_DISPATCH_NORMAL));
+ }
  
-   nsCOMPtr<nsIRunnable> startRunnable = new StartResponse(mInterceptedChannel,
-                                                           ir,
-                                                           worker->GetChannelInfo(),
-                                                           mScriptSpec,
-                                                           responseURL,
--                                                          Move(closure));
-+                                                          std::move(closure));
+ static void
+ u2f_sign_callback(uint64_t aTransactionId, rust_u2f_result* aResult)
+ {
+@@ -40,17 +40,17 @@ u2f_sign_callback(uint64_t aTransactionI
  
-   nsCOMPtr<nsIInputStream> body;
-   ir->GetUnfilteredBody(getter_AddRefs(body));
-   // Errors and redirects may not have a body.
-   if (body) {
-     ErrorResult error;
-     response->SetBodyUsed(aCx, error);
-     if (NS_WARN_IF(error.Failed())) {
-@@ -1064,17 +1064,17 @@ ExtractBytesFromData(const OwningArrayBu
+   StaticMutexAutoLock lock(gInstanceMutex);
+   if (!gInstance || NS_WARN_IF(!gPBackgroundThread)) {
+     return;
    }
-   NS_NOTREACHED("Unexpected push message data");
-   return NS_ERROR_FAILURE;
- }
- }
  
- PushMessageData::PushMessageData(nsISupports* aOwner,
-                                  nsTArray<uint8_t>&& aBytes)
--  : mOwner(aOwner), mBytes(Move(aBytes)) {}
-+  : mOwner(aOwner), mBytes(std::move(aBytes)) {}
+   nsCOMPtr<nsIRunnable> r(NewRunnableMethod<UniquePtr<U2FResult>&&>(
+       "U2FHIDTokenManager::HandleSignResult", gInstance,
+-      &U2FHIDTokenManager::HandleSignResult, Move(rv)));
++      &U2FHIDTokenManager::HandleSignResult, std::move(rv)));
  
- PushMessageData::~PushMessageData()
- {
+   MOZ_ALWAYS_SUCCEEDS(gPBackgroundThread->Dispatch(r.forget(),
+                                                    NS_DISPATCH_NORMAL));
  }
  
- NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PushMessageData, mOwner)
+ U2FHIDTokenManager::U2FHIDTokenManager() : mTransactionId(0)
+ {
+   StaticMutexAutoLock lock(gInstanceMutex);
+@@ -227,17 +227,17 @@ U2FHIDTokenManager::HandleRegisterResult
  
- NS_IMPL_CYCLE_COLLECTING_ADDREF(PushMessageData)
-@@ -1183,17 +1183,17 @@ PushEvent::Constructor(mozilla::dom::Eve
-   e->SetComposed(aOptions.mComposed);
-   if(aOptions.mData.WasPassed()){
-     nsTArray<uint8_t> bytes;
-     nsresult rv = ExtractBytesFromData(aOptions.mData.Value(), bytes);
-     if (NS_FAILED(rv)) {
-       aRv.Throw(rv);
-       return nullptr;
-     }
--    e->mData = new PushMessageData(aOwner, Move(bytes));
-+    e->mData = new PushMessageData(aOwner, std::move(bytes));
+   nsTArray<uint8_t> registration;
+   if (!aResult->CopyRegistration(registration)) {
+     mRegisterPromise.Reject(NS_ERROR_DOM_UNKNOWN_ERR, __func__);
+     return;
    }
-   return e.forget();
- }
- 
- NS_IMPL_ADDREF_INHERITED(PushEvent, ExtendableEvent)
- NS_IMPL_RELEASE_INHERITED(PushEvent, ExtendableEvent)
- 
- NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushEvent)
-diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
---- a/dom/workers/ServiceWorkerManager.cpp
-+++ b/dom/workers/ServiceWorkerManager.cpp
-@@ -320,51 +320,51 @@ ServiceWorkerManager::StartControllingCl
-   const ServiceWorkerDescriptor& active =
-     aRegistrationInfo->GetActive()->Descriptor();
- 
-   auto entry = mControlledClients.LookupForAdd(aClientInfo.Id());
-   if (entry) {
-     RefPtr<ServiceWorkerRegistrationInfo> old =
-       entry.Data()->mRegistrationInfo.forget();
  
--    ref = Move(entry.Data()->mClientHandle->Control(active));
-+    ref = std::move(entry.Data()->mClientHandle->Control(active));
-     entry.Data()->mRegistrationInfo = aRegistrationInfo;
+   WebAuthnMakeCredentialResult result(registration);
+-  mRegisterPromise.Resolve(Move(result), __func__);
++  mRegisterPromise.Resolve(std::move(result), __func__);
+ }
  
-     if (old != aRegistrationInfo) {
-       StopControllingRegistration(old);
-       aRegistrationInfo->StartControllingClient();
-     }
+ void
+ U2FHIDTokenManager::HandleSignResult(UniquePtr<U2FResult>&& aResult)
+ {
+   mozilla::ipc::AssertIsOnBackgroundThread();
  
-     Telemetry::Accumulate(Telemetry::SERVICE_WORKER_CONTROLLED_DOCUMENTS, 1);
+   if (aResult->GetTransactionId() != mTransactionId) {
+@@ -272,13 +272,13 @@ U2FHIDTokenManager::HandleSignResult(Uni
+   nsTArray<WebAuthnExtensionResult> extensions;
  
--    return Move(ref);
-+    return std::move(ref);
+   if (appId != mCurrentAppId) {
+     // Indicate to the RP that we used the FIDO appId.
+     extensions.AppendElement(WebAuthnExtensionResultAppId(true));
    }
  
-   RefPtr<ClientHandle> clientHandle =
-     ClientManager::CreateHandle(aClientInfo,
-                                 SystemGroup::EventTargetFor(TaskCategory::Other));
- 
--  ref = Move(clientHandle->Control(active));
-+  ref = std::move(clientHandle->Control(active));
- 
-   aRegistrationInfo->StartControllingClient();
+   WebAuthnGetAssertionResult result(appId, keyHandle, signature, extensions);
+-  mSignPromise.Resolve(Move(result), __func__);
++  mSignPromise.Resolve(std::move(result), __func__);
+ }
  
-   entry.OrInsert([&] {
-     return new ControlledClientData(clientHandle, aRegistrationInfo);
-   });
+ }
+ }
+diff --git a/dom/webauthn/U2FSoftTokenManager.cpp b/dom/webauthn/U2FSoftTokenManager.cpp
+--- a/dom/webauthn/U2FSoftTokenManager.cpp
++++ b/dom/webauthn/U2FSoftTokenManager.cpp
+@@ -684,17 +684,17 @@ U2FSoftTokenManager::Register(const WebA
+   registrationBuf.AppendElement(0x05, mozilla::fallible);
+   registrationBuf.AppendSECItem(pubKey->u.ec.publicValue);
+   registrationBuf.AppendElement(keyHandleItem->len, mozilla::fallible);
+   registrationBuf.AppendSECItem(keyHandleItem.get());
+   registrationBuf.AppendSECItem(attestCert.get()->derCert);
+   registrationBuf.AppendSECItem(signatureItem);
  
-   RefPtr<ServiceWorkerManager> self(this);
-   clientHandle->OnDetach()->Then(
-     SystemGroup::EventTargetFor(TaskCategory::Other), __func__,
--    [self = Move(self), aClientInfo] {
-+    [self = std::move(self), aClientInfo] {
-       self->StopControllingClient(aClientInfo);
-     });
+   WebAuthnMakeCredentialResult result((nsTArray<uint8_t>(registrationBuf)));
+-  return U2FRegisterPromise::CreateAndResolve(Move(result), __func__);
++  return U2FRegisterPromise::CreateAndResolve(std::move(result), __func__);
+ }
  
-   Telemetry::Accumulate(Telemetry::SERVICE_WORKER_CONTROLLED_DOCUMENTS, 1);
+ bool
+ U2FSoftTokenManager::FindRegisteredKeyHandle(const nsTArray<nsTArray<uint8_t>>& aAppIds,
+                                              const nsTArray<WebAuthnScopedCredential>& aCredentials,
+                                              /*out*/ nsTArray<uint8_t>& aKeyHandle,
+                                              /*out*/ nsTArray<uint8_t>& aAppId)
+ {
+@@ -860,17 +860,17 @@ U2FSoftTokenManager::Sign(const WebAuthn
+   nsTArray<WebAuthnExtensionResult> extensions;
  
--  return Move(ref);
-+  return std::move(ref);
+   if (chosenAppId != aInfo.RpIdHash()) {
+     // Indicate to the RP that we used the FIDO appId.
+     extensions.AppendElement(WebAuthnExtensionResultAppId(true));
+   }
+ 
+   WebAuthnGetAssertionResult result(chosenAppId, keyHandle, signature, extensions);
+-  return U2FSignPromise::CreateAndResolve(Move(result), __func__);
++  return U2FSignPromise::CreateAndResolve(std::move(result), __func__);
  }
  
  void
- ServiceWorkerManager::StopControllingClient(const ClientInfo& aClientInfo)
+ U2FSoftTokenManager::Cancel()
  {
-   auto entry = mControlledClients.Lookup(aClientInfo.Id());
-   if (!entry) {
-     return;
-diff --git a/dom/workers/ServiceWorkerRegistrar.cpp b/dom/workers/ServiceWorkerRegistrar.cpp
---- a/dom/workers/ServiceWorkerRegistrar.cpp
-+++ b/dom/workers/ServiceWorkerRegistrar.cpp
-@@ -1174,17 +1174,17 @@ ServiceWorkerRegistrar::GetShutdownPhase
-   // memory), and there's no point in continuing startup. Include as much
-   // information as possible in the crash report.
-   RELEASE_ASSERT_SUCCEEDED(rv, "async shutdown service");
+   // This implementation is sync, requests can't be aborted.
+ }
  
+diff --git a/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp b/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
+--- a/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
++++ b/dom/webbrowserpersist/WebBrowserPersistSerializeChild.cpp
+@@ -98,17 +98,17 @@ WebBrowserPersistSerializeChild::Write(c
+     const char* buf = aBuf;
+     uint32_t count = aCount;
+     *aWritten = 0;
+     while (count > 0) {
+         uint32_t toWrite = std::min(IPC::MAX_MESSAGE_SIZE, count);
+         nsTArray<uint8_t> arrayBuf;
+         // It would be nice if this extra copy could be avoided.
+         arrayBuf.AppendElements(buf, toWrite);
+-        SendWriteData(Move(arrayBuf));
++        SendWriteData(std::move(arrayBuf));
+         *aWritten += toWrite;
+         buf += toWrite;
+         count -= toWrite;
+     }
+     return NS_OK;
+ }
  
-   nsCOMPtr<nsIAsyncShutdownClient> client;
-   rv = svc->GetProfileBeforeChange(getter_AddRefs(client));
-   RELEASE_ASSERT_SUCCEEDED(rv, "profileBeforeChange shutdown blocker");
--  return Move(client);
-+  return std::move(client);
+ NS_IMETHODIMP
+diff --git a/dom/webbrowserpersist/nsWebBrowserPersist.cpp b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
++++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+@@ -1811,17 +1811,17 @@ nsWebBrowserPersist::FinishSaveDocumentI
+         mWalkStack.TruncateLength(mWalkStack.Length() - 1);
+         // Bounce this off the event loop to avoid stack overflow.
+         typedef StoreCopyPassByRRef<decltype(toWalk)> WalkStorage;
+         auto saveMethod = &nsWebBrowserPersist::SaveDocumentDeferred;
+         nsCOMPtr<nsIRunnable> saveLater = NewRunnableMethod<WalkStorage>(
+           "nsWebBrowserPersist::FinishSaveDocumentInternal",
+           this,
+           saveMethod,
+-          mozilla::Move(toWalk));
++          std::move(toWalk));
+         NS_DispatchToCurrentThread(saveLater);
+     } else {
+         // Done walking DOMs; on to the serialization phase.
+         SerializeNextFile();
+     }
  }
  
- #undef RELEASE_ASSERT_SUCCEEDED
+ void nsWebBrowserPersist::Cleanup()
+@@ -2718,17 +2718,17 @@ nsWebBrowserPersist::SaveSubframeContent
  
- void
- ServiceWorkerRegistrar::Shutdown()
+     // We shouldn't use SaveDocumentInternal for the contents
+     // of frames that are not documents, e.g. images.
+     if (DocumentEncoderExists(contentType.get())) {
+         auto toWalk = mozilla::MakeUnique<WalkData>();
+         toWalk->mDocument = aFrameContent;
+         toWalk->mFile = frameURI;
+         toWalk->mDataPath = frameDataURI;
+-        mWalkStack.AppendElement(mozilla::Move(toWalk));
++        mWalkStack.AppendElement(std::move(toWalk));
+     } else {
+         rv = StoreURI(aURISpec.get());
+     }
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+     // Store the updated uri to the frame
+     aData->mFile = frameURI;
+     aData->mSubFrameExt.Truncate(); // we already put this in frameURI
+diff --git a/dom/websocket/WebSocket.cpp b/dom/websocket/WebSocket.cpp
+--- a/dom/websocket/WebSocket.cpp
++++ b/dom/websocket/WebSocket.cpp
+@@ -2822,17 +2822,17 @@ class WorkerRunnableDispatcher final : p
  {
-   AssertIsOnBackgroundThread();
-diff --git a/dom/workers/ServiceWorkerScriptCache.cpp b/dom/workers/ServiceWorkerScriptCache.cpp
---- a/dom/workers/ServiceWorkerScriptCache.cpp
-+++ b/dom/workers/ServiceWorkerScriptCache.cpp
-@@ -150,17 +150,17 @@ public:
+   RefPtr<WebSocketImpl> mWebSocketImpl;
+ 
+ public:
+   WorkerRunnableDispatcher(WebSocketImpl* aImpl, WorkerPrivate* aWorkerPrivate,
+                            already_AddRefed<nsIRunnable> aEvent)
+     : WorkerRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount)
+     , mWebSocketImpl(aImpl)
+-    , mEvent(Move(aEvent))
++    , mEvent(std::move(aEvent))
    {
-     RefPtr<InternalHeaders> internalHeaders = mInternalHeaders;
-     return internalHeaders.forget();
    }
  
-   UniquePtr<PrincipalInfo>
-   TakePrincipalInfo()
+   bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
    {
--    return Move(mPrincipalInfo);
-+    return std::move(mPrincipalInfo);
+     aWorkerPrivate->AssertIsOnWorkerThread();
+ 
+     // No messages when disconnected.
+diff --git a/dom/workers/FileReaderSync.cpp b/dom/workers/FileReaderSync.cpp
+--- a/dom/workers/FileReaderSync.cpp
++++ b/dom/workers/FileReaderSync.cpp
+@@ -474,17 +474,17 @@ FileReaderSync::SyncRead(nsIInputStream*
+   return SyncRead(aStream, aBuffer, aBufferSize, aRead);
+ }
+ 
+ nsresult
+ FileReaderSync::ConvertAsyncToSyncStream(uint64_t aStreamSize,
+                                          already_AddRefed<nsIInputStream> aAsyncStream,
+                                          nsIInputStream** aSyncStream)
+ {
+-  nsCOMPtr<nsIInputStream> asyncInputStream = Move(aAsyncStream);
++  nsCOMPtr<nsIInputStream> asyncInputStream = std::move(aAsyncStream);
+ 
+   // If the stream is not async, we just need it to be bufferable.
+   nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(asyncInputStream);
+   if (!asyncStream) {
+     return NS_NewBufferedInputStream(aSyncStream, asyncInputStream.forget(), 4096);
    }
  
-   bool
-   Succeeded() const
-   {
-     return NS_SUCCEEDED(mNetworkResult);
+   nsAutoCString buffer;
+diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
+--- a/dom/workers/RuntimeService.cpp
++++ b/dom/workers/RuntimeService.cpp
+@@ -1585,17 +1585,17 @@ RuntimeService::RegisterWorker(WorkerPri
+            MOZ_CRASH("We should not instantiate a new SharedWorker!");
+          }
+       }
+ #endif
+ 
+       UniquePtr<SharedWorkerInfo> sharedWorkerInfo(
+         new SharedWorkerInfo(aWorkerPrivate, sharedWorkerScriptSpec,
+                              aWorkerPrivate->WorkerName()));
+-      domainInfo->mSharedWorkerInfos.AppendElement(Move(sharedWorkerInfo));
++      domainInfo->mSharedWorkerInfos.AppendElement(std::move(sharedWorkerInfo));
+     }
    }
  
-@@ -609,17 +609,17 @@ private:
-     RefPtr<InternalResponse> ir =
-       new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
-     ir->SetBody(body, aCN->Buffer().Length());
-     ir->SetURLList(aCN->URLList());
+   // From here on out we must call UnregisterWorker if something fails!
+   if (parent) {
+     if (!parent->AddChildWorker(aWorkerPrivate)) {
+       UnregisterWorker(aWorkerPrivate);
+       return false;
+diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp
+--- a/dom/workers/ScriptLoader.cpp
++++ b/dom/workers/ScriptLoader.cpp
+@@ -749,17 +749,17 @@ private:
  
-     ir->InitChannelInfo(aCN->GetChannelInfo());
-     UniquePtr<PrincipalInfo> principalInfo = aCN->TakePrincipalInfo();
-     if (principalInfo) {
--      ir->SetPrincipalInfo(Move(principalInfo));
-+      ir->SetPrincipalInfo(std::move(principalInfo));
+     UniquePtr<PrincipalInfo> principalInfo(new PrincipalInfo());
+     rv = PrincipalToPrincipalInfo(channelPrincipal, principalInfo.get());
+     if (NS_WARN_IF(NS_FAILED(rv))) {
+       channel->Cancel(rv);
+       return rv;
      }
  
-     RefPtr<InternalHeaders> internalHeaders = aCN->GetInternalHeaders();
-     ir->Headers()->Fill(*(internalHeaders.get()), IgnoreErrors());
+-    ir->SetPrincipalInfo(Move(principalInfo));
++    ir->SetPrincipalInfo(std::move(principalInfo));
+     ir->Headers()->FillResponseHeaders(loadInfo.mChannel);
  
-     RefPtr<Response> response =
-       new Response(aCache->GetGlobalObject(), ir, nullptr);
+     RefPtr<mozilla::dom::Response> response =
+       new mozilla::dom::Response(mCacheCreator->Global(), ir, nullptr);
  
-@@ -916,17 +916,17 @@ CompareNetwork::SetPrincipalInfo(nsIChan
+     mozilla::dom::RequestOrUSVString request;
  
-   UniquePtr<PrincipalInfo> principalInfo = MakeUnique<PrincipalInfo>();
-   rv = PrincipalToPrincipalInfo(channelPrincipal, principalInfo.get());
+     MOZ_ASSERT(!loadInfo.mFullURL.IsEmpty());
+@@ -1025,17 +1025,17 @@ private:
+     rv = NS_NewStreamLoader(getter_AddRefs(loader), listener);
+     if (NS_WARN_IF(NS_FAILED(rv))) {
+       return rv;
+     }
  
-   if (NS_WARN_IF(NS_FAILED(rv))) {
-     return rv;
+     if (IsMainWorkerScript()) {
+       MOZ_DIAGNOSTIC_ASSERT(loadInfo.mReservedClientInfo.isSome());
+       rv = AddClientChannelHelper(channel,
+-                                  Move(loadInfo.mReservedClientInfo),
++                                  std::move(loadInfo.mReservedClientInfo),
+                                   Maybe<ClientInfo>(),
+                                   mWorkerPrivate->HybridEventTarget());
+       if (NS_WARN_IF(NS_FAILED(rv))) {
+         return rv;
+       }
+     }
+ 
+     if (loadInfo.mCacheStatus != ScriptLoadInfo::ToBeCached) {
+@@ -1794,17 +1794,17 @@ CacheScriptLoader::ResolvedCallback(JSCo
+   const UniquePtr<PrincipalInfo>& pInfo = response->GetPrincipalInfo();
+   if (pInfo) {
+     mPrincipalInfo = mozilla::MakeUnique<PrincipalInfo>(*pInfo);
    }
  
--  mPrincipalInfo = Move(principalInfo);
-+  mPrincipalInfo = std::move(principalInfo);
+   if (!inputStream) {
+     mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
+     mRunnable->DataReceivedFromCache(mIndex, (uint8_t*)"", 0, mChannelInfo,
+-                                     Move(mPrincipalInfo), mCSPHeaderValue,
++                                     std::move(mPrincipalInfo), mCSPHeaderValue,
+                                      mCSPReportOnlyHeaderValue,
+                                      mReferrerPolicyHeaderValue);
+     return;
+   }
+ 
+   MOZ_ASSERT(!mPump);
+   rv = NS_NewInputStreamPump(getter_AddRefs(mPump),
+                              inputStream.forget(),
+@@ -1861,17 +1861,17 @@ CacheScriptLoader::OnStreamComplete(nsIS
+     return NS_OK;
+   }
+ 
+   MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::ReadingFromCache);
+   mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
+ 
+   MOZ_ASSERT(mPrincipalInfo);
+   mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mChannelInfo,
+-                                   Move(mPrincipalInfo), mCSPHeaderValue,
++                                   std::move(mPrincipalInfo), mCSPHeaderValue,
+                                    mCSPReportOnlyHeaderValue,
+                                    mReferrerPolicyHeaderValue);
    return NS_OK;
  }
  
- NS_IMETHODIMP
- CompareNetwork::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext,
-                               nsresult aStatusCode)
+ class ChannelGetterRunnable final : public WorkerMainThreadRunnable
  {
-   // Nothing to do here!
+   const nsAString& mScriptURL;
 diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
 --- a/dom/workers/WorkerPrivate.cpp
 +++ b/dom/workers/WorkerPrivate.cpp

+ 6 - 6
mozilla-release/patches/1575420-70a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1566390342 0
 # Node ID 51bf6a97396d96ddb82fa91c2cf9bd9f5bc9ae06
-# Parent  6a36418c1ebb409f2a61a4785e586daa78030145
+# Parent  a1c073995cf932056f6a4ce6eff6fe9e617e4355
 Bug 1575420 - Replace MOZ_WIDGET_TOOLKIT value of "gtk3" with "gtk". r=froydnj
 
 Differential Revision: https://phabricator.services.mozilla.com/D42765
@@ -641,8 +641,8 @@ diff --git a/dom/ipc/tests/mochitest.ini b/dom/ipc/tests/mochitest.ini
 diff --git a/dom/moz.build b/dom/moz.build
 --- a/dom/moz.build
 +++ b/dom/moz.build
-@@ -108,11 +108,11 @@ DIRS += [
-     'websocket',
+@@ -109,11 +109,11 @@ DIRS += [
+     'serviceworkers',
  ]
  
  TEST_DIRS += [
@@ -812,7 +812,7 @@ diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
 diff --git a/gfx/harfbuzz/src/moz.build b/gfx/harfbuzz/src/moz.build
 --- a/gfx/harfbuzz/src/moz.build
 +++ b/gfx/harfbuzz/src/moz.build
-@@ -76,17 +76,17 @@ UNIFIED_SOURCES += [
+@@ -75,17 +75,17 @@ UNIFIED_SOURCES += [
      'hb-static.cc',
      'hb-subset-cff-common.cc',
      'hb-subset-cff1.cc',
@@ -1577,7 +1577,7 @@ diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
      'aboutmemory',
      'aboutperformance',
      'addoncompat',
-@@ -84,17 +84,17 @@ if CONFIG['BUILD_CTYPES']:
+@@ -83,17 +83,17 @@ if CONFIG['BUILD_CTYPES']:
      DIRS += ['ctypes']
  
  if CONFIG['MOZ_FEEDS']:
@@ -1729,7 +1729,7 @@ diff --git a/toolkit/locales/moz.build b/toolkit/locales/moz.build
 diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
 --- a/toolkit/modules/moz.build
 +++ b/toolkit/modules/moz.build
-@@ -259,23 +259,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
+@@ -258,23 +258,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
  EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
  EXTRA_JS_MODULES.sessionstore += [
      'sessionstore/PrivacyLevel.jsm',

+ 9 - 9
mozilla-release/patches/1727374-914.patch

@@ -2,7 +2,7 @@
 # User Steve Fink <sfink@mozilla.com>
 # Date 1630609618 0
 # Node ID c250dd684d8e7e770d562bbb2c7bfac464dc6593
-# Parent  b6d13b17e6cbd31c48638c17f5b9c86e0cf6ec26
+# Parent  f80398046f9071e6faa6c92869052413d83295e2
 Bug 1727374 - Root Init dictionaries to fix rooting hazards. r=peterv, a=RyanVM
 
 Differential Revision: https://phabricator.services.mozilla.com/D123633
@@ -10,7 +10,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D123633
 diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp
 --- a/dom/cache/Cache.cpp
 +++ b/dom/cache/Cache.cpp
-@@ -347,18 +347,19 @@ Cache::Add(JSContext* aContext, const Re
+@@ -348,18 +348,19 @@ Cache::Add(JSContext* aContext, const Re
    if (!IsValidPutRequestMethod(aRequest, aRv)) {
      return nullptr;
    }
@@ -32,7 +32,7 @@ diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp
    request->GetUrl(url);
    if (NS_WARN_IF(!IsValidPutRequestURL(url, aRv))) {
      return nullptr;
-@@ -395,18 +396,19 @@ Cache::AddAll(JSContext* aContext,
+@@ -396,18 +397,19 @@ Cache::AddAll(JSContext* aContext,
          return nullptr;
        }
      } else {
@@ -54,7 +54,7 @@ diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp
      request->GetUrl(url);
      if (NS_WARN_IF(!IsValidPutRequestURL(url, aRv))) {
        return nullptr;
-@@ -631,18 +633,19 @@ Cache::AddAll(const GlobalObject& aGloba
+@@ -609,18 +611,19 @@ Cache::AddAll(const GlobalObject& aGloba
  
    // Begin fetching each request in parallel.  For now, if an error occurs just
    // abandon our previous fetch calls.  In theory we could cancel them in the
@@ -178,10 +178,10 @@ new file mode 100644
 + 
 +       if (!data) {
 +         result = ErrorResult(NS_ERROR_FAILURE);
-diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/workers/ServiceWorkerPrivate.cpp
---- a/dom/workers/ServiceWorkerPrivate.cpp
-+++ b/dom/workers/ServiceWorkerPrivate.cpp
-@@ -931,17 +931,17 @@ public:
+diff --git a/dom/serviceworkers/ServiceWorkerPrivate.cpp b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+--- a/dom/serviceworkers/ServiceWorkerPrivate.cpp
++++ b/dom/serviceworkers/ServiceWorkerPrivate.cpp
+@@ -935,17 +935,17 @@ public:
    WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
    {
      MOZ_ASSERT(aWorkerPrivate);
@@ -229,7 +229,7 @@ new file mode 100644
 diff --git a/js/src/wasm/WasmJS.cpp b/js/src/wasm/WasmJS.cpp
 --- a/js/src/wasm/WasmJS.cpp
 +++ b/js/src/wasm/WasmJS.cpp
-@@ -987,27 +987,31 @@ WasmInstanceObject::create(JSContext* cx
+@@ -988,27 +988,31 @@ WasmInstanceObject::create(JSContext* cx
                             UniqueDebugState debug,
                             UniqueTlsData tlsData,
                             HandleWasmMemoryObject memory,

+ 4 - 0
mozilla-release/patches/series

@@ -1260,6 +1260,10 @@ servo-19877-60a1.patch
 1433139-2-60a1.patch
 1419764-1-60a1.patch
 1433551-60a1.patch
+1430139-1-60a1.patch
+1430139-2-60a1.patch
+1430139-3-60a1.patch
+1430139-4-60a1.patch
 1433576-60a1.patch
 1412066-60a1.patch
 685236-5-60a1.patch