Bug 1519918 - Make nsFontFaceLoader::mFontFaceSet a weak reference. r=heycam

And start tracking the loader ASAP to be on the safe side.

Both sides already take care of cleaning up pointers on destruction.

Differential Revision: https://phabricator.services.mozilla.com/D16514

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-01-21 11:10:26 +00:00
Родитель 5ef86a8143
Коммит 45336846a9
2 изменённых файлов: 3 добавлений и 2 удалений

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

@ -581,6 +581,7 @@ nsresult FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
RefPtr<nsFontFaceLoader> fontLoader = new nsFontFaceLoader( RefPtr<nsFontFaceLoader> fontLoader = new nsFontFaceLoader(
aUserFontEntry, aFontFaceSrc->mURI->get(), this, channel); aUserFontEntry, aFontFaceSrc->mURI->get(), this, channel);
mLoaders.PutEntry(fontLoader);
if (LOG_ENABLED()) { if (LOG_ENABLED()) {
LOG( LOG(
@ -638,7 +639,6 @@ nsresult FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
} }
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
mLoaders.PutEntry(fontLoader);
fontLoader->StartedLoading(streamLoader); fontLoader->StartedLoading(streamLoader);
// let the font entry remember the loader, in case we need to cancel it // let the font entry remember the loader, in case we need to cancel it
aUserFontEntry->SetLoader(fontLoader); aUserFontEntry->SetLoader(fontLoader);

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

@ -55,7 +55,8 @@ class nsFontFaceLoader final : public nsIStreamLoaderObserver,
private: private:
RefPtr<gfxUserFontEntry> mUserFontEntry; RefPtr<gfxUserFontEntry> mUserFontEntry;
nsCOMPtr<nsIURI> mFontURI; nsCOMPtr<nsIURI> mFontURI;
RefPtr<mozilla::dom::FontFaceSet> mFontFaceSet; // Cleared in FontFaceSet::~FontFaceSet, and on cancelation and such too.
mozilla::dom::FontFaceSet* MOZ_NON_OWNING_REF mFontFaceSet;
nsCOMPtr<nsIChannel> mChannel; nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsITimer> mLoadTimer; nsCOMPtr<nsITimer> mLoadTimer;
mozilla::TimeStamp mStartTime; mozilla::TimeStamp mStartTime;