Skip to content

Commit

Permalink
Bug 1602393 - add debugging info to ServiceWorkerRegistrar shutdown b…
Browse files Browse the repository at this point in the history
…locking r=asuth

As far as I can tell, ServiceWorkerRegistrar shutdown hang could only occur if
writing data to disk stalls or the shutdown message from the main thread to
background thread doesn't complete. (Although I still cannot piece together the
exact possible sequence of events that would lead to these hangs.)

Differential Revision: https://phabricator.services.mozilla.com/D78222
  • Loading branch information
perryjiang committed Jun 8, 2020
1 parent 40766bf commit 447856b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dom/serviceworkers/ServiceWorkerRegistrar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "nsIOutputStream.h"
#include "nsISafeOutputStream.h"
#include "nsIServiceWorkerManager.h"
#include "nsIWritablePropertyBag2.h"

#include "MainThreadUtils.h"
#include "mozilla/ClearOnShutdown.h"
Expand All @@ -26,6 +27,8 @@
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/Result.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozJSComponentLoader.h"
Expand Down Expand Up @@ -1192,7 +1195,20 @@ ServiceWorkerRegistrar::GetName(nsAString& aName) {
}

NS_IMETHODIMP
ServiceWorkerRegistrar::GetState(nsIPropertyBag**) { return NS_OK; }
ServiceWorkerRegistrar::GetState(nsIPropertyBag** aBagOut) {
nsCOMPtr<nsIWritablePropertyBag2> propertyBag =
do_CreateInstance("@mozilla.org/hash-property-bag;1");

MOZ_TRY(propertyBag->SetPropertyAsBool(NS_LITERAL_STRING("shuttingDown"),
mShuttingDown));

MOZ_TRY(propertyBag->SetPropertyAsBool(
NS_LITERAL_STRING("saveDataRunnableDispatched"), mRunnableDispatched));

propertyBag.forget(aBagOut);

return NS_OK;
}

#define RELEASE_ASSERT_SUCCEEDED(rv, name) \
do { \
Expand Down

0 comments on commit 447856b

Please sign in to comment.