Bug 1466432 - Make sure the document.fonts.ready Promise resolves even when there's no refresh driver. r=heycam

This commit is contained in:
Jonathan Watt 2018-05-18 20:39:11 +01:00
Родитель 6d4c239fd8
Коммит 81fa515ba7
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -155,6 +155,12 @@ FontFaceSet::FontFaceSet(nsPIDOMWindowInner* aWindow, nsIDocument* aDocument)
if (!mDocument->DidFireDOMContentLoaded()) {
mDocument->AddSystemEventListener(NS_LITERAL_STRING("DOMContentLoaded"),
this, false, false);
} else {
// In some cases we can't rely on CheckLoadingFinished being called from
// the refresh driver. For example, documents in display:none iframes.
// Or if the document has finished loading and painting at the time that
// script requests document.fonts and causes us to get here.
CheckLoadingFinished();
}
mDocument->CSSLoader()->AddObserver(this);