Bug 1659838: Change IOUtils shutdown blocker phase from XPCOMWillShutdown to ProfileBeforeChange r=Gijs

IOUtils is meant to act as a drop-in replacement for OS.File. Previously,
IOUtils would block shutdown at the XPCOMWillShutDown phase to allow pending
I/O tasks to finish, however, OS.File blocks for the same reason during the
ProfileBeforeChange phase.

To make IOUtils directly compatible with OS.File, we now match this behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D87511
This commit is contained in:
Keefer Rourke 2020-08-24 18:28:25 +00:00
Родитель 07edf2a38a
Коммит b1744ebbe9
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -3,6 +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/.
*/
/**
* IOUtils is a simple, efficient interface for performing file I/O from a
* privileged chrome-only context. All asynchronous I/O tasks are run on
* a background thread.
*
* Pending I/O tasks will block shutdown at the |profileBeforeChange| phase.
* During this shutdown phase, no additional I/O tasks will be accepted --
* method calls to this interface will reject once shutdown has entered this
* phase.
*/
[ChromeOnly, Exposed=(Window, Worker)]
namespace IOUtils {
/**

Просмотреть файл

@ -451,7 +451,7 @@ already_AddRefed<nsIAsyncShutdownClient> IOUtils::GetShutdownBarrier() {
MOZ_ASSERT(svc);
nsCOMPtr<nsIAsyncShutdownClient> barrier;
nsresult rv = svc->GetXpcomWillShutdown(getter_AddRefs(barrier));
nsresult rv = svc->GetProfileBeforeChange(getter_AddRefs(barrier));
NS_ENSURE_SUCCESS(rv, nullptr);
sBarrier = barrier;
}