Bug 1131350 - Move update() to ServiceWorkerRegistration. r=baku
authorNikhil Marathe <nsm.nikhil@gmail.com>
Thu, 19 Mar 2015 18:09:10 -0700
changeset 272125 0c7ab04d4666b13984903ad6a99f9854bfc5d351
parent 272124 d13a8cde569594f9966cb74e8776c502b10db62a
child 272126 01ebdcc6482125cdd1c6a1d88c07aaf18e1090a6
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1131350
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1131350 - Move update() to ServiceWorkerRegistration. r=baku
dom/interfaces/base/nsIServiceWorkerManager.idl
dom/webidl/ServiceWorkerGlobalScope.webidl
dom/webidl/ServiceWorkerRegistration.webidl
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerRegistration.cpp
dom/workers/ServiceWorkerRegistration.h
dom/workers/WorkerScope.cpp
dom/workers/WorkerScope.h
dom/workers/test/serviceworkers/mochitest.ini
dom/workers/test/serviceworkers/test_workerUnregister.html
dom/workers/test/serviceworkers/test_workerUpdate.html
dom/workers/test/serviceworkers/unregister/unregister.html
dom/workers/test/serviceworkers/workerUpdate/update.html
dom/workers/test/serviceworkers/worker_unregister.js
dom/workers/test/serviceworkers/worker_update.js
--- a/dom/interfaces/base/nsIServiceWorkerManager.idl
+++ b/dom/interfaces/base/nsIServiceWorkerManager.idl
@@ -28,17 +28,17 @@ interface nsIServiceWorkerInfo : nsISupp
   readonly attribute DOMString scope;
   readonly attribute DOMString scriptSpec;
   readonly attribute DOMString currentWorkerURL;
 
   readonly attribute DOMString activeCacheName;
   readonly attribute DOMString waitingCacheName;
 };
 
-[scriptable, builtinclass, uuid(c05b3b45-7f39-458c-8097-afafc7d69b01)]
+[scriptable, builtinclass, uuid(7e3c44bd-112f-4668-83a6-37d1089bb1f8)]
 interface nsIServiceWorkerManager : nsISupports
 {
   /**
    * Registers a ServiceWorker with script loaded from `aScriptURI` to act as
    * the ServiceWorker for aScope.  Requires a valid entry settings object on
    * the stack. This means you must call this from content code 'within'
    * a window.
    *
@@ -106,19 +106,19 @@ interface nsIServiceWorkerManager : nsIS
   [noscript] nsISupports GetActive(in nsIDOMWindow aWindow, in DOMString aScope);
 
   /*
    * Returns a ServiceWorker.
    */
   [noscript] nsISupports GetDocumentController(in nsIDOMWindow aWindow);
 
   /*
-   * This implements the update algorithm.
+   * This implements the soft update algorithm.
    */
-  void update(in DOMString aScope);
+  void softUpdate(in DOMString aScope);
 
   // Testing
   DOMString getScopeForUrl(in DOMString path);
 
   // This is meant to be used only by about:serviceworkers. It returns an array
   // of nsIServiceWorkerInfo.
   nsIArray getAllRegistrations();
 
--- a/dom/webidl/ServiceWorkerGlobalScope.webidl
+++ b/dom/webidl/ServiceWorkerGlobalScope.webidl
@@ -10,21 +10,16 @@
  * this document.
  */
 
 [Global=(Worker,ServiceWorker),
  Exposed=ServiceWorker]
 interface ServiceWorkerGlobalScope : WorkerGlobalScope {
   readonly attribute Clients clients;
 
-  void update();
-
-  [Throws]
-  Promise<boolean> unregister();
-
   attribute EventHandler oninstall;
   attribute EventHandler onactivate;
   attribute EventHandler onfetch;
   attribute EventHandler onbeforeevicted;
   attribute EventHandler onevicted;
 
   // The event.source of these MessageEvents are instances of Client
   attribute EventHandler onmessage;
--- a/dom/webidl/ServiceWorkerRegistration.webidl
+++ b/dom/webidl/ServiceWorkerRegistration.webidl
@@ -12,16 +12,18 @@
  Exposed=Window]
 interface ServiceWorkerRegistration : EventTarget {
   [Unforgeable] readonly attribute ServiceWorker? installing;
   [Unforgeable] readonly attribute ServiceWorker? waiting;
   [Unforgeable] readonly attribute ServiceWorker? active;
 
   readonly attribute USVString scope;
 
+  void update();
+
   [Throws]
   Promise<boolean> unregister();
 
   // event
   attribute EventHandler onupdatefound;
 };
 
 partial interface ServiceWorkerRegistration {
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -2775,41 +2775,56 @@ ServiceWorkerManager::InvalidateServiceW
 
     if (utf8Scope.Equals(aRegistration->mScope)) {
       target->InvalidateWorkerReference(aWhichOnes);
     }
   }
 }
 
 NS_IMETHODIMP
-ServiceWorkerManager::Update(const nsAString& aScope)
+ServiceWorkerManager::SoftUpdate(const nsAString& aScope)
 {
+  AssertIsOnMainThread();
   NS_ConvertUTF16toUTF8 scope(aScope);
 
   nsRefPtr<ServiceWorkerRegistrationInfo> registration;
   mServiceWorkerRegistrationInfos.Get(scope, getter_AddRefs(registration));
   if (NS_WARN_IF(!registration)) {
     return NS_OK;
   }
 
-  // FIXME(nsm): Bug 1089889 Refactor this into SoftUpdate.
+  // "If registration's uninstalling flag is set, abort these steps."
   if (registration->mPendingUninstall) {
     return NS_OK;
   }
 
+  // "If registration's installing worker is not null, abort these steps."
   if (registration->mInstallingWorker) {
     return NS_OK;
   }
 
+  // "Let newestWorker be the result of running Get Newest Worker algorithm
+  // passing registration as its argument.
+  // If newestWorker is null, abort these steps."
+  nsRefPtr<ServiceWorkerInfo> newest = registration->Newest();
+  if (!newest) {
+    return NS_OK;
+  }
+
+  // "Set registration's registering script url to newestWorker's script url."
+  registration->mScriptSpec = newest->ScriptSpec();
+
   ServiceWorkerJobQueue* queue = GetOrCreateJobQueue(scope);
   MOZ_ASSERT(queue);
 
   nsRefPtr<ServiceWorkerUpdateFinishCallback> cb =
     new ServiceWorkerUpdateFinishCallback();
 
+  // "Invoke Update algorithm, or its equivalent, with client, registration as
+  // its argument."
   nsRefPtr<ServiceWorkerRegisterJob> job =
     new ServiceWorkerRegisterJob(queue, registration, cb);
   queue->Append(job);
   return NS_OK;
 }
 
 namespace {
 
@@ -3098,17 +3113,17 @@ ServiceWorkerManager::GetAllRegistration
 }
 
 static PLDHashOperator
 UpdateEachRegistration(const nsACString& aKey,
                        ServiceWorkerRegistrationInfo* aInfo,
                        void* aUserArg) {
   auto This = static_cast<ServiceWorkerManager*>(aUserArg);
   MOZ_ASSERT(!aInfo->mScope.IsEmpty());
-  nsresult res = This->Update(NS_ConvertUTF8toUTF16(aInfo->mScope));
+  nsresult res = This->SoftUpdate(NS_ConvertUTF8toUTF16(aInfo->mScope));
   unused << NS_WARN_IF(NS_FAILED(res));
 
   return PL_DHASH_NEXT;
 }
 
 NS_IMETHODIMP
 ServiceWorkerManager::UpdateAllRegistrations()
 {
--- a/dom/workers/ServiceWorkerRegistration.cpp
+++ b/dom/workers/ServiceWorkerRegistration.cpp
@@ -153,16 +153,26 @@ private:
   ~UnregisterCallback()
   { }
 };
 
 NS_IMPL_ISUPPORTS(UnregisterCallback, nsIServiceWorkerUnregisterCallback)
 
 } // anonymous namespace
 
+void
+ServiceWorkerRegistration::Update()
+{
+  nsCOMPtr<nsIServiceWorkerManager> swm =
+    mozilla::services::GetServiceWorkerManager();
+  MOZ_ASSERT(swm);
+  // The spec defines ServiceWorkerRegistration.update() exactly as Soft Update.
+  swm->SoftUpdate(mScope);
+}
+
 already_AddRefed<Promise>
 ServiceWorkerRegistration::Unregister(ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(GetOwner());
   if (!go) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
--- a/dom/workers/ServiceWorkerRegistration.h
+++ b/dom/workers/ServiceWorkerRegistration.h
@@ -48,16 +48,19 @@ public:
   GetActive();
 
   void
   GetScope(nsAString& aScope) const
   {
     aScope = mScope;
   }
 
+  void
+  Update();
+
   already_AddRefed<Promise>
   Unregister(ErrorResult& aRv);
 
   // Useful methods for ServiceWorkerManager:
   void
   InvalidateWorkerReference(WhichServiceWorker aWhichOnes);
 
   // DOMEventTargethelper
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -779,240 +779,9 @@ IsDebuggerSandbox(JSObject* object)
 
 bool
 GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
 {
   JS_ReportErrorNumber(aCx, js::GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
   return false;
 }
 
-namespace {
-
-class WorkerScopeUnregisterRunnable;
-class UnregisterResultRunnable final : public WorkerRunnable
-{
-public:
-  enum State { Succeeded, Failed };
-
-  UnregisterResultRunnable(WorkerPrivate* aWorkerPrivate,
-                           WorkerScopeUnregisterRunnable* aRunnable,
-                           State aState, bool aValue)
-    : WorkerRunnable(aWorkerPrivate,
-                     WorkerThreadUnchangedBusyCount)
-    , mRunnable(aRunnable), mState(aState), mValue(aValue)
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-    MOZ_ASSERT(mRunnable);
-  }
-
-  virtual bool
-  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
-
-private:
-  nsRefPtr<WorkerScopeUnregisterRunnable> mRunnable;
-  State mState;
-  bool mValue;
-};
-
-class WorkerScopeUnregisterRunnable final : public nsRunnable
-                                          , public nsIServiceWorkerUnregisterCallback
-                                          , public WorkerFeature
-{
-  WorkerPrivate* mWorkerPrivate;
-  nsString mScope;
-
-  // Worker thread only.
-  nsRefPtr<Promise> mWorkerPromise;
-  bool mCleanedUp;
-
-  ~WorkerScopeUnregisterRunnable()
-  {
-    MOZ_ASSERT(mCleanedUp);
-  }
-
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-
-  WorkerScopeUnregisterRunnable(WorkerPrivate* aWorkerPrivate,
-                                Promise* aWorkerPromise,
-                                const nsAString& aScope)
-    : mWorkerPrivate(aWorkerPrivate)
-    , mScope(aScope)
-    , mWorkerPromise(aWorkerPromise)
-    , mCleanedUp(false)
-  {
-    MOZ_ASSERT(aWorkerPrivate);
-    aWorkerPrivate->AssertIsOnWorkerThread();
-    MOZ_ASSERT(aWorkerPromise);
-
-    if (!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), this)) {
-      MOZ_ASSERT(false, "cannot add the worker feature!");
-      mWorkerPromise = nullptr;
-      mCleanedUp = true;
-      return;
-    }
-  }
-
-  Promise*
-  WorkerPromise() const
-  {
-    mWorkerPrivate->AssertIsOnWorkerThread();
-    MOZ_ASSERT(!mCleanedUp);
-    return mWorkerPromise;
-  }
-
-  NS_IMETHODIMP
-  UnregisterSucceeded(bool aState) override
-  {
-    AssertIsOnMainThread();
-
-    nsRefPtr<UnregisterResultRunnable> runnable =
-      new UnregisterResultRunnable(mWorkerPrivate, this,
-                                   UnregisterResultRunnable::Succeeded, aState);
-    runnable->Dispatch(nullptr);
-    return NS_OK;
-  }
-
-  NS_IMETHODIMP
-  UnregisterFailed() override
-  {
-    AssertIsOnMainThread();
-
-    nsRefPtr<UnregisterResultRunnable> runnable =
-      new UnregisterResultRunnable(mWorkerPrivate, this,
-                                   UnregisterResultRunnable::Failed, false);
-    runnable->Dispatch(nullptr);
-    return NS_OK;
-  }
-
-  void
-  CleanUp(JSContext* aCx)
-  {
-    mWorkerPrivate->AssertIsOnWorkerThread();
-
-    if (mCleanedUp) {
-      return;
-    }
-
-    mWorkerPrivate->RemoveFeature(aCx, this);
-    mWorkerPromise = nullptr;
-    mCleanedUp = true;
-  }
-
-  NS_IMETHODIMP
-  Run() override
-  {
-    AssertIsOnMainThread();
-
-    nsresult rv;
-    nsCOMPtr<nsIServiceWorkerManager> swm =
-      do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      UnregisterFailed();
-      return NS_OK;
-    }
-
-    // We don't need to check if the principal can load this mScope because a
-    // ServiceWorkerGlobalScope can always unregister itself.
-
-    rv = swm->Unregister(mWorkerPrivate->GetPrincipal(), this, mScope);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      UnregisterFailed();
-      return NS_OK;
-    }
-
-    return NS_OK;
-  }
-
-  virtual bool Notify(JSContext* aCx, workers::Status aStatus) override
-  {
-    mWorkerPrivate->AssertIsOnWorkerThread();
-    MOZ_ASSERT(aStatus > workers::Running);
-    CleanUp(aCx);
-    return true;
-  }
-};
-
-NS_IMPL_ISUPPORTS_INHERITED(WorkerScopeUnregisterRunnable, nsRunnable,
-                            nsIServiceWorkerUnregisterCallback)
-
-bool
-UnregisterResultRunnable::WorkerRun(JSContext* aCx,
-                                    WorkerPrivate* aWorkerPrivate)
-{
-  if (mState == Failed) {
-    mRunnable->WorkerPromise()->MaybeReject(aCx, JS::UndefinedHandleValue);
-  } else {
-    mRunnable->WorkerPromise()->MaybeResolve(mValue);
-  }
-
-  mRunnable->CleanUp(aCx);
-  return true;
-}
-
-} // anonymous namespace
-
-already_AddRefed<Promise>
-ServiceWorkerGlobalScope::Unregister(ErrorResult& aRv)
-{
-  mWorkerPrivate->AssertIsOnWorkerThread();
-  MOZ_ASSERT(mWorkerPrivate->IsServiceWorker());
-
-  nsRefPtr<Promise> promise = Promise::Create(this, aRv);
-  if (aRv.Failed()) {
-    return nullptr;
-  }
-
-  nsRefPtr<WorkerScopeUnregisterRunnable> runnable =
-    new WorkerScopeUnregisterRunnable(mWorkerPrivate, promise, mScope);
-
-  // Ensure the AddFeature succeeded before dispatching.
-  // Otherwise we let the promise remain pending since script is going to stop
-  // soon anyway.
-  if (runnable->WorkerPromise()) {
-    NS_DispatchToMainThread(runnable);
-  }
-
-  return promise.forget();
-}
-
-namespace {
-
-class UpdateRunnable final : public nsRunnable
-{
-  nsString mScope;
-
-public:
-  explicit UpdateRunnable(const nsAString& aScope)
-    : mScope(aScope)
-  { }
-
-  NS_IMETHODIMP
-  Run()
-  {
-    AssertIsOnMainThread();
-
-    nsresult rv;
-    nsCOMPtr<nsIServiceWorkerManager> swm =
-      do_GetService(SERVICEWORKERMANAGER_CONTRACTID, &rv);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return NS_OK;
-    }
-
-    swm->Update(mScope);
-    return NS_OK;
-  }
-};
-
-} //anonymous namespace
-
-void
-ServiceWorkerGlobalScope::Update()
-{
-  mWorkerPrivate->AssertIsOnWorkerThread();
-  MOZ_ASSERT(mWorkerPrivate->IsServiceWorker());
-
-  nsRefPtr<UpdateRunnable> runnable =
-    new UpdateRunnable(mScope);
-  NS_DispatchToMainThread(runnable);
-}
-
 END_WORKERS_NAMESPACE
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -213,22 +213,16 @@ public:
                    JS::MutableHandle<JSObject*> aReflector) override;
 
   void
   GetScope(nsString& aScope) const
   {
     aScope = mScope;
   }
 
-  void
-  Update();
-
-  already_AddRefed<Promise>
-  Unregister(ErrorResult& aRv);
-
   ServiceWorkerClients*
   Clients();
 
   IMPL_EVENT_HANDLER(activate)
   IMPL_EVENT_HANDLER(beforeevicted)
   IMPL_EVENT_HANDLER(evicted)
   IMPL_EVENT_HANDLER(fetch)
   IMPL_EVENT_HANDLER(install)
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -8,25 +8,21 @@ support-files =
   parse_error_worker.js
   activate_event_error_worker.js
   install_event_worker.js
   install_event_error_worker.js
   simpleregister/index.html
   simpleregister/ready.html
   controller/index.html
   unregister/index.html
-  unregister/unregister.html
-  workerUpdate/update.html
   sw_clients/simple.html
   sw_clients/service_worker_controlled.html
   sw_clients/focus_stealing_client.html
   match_all_worker.js
   match_all_advanced_worker.js
-  worker_unregister.js
-  worker_update.js
   message_posting_worker.js
   fetch/index.html
   fetch/fetch_worker_script.js
   fetch/fetch_tests.js
   fetch/deliver-gzip.sjs
   fetch/real-file.txt
   fetch/context/index.html
   fetch/context/register.html
@@ -81,18 +77,16 @@ skip-if = os != "linux" # Bug 1136780
 [test_https_fetch.html]
 [test_https_fetch_cloned_response.html]
 [test_match_all.html]
 [test_match_all_advanced.html]
 [test_install_event.html]
 [test_navigator.html]
 [test_scopes.html]
 [test_controller.html]
-[test_workerUpdate.html]
-[test_workerUnregister.html]
 [test_post_message.html]
 [test_post_message_advanced.html]
 [test_post_message_source.html]
 [test_match_all_client_properties.html]
 [test_close.html]
 [test_serviceworker_interfaces.html]
 [test_serviceworker_not_sharedworker.html]
 [test_match_all_client_id.html]
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/test_workerUnregister.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Bug 982728 - Test ServiceWorkerGlobalScope.unregister</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<div id="container"></div>
-<script class="testbody" type="text/javascript">
-
-  function simpleRegister() {
-    return navigator.serviceWorker.register("worker_unregister.js", { scope: "unregister/" }).then(function(swr) {
-      if (swr.installing) {
-        return new Promise(function(resolve, reject) {
-          swr.installing.onstatechange = function(e) {
-            if (swr.waiting) {
-              swr.waiting.onstatechange = function(e) {
-                if (swr.active) {
-                  resolve();
-                } else if (swr.waiting && swr.waiting.state == "redundant") {
-                  reject("Should not go into redundant");
-                }
-              }
-            } else {
-              if (swr.active) {
-                resolve();
-              } else {
-                reject("No waiting and no active!");
-              }
-            }
-          }
-        });
-      } else {
-        return Promise.reject("Installing should be non-null");
-      }
-    });
-  }
-
-  function waitForMessages(sw) {
-    var p = new Promise(function(resolve, reject) {
-      window.onmessage = function(e) {
-        if (e.data === "DONE") {
-          ok(true, "The worker has unregistered itself");
-        } else if (e.data === "ERROR") {
-          ok(false, "The worker has unregistered itself");
-        } else if (e.data === "FINISH") {
-          resolve();
-        }
-      }
-    });
-
-    var frame = document.createElement("iframe");
-    frame.setAttribute("src", "unregister/unregister.html");
-    document.body.appendChild(frame);
-
-    return p;
-  }
-
-  function runTest() {
-    simpleRegister().then(waitForMessages).catch(function(e) {
-      ok(false, "Something went wrong.");
-    }).then(function() {
-      SimpleTest.finish();
-    });
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [
-    ["dom.serviceWorkers.exemptFromPerDomainMax", true],
-    ["dom.serviceWorkers.enabled", true],
-    ["dom.serviceWorkers.testing.enabled", true]
-  ]}, runTest);
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/test_workerUpdate.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Bug 1065366 - Test ServiceWorkerGlobalScope.update</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<div id="container"></div>
-<script class="testbody" type="text/javascript">
-
-  function simpleRegister() {
-    return navigator.serviceWorker.register("worker_update.js", { scope: "workerUpdate/" });
-  }
-
-  function waitForMessages(sw) {
-    var p = new Promise(function(resolve, reject) {
-      window.onmessage = function(e) {
-        if (e.data === "FINISH") {
-          ok(true, "The worker has updated itself");
-          resolve();
-        }
-      }
-    });
-
-    var frame = document.createElement("iframe");
-    frame.setAttribute("src", "workerUpdate/update.html");
-    document.body.appendChild(frame);
-
-    return p;
-  }
-
-  function runTest() {
-    simpleRegister().then(waitForMessages).catch(function(e) {
-      ok(false, "Something went wrong.");
-    }).then(function() {
-      SimpleTest.finish();
-    });
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [
-    ["dom.serviceWorkers.exemptFromPerDomainMax", true],
-    ["dom.serviceWorkers.enabled", true],
-    ["dom.serviceWorkers.testing.enabled", true]
-  ]}, runTest);
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/unregister/unregister.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test worker::unregister</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<script type="text/javascript">
-
-  navigator.serviceWorker.onmessage = function(e) { parent.postMessage(e.data, "*"); }
-  navigator.serviceWorker.controller.postMessage("GO");
-
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/workerUpdate/update.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test worker::update</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<script type="text/javascript">
-
-  navigator.serviceWorker.onmessage = function(e) { parent.postMessage(e.data, "*"); }
-  navigator.serviceWorker.ready.then(function() {
-    navigator.serviceWorker.controller.postMessage("GO");
-  });
-
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/worker_unregister.js
+++ /dev/null
@@ -1,16 +0,0 @@
-onmessage = function(e) {
-  clients.matchAll().then(function(c) {
-    if (c.length == 0) {
-      // We cannot proceed.
-      return;
-    }
-
-    unregister().then(function() {
-      c[0].postMessage('DONE');
-    }, function() {
-      c[0].postMessage('ERROR');
-    }).then(function() {
-      c[0].postMessage('FINISH');
-    });
-  });
-}
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/worker_update.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// For now this test only calls update to verify that our registration
-// job queueing works properly when called from the worker thread. We should
-// test actual update scenarios with a SJS test.
-onmessage = function(e) {
-  self.update();
-  clients.matchAll().then(function(c) {
-    if (c.length == 0) {
-      // We cannot proceed.
-      return;
-    }
-
-    c[0].postMessage('FINISH');
-  });
-}