Bug 1162850 - Don't stop looking for style sheet load finishes after the FontFaceSet gets a DOMContentLoaded. r=jdaggett

This commit is contained in:
Cameron McCormack 2015-05-13 15:06:52 +10:00
Родитель c973b378b0
Коммит c888a98f5a
2 изменённых файлов: 16 добавлений и 7 удалений

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

@ -136,15 +136,22 @@ FontFaceSet::WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto)
void void
FontFaceSet::Disconnect() FontFaceSet::Disconnect()
{ {
if (mDocument) { RemoveDOMContentLoadedListener();
mDocument->RemoveSystemEventListener(NS_LITERAL_STRING("DOMContentLoaded"),
this, false); if (mDocument && mDocument->CSSLoader()) {
// We're null checking CSSLoader() since FontFaceSet::Disconnect() might be // We're null checking CSSLoader() since FontFaceSet::Disconnect() might be
// being called during unlink, at which time the loader amy already have // being called during unlink, at which time the loader amy already have
// been unlinked from the document. // been unlinked from the document.
if (mDocument->CSSLoader()) { mDocument->CSSLoader()->RemoveObserver(this);
mDocument->CSSLoader()->RemoveObserver(this); }
} }
void
FontFaceSet::RemoveDOMContentLoadedListener()
{
if (mDocument) {
mDocument->RemoveSystemEventListener(NS_LITERAL_STRING("DOMContentLoaded"),
this, false);
} }
} }
@ -1557,7 +1564,7 @@ FontFaceSet::HandleEvent(nsIDOMEvent* aEvent)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
Disconnect(); RemoveDOMContentLoadedListener();
CheckLoadingFinished(); CheckLoadingFinished();
return NS_OK; return NS_OK;

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

@ -197,6 +197,8 @@ private:
*/ */
void Disconnect(); void Disconnect();
void RemoveDOMContentLoadedListener();
/** /**
* Returns whether there might be any pending font loads, which should cause * Returns whether there might be any pending font loads, which should cause
* the mReady Promise not to be resolved yet. * the mReady Promise not to be resolved yet.