Bug 1657231, part 2 - Clear sInitialized when we destroy the singleton url preloader. r=kmag

Some of the entry points into the URL preloader check sInitialized, and only
use it if it is true. However, if we're late in shutdown and we've already
cleared the singleton for the preloader then our failure to clear the
sInitialized flag means we'll recreate the preloader, which is going
to fail in various ways.

I think this won't help in the case of bug 1656973, because that seems
to go through AutoBeginReading, which unconditionally creates a new
singleton if one does not exist.

Differential Revision: https://phabricator.services.mozilla.com/D86030
This commit is contained in:
Andrew McCreight 2020-08-06 22:35:10 +00:00
Родитель 8b026394da
Коммит e6886b3c16
1 изменённых файлов: 1 добавлений и 0 удалений

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

@ -102,6 +102,7 @@ StaticRefPtr<URLPreloader> URLPreloader::sSingleton;
URLPreloader::~URLPreloader() { URLPreloader::~URLPreloader() {
if (sInitialized) { if (sInitialized) {
UnregisterWeakMemoryReporter(this); UnregisterWeakMemoryReporter(this);
sInitialized = false;
} }
} }