зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
b7abed98d9
Коммит
8cebbf96af
|
@ -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 }
|
||||
|
|
Загрузка…
Ссылка в новой задаче