Bug 1435002 - Move Fluent's l10n.js to MozBeforeInitialXULLayout. r=smaug

MozReview-Commit-ID: GC9Yq9TxXyC

--HG--
extra : rebase_source : 10c9b5f1e6c62c12725f2814aabf28dbb175f0bf
This commit is contained in:
Zibi Braniecki 2018-01-15 18:00:43 -08:00
parent b7abed98d9
commit 8cebbf96af

View File

@ -9,11 +9,20 @@
* @returns {Promise}
*/
function documentReady() {
if (document.contentType === 'application/vnd.mozilla.xul+xml') {
// XUL
return new Promise(
resolve => document.addEventListener(
'MozBeforeInitialXULLayout', resolve, { once: true }
)
);
}
// HTML
const rs = document.readyState;
if (rs === 'interactive' || rs === 'completed') {
return Promise.resolve();
}
return new Promise(
resolve => document.addEventListener(
'readystatechange', resolve, { once: true }